am 90e3176f: am 355e134c: New look for reordering lists. b/3198846

* commit '90e3176f6e7cb5b2a0bcf99ed0ca5e693bb28002':
  New look for reordering lists. b/3198846
diff --git a/res/layout-keysexposed/create_playlist.xml b/res/layout-keysexposed/create_playlist.xml
index ce25d4b..132210a 100644
--- a/res/layout-keysexposed/create_playlist.xml
+++ b/res/layout-keysexposed/create_playlist.xml
@@ -31,6 +31,7 @@
     <EditText android:id="@+id/playlist"
         android:layout_width="match_parent" android:layout_height="wrap_content"
         android:singleLine="true"
+        android:inputType="textCapSentences"
         android:layout_marginBottom="8dip"
         android:layout_marginLeft="8dip"
         android:layout_marginRight="8dip">
diff --git a/res/layout-keyshidden/create_playlist.xml b/res/layout-keyshidden/create_playlist.xml
index 6c8c8b6..04aefc9 100644
--- a/res/layout-keyshidden/create_playlist.xml
+++ b/res/layout-keyshidden/create_playlist.xml
@@ -43,6 +43,7 @@
     <EditText android:id="@+id/playlist"
         android:layout_width="match_parent" android:layout_height="wrap_content"
         android:singleLine="true"
+        android:inputType="textCapSentences"
         android:visibility="gone"
         android:layout_marginBottom="8dip">
         <requestFocus />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 869a248..4f77a0d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -73,17 +73,17 @@
     <!-- Delete confirmation dialog when deleting an entire artist -->
     <string name="delete_artist_desc">All songs by <xliff:g id="artist">%s</xliff:g> will be permanently deleted from the SD card.</string>
     <!-- Delete confirmation dialog when deleting an entire artist -->
-    <string name="delete_artist_desc_nosdcard" msgid="1843750591006508005">All songs by <xliff:g id="artist">%s</xliff:g> will be permanently deleted from USB storage.</string>
+    <string name="delete_artist_desc_nosdcard">All songs by <xliff:g id="artist">%s</xliff:g> will be permanently deleted from USB storage.</string>
 
     <!-- Delete confirmation dialog when deleting an entire album -->
     <string name="delete_album_desc">The entire album \"<xliff:g id="album">%s</xliff:g>\" will be permanently deleted from the SD card.</string>
     <!-- Delete confirmation dialog when deleting an entire album -->
-    <string name="delete_album_desc_nosdcard" msgid="535515999268177079">The entire album \"<xliff:g id="album">%s</xliff:g>\" will be permanently deleted from USB storage.</string>
+    <string name="delete_album_desc_nosdcard">The entire album \"<xliff:g id="album">%s</xliff:g>\" will be permanently deleted from USB storage.</string>
 
     <!-- Delete confirmation dialog when deleting a single song -->
     <string name="delete_song_desc">\"<xliff:g id="song">%s</xliff:g>\" will be permanently deleted from the SD card.</string>
     <!-- Delete confirmation dialog when deleting a single song -->
-    <string name="delete_song_desc_nosdcard" msgid="1856800468541831408">\"<xliff:g id="song">%s</xliff:g>\" will be permanently deleted from USB storage.</string>
+    <string name="delete_song_desc_nosdcard">\"<xliff:g id="song">%s</xliff:g>\" will be permanently deleted from USB storage.</string>
 
     <!-- Delete confirmation dialog, confirmation button text -->
     <string name="delete_confirm_button_text">OK</string>
@@ -98,7 +98,7 @@
     <!-- shown in dialog while the media scanner is starting up -->
     <string name="scanning">Scanning SD card\u2026</string>
     <!-- shown in dialog while the media scanner is starting up -->
-    <string name="scanning_nosdcard" msgid="3529383847223198502">Scanning USB storage\u2026</string>
+    <string name="scanning_nosdcard">Scanning USB storage\u2026</string>
 
     <!-- title of the "current playlist" screen when not in party shuffle mode -->
     <string name="nowplaying_title">Now playing</string>
@@ -153,27 +153,27 @@
     <!-- Title of screen when no sd card is present -->
     <string name="sdcard_missing_title">No SD card</string>
     <!-- Title of screen when no sd card is present -->
-    <string name="sdcard_missing_title_nosdcard" msgid="9008284946643270850">No USB storage</string>
+    <string name="sdcard_missing_title_nosdcard">No USB storage</string>
     <!-- label underneath icon used to indicate that no sd card is present -->
     <string name="sdcard_missing_message">Your phone does not have an SD card inserted.</string>
     <!-- label underneath icon used to indicate that no sd card is present -->
