feeditem context menu refactor - removed unused showExtendedMenu parameter

This commit is contained in:
orionlee 2019-09-23 04:02:24 -07:00
parent 931c670398
commit 6c05a8c730
5 changed files with 9 additions and 14 deletions

View File

@ -277,7 +277,7 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
item1.setVisible(visible);
}
};
FeedItemMenuHandler.onPrepareMenu(contextMenuInterface, item, true);
FeedItemMenuHandler.onPrepareMenu(contextMenuInterface, item);
}
}

View File

@ -185,7 +185,7 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
}
};
FeedItemMenuHandler.onPrepareMenu(contextMenuInterface, item, true,
FeedItemMenuHandler.onPrepareMenu(contextMenuInterface, item,
R.id.skip_episode_item); // Skip Episode is not useful in Queue, so hide it.
// Queue-specific menu preparation
final boolean keepSorted = UserPreferences.isQueueKeepSorted();

View File

@ -323,7 +323,7 @@ public class FeedItemlistFragment extends ListFragment {
contextMenu = menu;
lastMenuInfo = (AdapterView.AdapterContextMenuInfo) menuInfo;
FeedItemMenuHandler.onPrepareMenu(contextMenuInterface, item, true);
FeedItemMenuHandler.onPrepareMenu(contextMenuInterface, item);
}
@Override

View File

@ -335,10 +335,10 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
inflater.inflate(R.menu.feeditem_options, menu);
popupMenu = menu;
if (item.hasMedia()) {
FeedItemMenuHandler.onPrepareMenu(popupMenuInterface, item, true);
FeedItemMenuHandler.onPrepareMenu(popupMenuInterface, item);
} else {
// these are already available via button1 and button2
FeedItemMenuHandler.onPrepareMenu(popupMenuInterface, item, true,
FeedItemMenuHandler.onPrepareMenu(popupMenuInterface, item,
R.id.mark_read_item, R.id.visit_website_item);
}
}

View File

@ -53,14 +53,10 @@ public class FeedItemMenuHandler {
* @param mi An instance of MenuInterface that the method uses to change a
* MenuItem's visibility
* @param selectedItem The FeedItem for which the menu is supposed to be prepared
* @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.
* @return Returns true if selectedItem is not null.
*/
public static boolean onPrepareMenu(MenuInterface mi,
FeedItem selectedItem,
boolean showExtendedMenu) {
FeedItem selectedItem) {
if (selectedItem == null) {
return false;
}
@ -79,12 +75,12 @@ public class FeedItemMenuHandler {
mi.setItemVisibility(R.id.add_to_queue_item, false);
}
if (!showExtendedMenu || !ShareUtils.hasLinkToShare(selectedItem)) {
if (!ShareUtils.hasLinkToShare(selectedItem)) {
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) {
if (!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);
}
@ -134,9 +130,8 @@ public class FeedItemMenuHandler {
*/
public static boolean onPrepareMenu(MenuInterface mi,
FeedItem selectedItem,
boolean showExtendedMenu,
int... excludeIds) {
boolean rc = onPrepareMenu(mi, selectedItem, showExtendedMenu);
boolean rc = onPrepareMenu(mi, selectedItem);
if (rc && excludeIds != null) {
for (int id : excludeIds) {
mi.setItemVisibility(id, false);