diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-03-28 18:08:26 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-04-14 18:40:01 +0200 |
commit | bf52c4945ce146ac666bf1f3c505cfec3ac80be1 (patch) | |
tree | 7274bb7c42e1da99e290f89f2f8e92e906ea463f /app/src/main/java/de/danoeh/antennapod/menuhandler | |
parent | 8683277627f4cf60b4093c8b8e5276264af65845 (diff) | |
download | AntennaPod-bf52c4945ce146ac666bf1f3c505cfec3ac80be1.zip |
Don't use LongLists, use tags directly
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/menuhandler')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java | 17 |
1 files changed, 7 insertions, 10 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 c1f94acc5..b80213459 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.menuhandler; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.support.annotation.Nullable; import android.util.Log; import android.widget.Toast; @@ -54,14 +55,14 @@ public class FeedItemMenuHandler { * @param showExtendedMenu True if MenuItems that let the user share information about * the FeedItem and visit its website should be set visible. This * parameter should be set to false if the menu space is limited. - * @param queueAccess Used for testing if the queue contains the selected item + * @param queueAccess Used for testing if the queue contains the selected item; only used for + * move to top/bottom in the queue * @return Returns true if selectedItem is not null. */ public static boolean onPrepareMenu(MenuInterface mi, FeedItem selectedItem, boolean showExtendedMenu, - LongList queueAccess, - LongList favorites) { + @Nullable LongList queueAccess) { if (selectedItem == null) { return false; } @@ -72,10 +73,7 @@ public class FeedItemMenuHandler { mi.setItemVisibility(R.id.skip_episode_item, false); } - boolean isInQueue = false; - if(queueAccess != null) { - isInQueue = queueAccess.contains(selectedItem.getId()); - } + boolean isInQueue = selectedItem.isTagged(FeedItem.TAG_QUEUE); if(queueAccess == null || queueAccess.size() == 0 || queueAccess.get(0) == selectedItem.getId()) { mi.setItemVisibility(R.id.move_to_top_item, false); } @@ -126,7 +124,7 @@ public class FeedItemMenuHandler { mi.setItemVisibility(R.id.support_item, false); } - boolean isFavorite = favorites != null && favorites.contains(selectedItem.getId()); + boolean isFavorite = selectedItem.isTagged(FeedItem.TAG_FAVORITE); mi.setItemVisibility(R.id.add_to_favorites_item, !isFavorite); mi.setItemVisibility(R.id.remove_from_favorites_item, isFavorite); @@ -144,9 +142,8 @@ public class FeedItemMenuHandler { FeedItem selectedItem, boolean showExtendedMenu, LongList queueAccess, - LongList favorites, int... excludeIds) { - boolean rc = onPrepareMenu(mi, selectedItem, showExtendedMenu, queueAccess, favorites); + boolean rc = onPrepareMenu(mi, selectedItem, showExtendedMenu, queueAccess); if (rc && excludeIds != null) { for (int id : excludeIds) { mi.setItemVisibility(id, false); |