-    <string name="sdcard_missing_message_nosdcard" msgid="1169260755336159747">Your phone does not have USB storage.</string>
+    <string name="sdcard_missing_message_nosdcard">Your phone does not have USB storage.</string>
     <!-- label underneath icon used to indicate that the sd card is present, but currently unavailable -->
     <string name="sdcard_busy_title">SD card unavailable</string>
     <!-- label underneath icon used to indicate that the sd card is present, but currently unavailable -->
-    <string name="sdcard_busy_title_nosdcard" msgid="1162763571147174655">USB storage unavailable</string>
+    <string name="sdcard_busy_title_nosdcard">USB storage unavailable</string>
     <!-- label underneath icon used to indicate sd card is mounted to your computer via USB -->
     <string name="sdcard_busy_message">Sorry, your SD card is busy.</string>
     <!-- label underneath icon used to indicate sd card is mounted to your computer via USB -->
-    <string name="sdcard_busy_message_nosdcard" msgid="8071868348072728830">Sorry, your USB storage is busy.</string>
+    <string name="sdcard_busy_message_nosdcard">Sorry, your USB storage is busy.</string>
     <!-- Title of screen when there was an error accessing the sd card -->
     <string name="sdcard_error_title">SD card error</string>
     <!-- Title of screen when there was an error accessing the sd card -->
-    <string name="sdcard_error_title_nosdcard" msgid="165682155008600643">USB storage error</string>
+    <string name="sdcard_error_title_nosdcard">USB storage error</string>
     <!-- label underneath icon used to indicate there was an error accessing the sd card -->
     <string name="sdcard_error_message">An error was encountered on your SD card.</string>
     <!-- label underneath icon used to indicate there was an error accessing the sd card -->
-    <string name="sdcard_error_message_nosdcard" msgid="4574563894036627855">An error was encountered on your USB storage.</string>
+    <string name="sdcard_error_message_nosdcard">An error was encountered on your USB storage.</string>
     <!-- Default name of artist that doesn't have a name in the metadata -->
     <string name="unknown_artist_name">Unknown artist</string>
     <!-- Default name of album that doesn't have a name in the metadata -->
diff --git a/src/com/android/music/MediaButtonIntentReceiver.java b/src/com/android/music/MediaButtonIntentReceiver.java
index 6b5a9d8..86abb67 100644
--- a/src/com/android/music/MediaButtonIntentReceiver.java
+++ b/src/com/android/music/MediaButtonIntentReceiver.java
@@ -94,12 +94,19 @@
                 case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
                     command = MediaPlaybackService.CMDPREVIOUS;
                     break;
