OSDN Git Service

Music app unbundling prep: add SortCursor to the music app, make
[android-x86/packages-apps-Music.git] / src / com / android / music / MediaPlaybackActivity.java
index 69803be..baf1442 100644 (file)
@@ -30,18 +30,16 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.ServiceConnection;
 import android.content.res.Configuration;
-import android.content.res.Resources;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.media.AudioManager;
-import android.media.MediaFile;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.RemoteException;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
+import android.os.RemoteException;
 import android.os.SystemClock;
 import android.provider.MediaStore;
 import android.text.Layout;
@@ -55,7 +53,6 @@ import android.view.SubMenu;
 import android.view.View;
 import android.view.ViewConfiguration;
 import android.view.Window;
-import android.view.WindowManager;
 import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.ProgressBar;
@@ -102,7 +99,6 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
         mAlbumArtHandler = new AlbumArtHandler(mAlbumArtWorker.getLooper());
 
         requestWindowFeature(Window.FEATURE_NO_TITLE);
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
         setContentView(R.layout.audio_player);
 
         mCurrentTime = (TextView) findViewById(R.id.currenttime);
@@ -288,8 +284,8 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
             return true;
         }
 
-        if (MediaFile.UNKNOWN_STRING.equals(album) &&
-                MediaFile.UNKNOWN_STRING.equals(artist) &&
+        if (MediaStore.UNKNOWN_STRING.equals(album) &&
+                MediaStore.UNKNOWN_STRING.equals(artist) &&
                 song != null &&
                 song.startsWith("recording")) {
             // not music
@@ -315,10 +311,10 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
         }
 
         boolean knownartist =
-            (artist != null) && !MediaFile.UNKNOWN_STRING.equals(artist);
+            (artist != null) && !MediaStore.UNKNOWN_STRING.equals(artist);
 
         boolean knownalbum =
-            (album != null) && !MediaFile.UNKNOWN_STRING.equals(album);
+            (album != null) && !MediaStore.UNKNOWN_STRING.equals(album);
         
         if (knownartist && view.equals(mArtistName.getParent())) {
             title = artist;
@@ -333,7 +329,7 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
             }
             mime = MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE;
         } else if (view.equals(mTrackName.getParent()) || !knownartist || !knownalbum) {
-            if ((song == null) || MediaFile.UNKNOWN_STRING.equals(song)) {
+            if ((song == null) || MediaStore.UNKNOWN_STRING.equals(song)) {
                 // A popup of the form "Search for null/'' using ..." is pretty
                 // unhelpful, plus, we won't find any way to buy it anyway.
                 return true;
@@ -584,9 +580,8 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
                 case GOTO_START:
                     intent = new Intent();
                     intent.setClass(this, MusicBrowserActivity.class);
-                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
-                            | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                     startActivity(intent);
+                    finish();
                     break;
                 case USE_AS_RINGTONE: {
                     // Set the system setting to make this the current ringtone
@@ -596,14 +591,7 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
                     return true;
                 }
                 case PARTY_SHUFFLE:
-                    if (mService != null) {
-                        int shuffle = mService.getShuffleMode();
-                        if (shuffle == MediaPlaybackService.SHUFFLE_AUTO) {
-                            mService.setShuffleMode(MediaPlaybackService.SHUFFLE_NONE);
-                        } else {
-                            mService.setShuffleMode(MediaPlaybackService.SHUFFLE_AUTO);
-                        }
-                    }
+                    MusicUtils.togglePartyShuffle();
                     setShuffleButtonImage();
                     break;
                     
@@ -1302,13 +1290,13 @@ public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs,
                 ((View) mArtistName.getParent()).setVisibility(View.VISIBLE);
                 ((View) mAlbumName.getParent()).setVisibility(View.VISIBLE);
                 String artistName = mService.getArtistName();
-                if (MediaFile.UNKNOWN_STRING.equals(artistName)) {
+                if (MediaStore.UNKNOWN_STRING.equals(artistName)) {
                     artistName = getString(R.string.unknown_artist_name);
                 }
                 mArtistName.setText(artistName);
                 String albumName = mService.getAlbumName();
                 long albumid = mService.getAlbumId();
-                if (MediaFile.UNKNOWN_STRING.equals(albumName)) {
+                if (MediaStore.UNKNOWN_STRING.equals(albumName)) {
                     albumName = getString(R.string.unknown_album_name);
                     albumid = -1;
                 }