diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-08-01 00:29:21 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-08-01 00:29:21 +0200 |
commit | db1a83061eef7a58b602d319be9d1d1df3343820 (patch) | |
tree | 4165e15391baf20a22f86c8b6ed8dd91796a94cc | |
parent | 65fdae0ea7b9a700fe87616e813bcc5779bd786a (diff) | |
download | AntennaPod-db1a83061eef7a58b602d319be9d1d1df3343820.zip |
Fixed incorrect behavior of FeedItemMenuHandler if an item had no media
-rw-r--r-- | src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java index a5e697140..888cc9692 100644 --- a/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java +++ b/src/de/danoeh/antennapod/util/menuhandler/FeedItemMenuHandler.java @@ -24,8 +24,8 @@ public class FeedItemMenuHandler { public static boolean onPrepareMenu(Menu menu, FeedItem selectedItem) { FeedManager manager = FeedManager.getInstance(); DownloadRequester requester = DownloadRequester.getInstance(); - - if (selectedItem.getMedia() != null) { + boolean hasMedia = selectedItem.getMedia() != null; + if (hasMedia) { if (selectedItem.getMedia().isDownloaded()) { menu.findItem(R.id.play_item).setVisible(true); menu.findItem(R.id.remove_item).setVisible(true); @@ -33,20 +33,21 @@ public class FeedItemMenuHandler { menu.findItem(R.id.download_item).setVisible(true); menu.findItem(R.id.stream_item).setVisible(true); } + } + + boolean isDownloading = hasMedia + && requester.isDownloadingFile(selectedItem.getMedia()); + menu.findItem(R.id.cancel_download_item).setVisible(isDownloading); - boolean isDownloading = requester.isDownloadingFile(selectedItem.getMedia()); - menu.findItem(R.id.cancel_download_item).setVisible(isDownloading); - - if (manager.isInQueue(selectedItem)) { - menu.findItem(R.id.remove_from_queue_item).setVisible(true); - } else { - menu.findItem(R.id.add_to_queue_item).setVisible(true); - } - - menu.findItem(R.id.share_link_item).setVisible( - selectedItem.getLink() != null); + if (manager.isInQueue(selectedItem)) { + menu.findItem(R.id.remove_from_queue_item).setVisible(true); + } else { + menu.findItem(R.id.add_to_queue_item).setVisible(true); } + menu.findItem(R.id.share_link_item).setVisible( + selectedItem.getLink() != null); + if (selectedItem.isRead()) { menu.findItem(R.id.mark_unread_item).setVisible(true); } else { @@ -104,7 +105,8 @@ public class FeedItemMenuHandler { context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); break; case R.id.support_item: - new FlattrClickWorker(context, selectedItem.getPaymentLink()).executeAsync(); + new FlattrClickWorker(context, selectedItem.getPaymentLink()) + .executeAsync(); break; case R.id.share_link_item: ShareUtils.shareFeedItemLink(context, selectedItem); |