diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-06-26 14:03:59 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-06-26 14:03:59 +0200 |
commit | 30aeef5b3e25e8bcefb255454a3e90192455a86f (patch) | |
tree | ca9530684be583f177b392c34af2aa588fd0e58c /src/de/podfetcher | |
parent | 020d3afba9c55b0a15b4ccc40b27139319f335f7 (diff) | |
download | AntennaPod-30aeef5b3e25e8bcefb255454a3e90192455a86f.zip |
Added menuitem to visit the website of a feed or feeditem
Diffstat (limited to 'src/de/podfetcher')
-rw-r--r-- | src/de/podfetcher/util/FeedItemMenuHandler.java | 10 | ||||
-rw-r--r-- | src/de/podfetcher/util/FeedMenuHandler.java | 19 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/de/podfetcher/util/FeedItemMenuHandler.java b/src/de/podfetcher/util/FeedItemMenuHandler.java index 0edb183d0..503c454eb 100644 --- a/src/de/podfetcher/util/FeedItemMenuHandler.java +++ b/src/de/podfetcher/util/FeedItemMenuHandler.java @@ -1,6 +1,8 @@ package de.podfetcher.util; import android.content.Context; +import android.content.Intent; +import android.net.Uri; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; @@ -44,6 +46,10 @@ public class FeedItemMenuHandler { menu.findItem(R.id.mark_read_item).setVisible(true); } + if (selectedItem.getLink() != null) { + menu.findItem(R.id.visit_website_item).setVisible(true); + } + return true; } @@ -82,6 +88,10 @@ public class FeedItemMenuHandler { manager.playMedia(context, selectedItem.getMedia(), true, true, true); break; + case R.id.visit_website_item: + Uri uri = Uri.parse(selectedItem.getLink()); + context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); + break; default: return false; } diff --git a/src/de/podfetcher/util/FeedMenuHandler.java b/src/de/podfetcher/util/FeedMenuHandler.java index 84f6d898f..bf258078d 100644 --- a/src/de/podfetcher/util/FeedMenuHandler.java +++ b/src/de/podfetcher/util/FeedMenuHandler.java @@ -1,6 +1,8 @@ package de.podfetcher.util; import android.content.Context; +import android.content.Intent; +import android.net.Uri; import com.actionbarsherlock.view.ActionMode; import com.actionbarsherlock.view.Menu; @@ -12,27 +14,30 @@ import de.podfetcher.feed.Feed; import de.podfetcher.feed.FeedItem; import de.podfetcher.feed.FeedManager; - /** Handles interactions with the FeedItemMenu. */ public class FeedMenuHandler { - - public static boolean onCreateOptionsMenu(MenuInflater inflater, Menu menu) { - inflater.inflate(R.menu.feedlist, menu); + + public static boolean onCreateOptionsMenu(MenuInflater inflater, Menu menu) { + inflater.inflate(R.menu.feedlist, menu); return true; } - public static boolean onPrepareOptionsMenu(Menu menu) { return true; } /** NOTE: This method does not handle clicks on the 'remove feed' - item. */ - public static boolean onOptionsItemClicked(Context context, MenuItem item, Feed selectedFeed) { + public static boolean onOptionsItemClicked(Context context, MenuItem item, + Feed selectedFeed) { FeedManager manager = FeedManager.getInstance(); - switch (item.getItemId()) { + switch (item.getItemId()) { case R.id.mark_all_read_item: manager.markFeedRead(context, selectedFeed); break; + case R.id.visit_website_item: + Uri uri = Uri.parse(selectedFeed.getLink()); + context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); + break; default: return false; } |