diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-30 20:41:18 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-30 20:41:18 -0700 |
commit | 11f3c6e12cc742405708e32af28f8b981ff66c6d (patch) | |
tree | 10ec0d0aa117fdb1dc3726329f21454e900ce434 /subsonic-android/src | |
parent | dccaf6946a6e3bae15a612dcd6186bc19599f720 (diff) | |
download | dsub-11f3c6e12cc742405708e32af28f8b981ff66c6d.tar.gz dsub-11f3c6e12cc742405708e32af28f8b981ff66c6d.tar.bz2 dsub-11f3c6e12cc742405708e32af28f8b981ff66c6d.zip |
Fix Show Album not working
Diffstat (limited to 'subsonic-android/src')
3 files changed, 37 insertions, 3 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java index 44ee3b4b..9a118e32 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java @@ -21,7 +21,9 @@ import github.daneren2005.dsub.domain.PlayerState; import github.daneren2005.dsub.fragments.ChatFragment; import github.daneren2005.dsub.fragments.MainFragment; import github.daneren2005.dsub.fragments.SelectArtistFragment; +import github.daneren2005.dsub.fragments.SelectDirectoryFragment; import github.daneren2005.dsub.fragments.SelectPlaylistFragment; +import github.daneren2005.dsub.fragments.SubsonicFragment; import github.daneren2005.dsub.service.DownloadFile; import github.daneren2005.dsub.service.DownloadServiceImpl; import github.daneren2005.dsub.updates.Updater; @@ -191,6 +193,18 @@ public class MainActivity extends SubsonicActivity { }); } }; + + if(getIntent().hasExtra(Constants.INTENT_EXTRA_VIEW_ALBUM)) { + viewPager.setCurrentItem(1); + + SubsonicFragment fragment = new SelectDirectoryFragment(); + Bundle args = new Bundle(); + args.putString(Constants.INTENT_EXTRA_NAME_ID, getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_ID)); + args.putString(Constants.INTENT_EXTRA_NAME_NAME, getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_NAME)); + fragment.setArguments(args); + + pagerAdapter.queueFragment(fragment, R.id.select_artist_layout); + } executorService = Executors.newSingleThreadScheduledExecutor(); executorService.scheduleWithFixedDelay(runnable, 0L, 1000L, TimeUnit.MILLISECONDS); diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 80f4ffc0..2a06b5c6 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -392,6 +392,7 @@ public class SubsonicActivity extends SherlockFragmentActivity implements OnItem private SubsonicFragment currentFragment;
private List<TabInfo> tabs = new ArrayList<TabInfo>();
private List<List<SubsonicFragment>> frags = new ArrayList<List<SubsonicFragment>>();
+ private List<QueuedFragment> queue = new ArrayList<QueuedFragment>();
private int currentPosition;
public TabPagerAdapter(SherlockFragmentActivity activity, ViewPager pager) {
@@ -431,6 +432,13 @@ public class SubsonicActivity extends SherlockFragmentActivity implements OnItem public void onCreateOptionsMenu(Menu menu, com.actionbarsherlock.view.MenuInflater menuInflater) {
if(currentFragment != null) {
currentFragment.onCreateOptionsMenu(menu, menuInflater);
+
+ for(QueuedFragment addFragment: queue) {
+ replaceFragment(addFragment.fragment, addFragment.id, currentFragment.getSupportTag());
+ currentFragment = addFragment.fragment;
+ }
+ currentFragment.setPrimaryFragment(true);
+ queue.clear();
}
}
public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
@@ -489,7 +497,12 @@ public class SubsonicActivity extends SherlockFragmentActivity implements OnItem actionBar.addTab(tab);
notifyDataSetChanged();
}
-
+ public void queueFragment(SubsonicFragment fragment, int id) {
+ QueuedFragment frag = new QueuedFragment();
+ frag.fragment = fragment;
+ frag.id = id;
+ queue.add(frag);
+ }
public void replaceCurrent(SubsonicFragment fragment, int id, int tag) {
if(currentFragment != null) {
currentFragment.setPrimaryFragment(false);
@@ -612,5 +625,9 @@ public class SubsonicActivity extends SherlockFragmentActivity implements OnItem this.args = args;
}
}
+ private class QueuedFragment {
+ public SubsonicFragment fragment;
+ public int id;
+ }
}
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java index e734fedf..9ccc136f 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/DownloadFragment.java @@ -58,6 +58,7 @@ import java.util.ArrayList; import java.util.concurrent.ScheduledFuture;
import com.mobeta.android.dslv.*;
import github.daneren2005.dsub.activity.EqualizerActivity;
+import github.daneren2005.dsub.activity.MainActivity;
import github.daneren2005.dsub.activity.SubsonicActivity;
public class DownloadFragment extends SubsonicFragment implements OnGestureListener {
@@ -518,10 +519,12 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe private boolean menuItemSelected(int menuItemId, final DownloadFile song) {
switch (menuItemId) {
case R.id.menu_show_album:
- /*Intent intent = new Intent(context, SelectAlbumActivity.class);
+ Intent intent = new Intent(context, MainActivity.class);
+ intent.putExtra(Constants.INTENT_EXTRA_VIEW_ALBUM, true);
intent.putExtra(Constants.INTENT_EXTRA_NAME_ID, song.getSong().getParent());
intent.putExtra(Constants.INTENT_EXTRA_NAME_NAME, song.getSong().getAlbum());
- Util.startActivityWithoutTransition(context, intent);*/
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ Util.startActivityWithoutTransition(context, intent);
return true;
case R.id.menu_lyrics:
SubsonicFragment fragment = new LyricsFragment();
|