diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-06-06 00:05:19 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2015-06-20 18:49:56 +0200 |
commit | b0ba5a08f7423e5e75c25a638418444e9a7b8f27 (patch) | |
tree | ae6b9b9193dabedf510cb54b75ee9e847dd9275b /app/src/main/java/de/danoeh/antennapod/menuhandler | |
parent | e1b494ba0577ce2cb60e6b3120e3534fb1f3211c (diff) | |
download | AntennaPod-b0ba5a08f7423e5e75c25a638418444e9a7b8f27.zip |
Sharing in options and context menus
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/menuhandler')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java | 26 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java | 7 |
2 files changed, 24 insertions, 9 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index 64ba3dca3..c33ab93b4 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -85,8 +85,19 @@ public class FeedItemMenuHandler { if (!(!isInQueue && selectedItem.getMedia() != null)) { mi.setItemVisibility(R.id.add_to_queue_item, false); } + if (!showExtendedMenu || selectedItem.getLink() == null) { + mi.setItemVisibility(R.id.visit_website_item, false); mi.setItemVisibility(R.id.share_link_item, false); + mi.setItemVisibility(R.id.share_link_with_position_item, false); + } + if (!showExtendedMenu || !hasMedia || selectedItem.getMedia().getDownload_url() == null) { + mi.setItemVisibility(R.id.share_download_url_item, false); + mi.setItemVisibility(R.id.share_download_url_with_position_item, false); + } + if(false == hasMedia || selectedItem.getMedia().getPosition() <= 0) { + mi.setItemVisibility(R.id.share_link_with_position_item, false); + mi.setItemVisibility(R.id.share_download_url_with_position_item, false); } if (!(state == FeedItem.State.UNREAD || state == FeedItem.State.IN_PROGRESS)) { @@ -109,12 +120,6 @@ public class FeedItemMenuHandler { mi.setItemVisibility(R.id.deactivate_auto_download, false); } - if (!showExtendedMenu || selectedItem.getLink() == null || - false == IntentUtils.isCallable(context, new Intent(Intent.ACTION_VIEW, Uri.parse(selectedItem.getLink())))) - { - mi.setItemVisibility(R.id.visit_website_item, false); - } - if (selectedItem.getPaymentLink() == null || !selectedItem.getFlattrStatus().flattrable()) { mi.setItemVisibility(R.id.support_item, false); } @@ -213,6 +218,15 @@ public class FeedItemMenuHandler { case R.id.share_link_item: ShareUtils.shareFeedItemLink(context, selectedItem); break; + case R.id.share_download_url_item: + ShareUtils.shareFeedItemDownloadLink(context, selectedItem); + break; + case R.id.share_link_with_position_item: + ShareUtils.shareFeedItemLink(context, selectedItem, true); + break; + case R.id.share_download_url_with_position_item: + ShareUtils.shareFeedItemDownloadLink(context, selectedItem, true); + break; default: Log.d(TAG, "Unknown menuItemId: " + menuItemId); return false; diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index 85394d01e..30cc2c640 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -42,10 +42,11 @@ public class FeedMenuHandler { Log.d(TAG, "Preparing options menu"); menu.findItem(R.id.mark_all_read_item).setVisible(selectedFeed.hasNewItems()); - if (selectedFeed.getPaymentLink() != null && selectedFeed.getFlattrStatus().flattrable()) + if (selectedFeed.getPaymentLink() != null && selectedFeed.getFlattrStatus().flattrable()) { menu.findItem(R.id.support_item).setVisible(true); - else + } else { menu.findItem(R.id.support_item).setVisible(false); + } menu.findItem(R.id.refresh_complete_item).setVisible(selectedFeed.isPaged()); @@ -99,7 +100,7 @@ public class FeedMenuHandler { case R.id.share_link_item: ShareUtils.shareFeedlink(context, selectedFeed); break; - case R.id.share_source_item: + case R.id.share_download_url_item: ShareUtils.shareFeedDownloadLink(context, selectedFeed); break; default: |