implement 'more from folder'
This commit is contained in:
1 parent
306e15e0c5
commit
55a5ff6aa0
4 files changed
+26
-6
No files matched your search
@@ -312,9 +312,10 @@ public class FullPlaybackActivity extends SlidingPlaybackActivity
|
||||
enqueueMenu.add(0, MENU_ENQUEUE_GENRE, 30, R.string.genre);
|
||||
|
||||
// Subitems of 'more from...'
|
||||
moreMenu.add(0, MENU_MORE_ALBUM, 30, R.string._album);
|
||||
moreMenu.add(0, MENU_MORE_ARTIST, 30, R.string._artist);
|
||||
moreMenu.add(0, MENU_MORE_GENRE, 30, R.string._genre);
|
||||
moreMenu.add(0, MENU_MORE_ALBUM, 30, R.string.album);
|
||||
moreMenu.add(0, MENU_MORE_ARTIST, 30, R.string.artist);
|
||||
moreMenu.add(0, MENU_MORE_GENRE, 30, R.string.genre);
|
||||
moreMenu.add(0, MENU_MORE_FOLDER, 30, R.string.folder);
|
||||
|
||||
// ensure that mFavorites is updated
|
||||
mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO);
|
||||
@@ -339,6 +340,9 @@ public class FullPlaybackActivity extends SlidingPlaybackActivity
|
||||
case MENU_MORE_GENRE:
|
||||
openLibrary(song, MediaUtils.TYPE_GENRE);
|
||||
break;
|
||||
case MENU_MORE_FOLDER:
|
||||
openLibrary(song, MediaUtils.TYPE_FILE);
|
||||
break;
|
||||
case MENU_ENQUEUE_ALBUM:
|
||||
PlaybackService.get(this).enqueueFromSong(song, MediaUtils.TYPE_ALBUM);
|
||||
break;
|
||||
|
||||
@@ -235,12 +235,21 @@ public class LibraryActivity
|
||||
*/
|
||||
private void loadLimiterIntent(Intent intent)
|
||||
{
|
||||
Limiter limiter = null;
|
||||
|
||||
int type = intent.getIntExtra("type", -1);
|
||||
long id = intent.getLongExtra("id", -1);
|
||||
if (type != -1 && id != -1) {
|
||||
String folder = intent.getStringExtra("folder");
|
||||
|
||||
if (type == MediaUtils.TYPE_FILE && folder != null) {
|
||||
limiter = FileSystemAdapter.buildLimiter(new File(folder));
|
||||
} else if (type != -1 && id != -1) {
|
||||
MediaAdapter adapter = new MediaAdapter(this, type, null, null);
|
||||
adapter.commitQuery(adapter.query());
|
||||
Limiter limiter = adapter.buildLimiter(id);
|
||||
limiter = adapter.buildLimiter(id);
|
||||
}
|
||||
|
||||
if (limiter != null) {
|
||||
int tab = mPagerAdapter.setLimiter(limiter);
|
||||
if (tab == -1 || tab == mViewPager.getCurrentItem())
|
||||
updateLimiterViews();
|
||||
|
||||
@@ -609,7 +609,7 @@ public class LibraryPagerAdapter
|
||||
mLists[MediaUtils.TYPE_FILE].setSelection(0);
|
||||
requestRequery(mFilesAdapter);
|
||||
}
|
||||
tab = -1;
|
||||
tab = getMediaTypePosition(MediaUtils.TYPE_FILE);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported limiter type: " + limiter.type);
|
||||
|
||||
@@ -413,6 +413,7 @@ public abstract class PlaybackActivity extends Activity
|
||||
static final int MENU_MORE_ALBUM = 22;
|
||||
static final int MENU_MORE_ARTIST = 23;
|
||||
static final int MENU_MORE_GENRE = 24;
|
||||
static final int MENU_MORE_FOLDER = 25;
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
@@ -645,6 +646,7 @@ public abstract class PlaybackActivity extends Activity
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
if (song != null) {
|
||||
long id = -1;
|
||||
String folder = null;
|
||||
switch(type) {
|
||||
case MediaUtils.TYPE_ARTIST:
|
||||
id = song.artistId;
|
||||
@@ -655,11 +657,16 @@ public abstract class PlaybackActivity extends Activity
|
||||
case MediaUtils.TYPE_GENRE:
|
||||
id = MediaUtils.queryGenreForSong(this, song.id);
|
||||
break;
|
||||
case MediaUtils.TYPE_FILE:
|
||||
File file = new File(song.path);
|
||||
folder = file.getParent();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid media type " + type);
|
||||
}
|
||||
intent.putExtra("type", type);
|
||||
intent.putExtra("id", id);
|
||||
intent.putExtra("folder", folder);
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user