diff options
author | daneren2005 <daneren2005@gmail.com> | 2013-11-19 16:53:24 -0800 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2013-11-19 16:53:24 -0800 |
commit | 89e930d24fd4303058c680b1fb45098644b086ff (patch) | |
tree | 131a544e4f069f27594ce97a858babab12cfd876 | |
parent | 9ce8bec68250da576f7e122808d2eaa139162bef (diff) | |
download | dsub-89e930d24fd4303058c680b1fb45098644b086ff.tar.gz dsub-89e930d24fd4303058c680b1fb45098644b086ff.tar.bz2 dsub-89e930d24fd4303058c680b1fb45098644b086ff.zip |
#164 Started adding support for autoplaying albums/artists
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SearchFragment.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SearchFragment.java b/src/github/daneren2005/dsub/fragments/SearchFragment.java index 900872da..81d2f29f 100644 --- a/src/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/src/github/daneren2005/dsub/fragments/SearchFragment.java @@ -108,7 +108,7 @@ public class SearchFragment extends SubsonicFragment { } else {
Object item = parent.getItemAtPosition(position);
if (item instanceof Artist) {
- onArtistSelected((Artist) item);
+ onArtistSelected((Artist) item, false);
} else if (item instanceof MusicDirectory.Entry) {
MusicDirectory.Entry entry = (MusicDirectory.Entry) item;
if (entry.isDirectory()) {
@@ -208,7 +208,7 @@ public class SearchFragment extends SubsonicFragment { searchResult = result;
populateList();
if (autoplay) {
- autoplay();
+ autoplay(query);
}
}
@@ -289,11 +289,14 @@ public class SearchFragment extends SubsonicFragment { mergeAdapter.notifyDataSetChanged();
}
- private void onArtistSelected(Artist artist) {
+ private void onArtistSelected(Artist artist, boolean autoplay) {
SubsonicFragment fragment = new SelectDirectoryFragment();
Bundle args = new Bundle();
args.putString(Constants.INTENT_EXTRA_NAME_ID, artist.getId());
args.putString(Constants.INTENT_EXTRA_NAME_NAME, artist.getName());
+ if(autoplay) {
+ args.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true);
+ }
fragment.setArguments(args);
replaceFragment(fragment, R.id.fragment_list_layout);
@@ -317,6 +320,9 @@ public class SearchFragment extends SubsonicFragment { args = new Bundle();
args.putString(Constants.INTENT_EXTRA_NAME_ID, album.getId());
args.putString(Constants.INTENT_EXTRA_NAME_NAME, album.getTitle());
+ if(autoplay) {
+ args.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true);
+ }
fragment.setArguments(args);
replaceFragment(fragment, id);
@@ -345,7 +351,7 @@ public class SearchFragment extends SubsonicFragment { startActivity(intent);
}
- private void autoplay() {
+ private void autoplay(String query) {
if (!searchResult.getSongs().isEmpty()) {
onSongSelected(searchResult.getSongs().get(0), false, false, true, false);
} else if (!searchResult.getAlbums().isEmpty()) {
|