From 8ace49fb71b5d1c0731c834cb12726b8051bb5ab Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 25 Nov 2011 13:46:11 +0300 Subject: [PATCH] implement article sharing --- src/org/fox/ttrss/MainActivity.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 6c583974..56760642 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -218,6 +218,9 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect case R.id.close_article: closeArticle(); return true; + case R.id.share_article: + shareArticle(m_selectedArticle); + return true; case R.id.show_feeds: if (getUnreadOnly()) { item.setTitle(R.string.menu_unread_feeds); @@ -232,6 +235,18 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect } } + public void shareArticle(Article article) { + if (article != null) { + Intent intent = new Intent(Intent.ACTION_SEND); + + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_SUBJECT, article.title); + intent.putExtra(Intent.EXTRA_TEXT, article.link); + + startActivity(Intent.createChooser(intent, getString(R.id.share_article))); + } + } + public void closeArticle() { findViewById(R.id.article_fragment).setVisibility(View.GONE); findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);