+                case KeyEvent.KEYCODE_MEDIA_PAUSE:
+                    command = MediaPlaybackService.CMDPAUSE;
+                    break;
+                case KeyEvent.KEYCODE_MEDIA_PLAY:
+                    command = MediaPlaybackService.CMDPLAY;
+                    break;
             }
 
             if (command != null) {
                 if (action == KeyEvent.ACTION_DOWN) {
                     if (mDown) {
-                        if (MediaPlaybackService.CMDTOGGLEPAUSE.equals(command)
+                        if ((MediaPlaybackService.CMDTOGGLEPAUSE.equals(command) ||
+                                MediaPlaybackService.CMDPLAY.equals(command))
                                 && mLastClickTime != 0 
                                 && eventtime - mLastClickTime > LONG_PRESS_DELAY) {
                             mHandler.sendMessage(
diff --git a/src/com/android/music/MediaPlaybackActivity.java b/src/com/android/music/MediaPlaybackActivity.java
index 1367c5a..2e82d63 100644
--- a/src/com/android/music/MediaPlaybackActivity.java
+++ b/src/com/android/music/MediaPlaybackActivity.java
@@ -1321,7 +1321,9 @@
                 Message numsg = mHandler.obtainMessage(ALBUM_ART_DECODED, null);
                 mHandler.removeMessages(ALBUM_ART_DECODED);
                 mHandler.sendMessageDelayed(numsg, 300);
-                Bitmap bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, albumid);
+                // Don't allow default artwork here, because we want to fall back to song-specific
+                // album art if we can't find anything for the album.
+                Bitmap bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, albumid, false);
                 if (bm == null) {
                     bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, -1);
                     albumid = -1;
diff --git a/src/com/android/music/MediaPlaybackService.java b/src/com/android/music/MediaPlaybackService.java
index 7c0bbed..e033b80 100644
--- a/src/com/android/music/MediaPlaybackService.java
+++ b/src/com/android/music/MediaPlaybackService.java
@@ -86,6 +86,7 @@
     public static final String CMDTOGGLEPAUSE = "togglepause";
     public static final String CMDSTOP = "stop";
     public static final String CMDPAUSE = "pause";
+    public static final String CMDPLAY = "play";
     public static final String CMDPREVIOUS = "previous";
     public static final String CMDNEXT = "next";
 
@@ -97,7 +98,9 @@
     private static final int TRACK_ENDED = 1;
     private static final int RELEASE_WAKELOCK = 2;
     private static final int SERVER_DIED = 3;
-    private static final int FADEIN = 4;
+    private static final int FADEINFROMSTART = 4;
+    private static final int FADEDOWN = 5;
+    private static final int FADEUP = 6;
     private static final int MAX_HISTORY_SIZE = 100;
     
     private MultiPlayer mPlayer;
@@ -151,7 +154,7 @@
     private static final int IDLE_DELAY = 60000;
     
     private void startAndFadeIn() {
-        mMediaplayerHandler.sendEmptyMessageDelayed(FADEIN, 10);
+        mMediaplayerHandler.sendEmptyMessageDelayed(FADEINFROMSTART, 10);
     }
     
     private Handler mMediaplayerHandler = new Handler() {
@@ -160,21 +163,31 @@
         public void handleMessage(Message msg) {
             MusicUtils.debugLog("mMediaplayerHandler.handleMessage " + msg.what);
             switch (msg.what) {
-                case FADEIN:
+                case FADEINFROMSTART:
                     if (!isPlaying()) {
                         mCurrentVolume = 0f;
                         mPlayer.setVolume(mCurrentVolume);
                         play();
-                        mMediaplayerHandler.sendEmptyMessageDelayed(FADEIN, 10);
-                    } else {
-                        mCurrentVolume += 0.01f;
-                        if (mCurrentVolume < 1.0f) {
-                            mMediaplayerHandler.sendEmptyMessageDelayed(FADEIN, 10);
-                        } else {
-                            mCurrentVolume = 1.0f;
-                        }
-                        mPlayer.setVolume(mCurrentVolume);
                     }
+                    mMediaplayerHandler.sendEmptyMessageDelayed(FADEUP, 10);
+                    break;
+                case FADEDOWN:
+                    mCurrentVolume -= .05f;
+                    if (mCurrentVolume > .2f) {
+                        mMediaplayerHandler.sendEmptyMessageDelayed(FADEDOWN, 10);
+                    } else {
+                        mCurrentVolume = .2f;
+                    }
+                    mPlayer.setVolume(mCurrentVolume);
+                    break;
+                case FADEUP:
+                    mCurrentVolume += .01f;
+                    if (mCurrentVolume < 1.0f) {
+                        mMediaplayerHandler.sendEmptyMessageDelayed(FADEUP, 10);
+                    } else {
+                        mCurrentVolume = 1.0f;
+                    }
+                    mPlayer.setVolume(mCurrentVolume);
                     break;
                 case SERVER_DIED:
                     if (mIsSupposedToBePlaying) {
@@ -224,6 +237,8 @@
             } else if (CMDPAUSE.equals(cmd) || PAUSE_ACTION.equals(action)) {
                 pause();
                 mPausedByTransientLossOfFocus = false;
+            } else if (CMDPLAY.equals(cmd)) {
+                play();
             } else if (CMDSTOP.equals(cmd)) {
                 pause();
                 mPausedByTransientLossOfFocus = false;
@@ -248,8 +263,10 @@
                         pause();
                     }
                     break;
-                case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
                 case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
+                    mMediaplayerHandler.sendEmptyMessage(FADEDOWN);
+                    break;
+                case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
                     Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT");
                     if(isPlaying()) {
                         mPausedByTransientLossOfFocus = true;
@@ -261,6 +278,8 @@
                     if(!isPlaying() && mPausedByTransientLossOfFocus) {
                         mPausedByTransientLossOfFocus = false;
                         startAndFadeIn();
+                    } else {
+                        mMediaplayerHandler.sendEmptyMessage(FADEUP);
                     }
                     break;
                 default:
diff --git a/src/com/android/music/SortCursor.java b/src/com/android/music/SortCursor.java
index 9b17294..7482a3f 100644
--- a/src/com/android/music/SortCursor.java
+++ b/src/com/android/music/SortCursor.java
@@ -218,6 +218,11 @@
     }
 
     @Override
+    public int getType(int column) {
+        return mCursor.getType(column);
+    }
+
+    @Override
     public boolean isNull(int column)
     {
         return mCursor.isNull(column);
diff --git a/src/com/android/music/TrackBrowserActivity.java b/src/com/android/music/TrackBrowserActivity.java
index 76a02de..196eb32 100644
--- a/src/com/android/music/TrackBrowserActivity.java
+++ b/src/com/android/music/TrackBrowserActivity.java
@@ -1287,6 +1287,11 @@
         }
 
         @Override
+        public int getType(int column) {
+            return mCurrentPlaylistCursor.getType(column);
+        }
+
+        @Override
         public boolean isNull(int column)
         {
             return mCurrentPlaylistCursor.isNull(column);