/**
* Several of the context menu items used in Apollo are reused. This class helps
- * keep things tidy.
- *
- * @author Andrew Neal (andrewdneal@gmail.com)
+ * keep things tidy. The integer values of the items are used both as the menu IDs
+ * _and_ to determine the sort order of the items.
*/
-public class FragmentMenuItems {
-
- /* Removes a single album from the recents pages */
- public static final int REMOVE_FROM_RECENT = 0;
-
- /* Used to play the selected artist, album, song, playlist, or genre */
- public static final int PLAY_SELECTION = 1;
-
- /* Used to add to the qeueue */
- public static final int ADD_TO_QUEUE = 2;
-
- /* Used to add to a playlist */
- public static final int ADD_TO_PLAYLIST = 3;
-
- /* Used to create a new playlist */
- public static final int NEW_PLAYLIST = 5;
-
- /* Used to rename a playlist */
- public static final int RENAME_PLAYLIST = 6;
-
- /* Used to add to a current playlist */
- public static final int PLAYLIST_SELECTED = 7;
-
- /* Used to show more content by an artist */
- public static final int MORE_BY_ARTIST = 8;
-
- /* Used to delete track(s) */
- public static final int DELETE = 9;
-
- /* Used to fetch an artist image */
- public static final int FETCH_ARTIST_IMAGE = 10;
-
- /* Used to fetch album art */
- public static final int FETCH_ALBUM_ART = 11;
-
- /* Used to set a track as a ringtone */
- public static final int USE_AS_RINGTONE = 12;
-
- /* Used to remove a track from a playlist */
- public static final int REMOVE_FROM_PLAYLIST = 14;
-
- /* Used to remove a track from the queue */
- public static final int REMOVE_FROM_QUEUE = 15;
-
- /* Used to queue a track to be played next */
- public static final int PLAY_NEXT = 16;
-
-}
+public interface FragmentMenuItems {
+ int PLAY_SELECTION = 10; // play the selected song, album, etc.
+ int PLAY_NEXT = 20; // queue a track to be played next
+ // SHUFFLE = 30 // defined in res/menu
+ int ADD_TO_QUEUE = 40; // add to end of current queue
+ int ADD_TO_PLAYLIST = 50; // append to a playlist
+ int REMOVE_FROM_QUEUE = 60; // remove track from play queue
+ int REMOVE_FROM_PLAYLIST= 70; // remove track from playlist
+ int REMOVE_FROM_RECENT = 80; // remove track from recently played list
+ int RENAME_PLAYLIST = 90; // change name of playlist
+ int MORE_BY_ARTIST = 100; // jump to artist detail page
+ int USE_AS_RINGTONE = 110; // set track as ringtone
+ int DELETE = 120; // delete track from device
+ int NEW_PLAYLIST = 130; // create new playlist - also in res/menu!
+ int PLAYLIST_SELECTED = 140; // this is used for existing playlists
+
+ // not currently in use
+ int FETCH_ARTIST_IMAGE = 200;
+ int FETCH_ALBUM_ART = 210;
+}
\ No newline at end of file
return null;
}
- // FIXME: after merging http://gerrit.cyngn.com/#/c/4056/ remove this
- // method and change the FragmentMenuItem IDs to so they can also double
- // as the order values - changing addToMenu below as well
- private int getMenuItemOrder(int menuId) {
- switch(menuId) {
- case FragmentMenuItems.PLAY_SELECTION: return 10;
- case FragmentMenuItems.PLAY_NEXT: return 20;
- // order 30 is reserved for SHUFFLE items
- case FragmentMenuItems.ADD_TO_QUEUE: return 40;
- case FragmentMenuItems.ADD_TO_PLAYLIST: return 50;
- case FragmentMenuItems.REMOVE_FROM_QUEUE: return 60;
- case FragmentMenuItems.RENAME_PLAYLIST: return 70;
- case FragmentMenuItems.MORE_BY_ARTIST: return 80;
- case FragmentMenuItems.USE_AS_RINGTONE: return 90;
- case FragmentMenuItems.DELETE: return 100;
- default: return 110;
- }
- }
-
/**
* Allows containing classes to add/remove ids to the menu
* @param type the pop up menu type
* Simple helper function for adding an item to the menu
*/
public void addToMenu(final Menu menu, final int id, final int resourceId) {
- menu.add(getGroupId(), id, getMenuItemOrder(id), mActivity.getString(resourceId));
+ menu.add(getGroupId(), id, id /*as order*/, mActivity.getString(resourceId));
}
@Override