OSDN Git Service

Don't show menu in oneshot mode, since it's not useful and may confuse other parts...
authorMarco Nelissen <marcone@google.com>
Wed, 13 May 2009 22:31:23 +0000 (15:31 -0700)
committerMarco Nelissen <marcone@google.com>
Wed, 13 May 2009 23:02:47 +0000 (16:02 -0700)
src/com/android/music/MediaPlaybackActivity.java

index 7d50084..1144e94 100644 (file)
@@ -493,20 +493,21 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         super.onCreateOptionsMenu(menu);
-        // Don't show the menu items if we got launched by path/filedescriptor, since
-        // those tend to not be in the media database.
-        if (MusicUtils.getCurrentAudioId() >= 0) {
-            if (!mOneShot) {
-                menu.add(0, GOTO_START, 0, R.string.goto_start).setIcon(R.drawable.ic_menu_music_library);
-                menu.add(0, PARTY_SHUFFLE, 0, R.string.party_shuffle); // icon will be set in onPrepareOptionsMenu()
-            }
+        // Don't show the menu items if we got launched by path/filedescriptor, or
+        // if we're in one shot mode. In most cases, these menu items are not
+        // useful in those modes, so for consistency we never show them in these
+        // modes, instead of tailoring them to the specific file being played.
+        if (MusicUtils.getCurrentAudioId() >= 0 && !mOneShot) {
+            menu.add(0, GOTO_START, 0, R.string.goto_start).setIcon(R.drawable.ic_menu_music_library);
+            menu.add(0, PARTY_SHUFFLE, 0, R.string.party_shuffle); // icon will be set in onPrepareOptionsMenu()
             SubMenu sub = menu.addSubMenu(0, ADD_TO_PLAYLIST, 0,
                     R.string.add_to_playlist).setIcon(android.R.drawable.ic_menu_add);
             MusicUtils.makePlaylistMenu(this, sub);
             menu.add(0, USE_AS_RINGTONE, 0, R.string.ringtone_menu_short).setIcon(R.drawable.ic_menu_set_as_ringtone);
             menu.add(0, DELETE_ITEM, 0, R.string.delete_item).setIcon(R.drawable.ic_menu_delete);
+            return true;
         }
-        return true;
+        return false;
     }
 
     @Override