aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java59
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java1
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/LyricsFragment.java1
3 files changed, 54 insertions, 7 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 276a89d0..f0685a5f 100644
--- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -92,6 +92,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
private SlidingUpPanelLayout slideUpPanel;
private SlidingUpPanelLayout.PanelSlideListener panelSlideListener;
private NowPlayingFragment nowPlayingFragment;
+ private SubsonicFragment secondaryFragment;
private Toolbar mainToolbar;
private Toolbar nowPlayingToolbar;
@@ -484,7 +485,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
@Override
public void onBackPressed() {
- if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
+ if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED && secondaryFragment == null) {
slideUpPanel.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
} else if(onBackPressedSupport()) {
if(!Util.disableExitPrompt(this) && lastBackPressTime < (System.currentTimeMillis() - 4000)) {
@@ -497,6 +498,16 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
}
@Override
+ public boolean onBackPressedSupport() {
+ if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
+ removeCurrent();
+ return false;
+ } else {
+ return super.onBackPressedSupport();
+ }
+ }
+
+ @Override
protected SubsonicFragment getCurrentFragment() {
if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
return nowPlayingFragment;
@@ -507,16 +518,50 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
@Override
public void replaceFragment(SubsonicFragment fragment, int tag, boolean replaceCurrent) {
- super.replaceFragment(fragment, tag, replaceCurrent);
- if(drawerToggle != null) {
- drawerToggle.setDrawerIndicatorEnabled(false);
+ if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
+ secondaryFragment = fragment;
+ nowPlayingFragment.setPrimaryFragment(false);
+ secondaryFragment.setPrimaryFragment(true);
+ supportInvalidateOptionsMenu();
+
+ FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
+ trans.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right);
+ trans.hide(nowPlayingFragment);
+ trans.add(R.id.now_playing_fragment_container, secondaryFragment, tag + "");
+ trans.commit();
+ } else {
+ super.replaceFragment(fragment, tag, replaceCurrent);
+ if (drawerToggle != null) {
+ drawerToggle.setDrawerIndicatorEnabled(false);
+ }
}
}
@Override
public void removeCurrent() {
- super.removeCurrent();
- if(drawerToggle != null && backStack.isEmpty()) {
- drawerToggle.setDrawerIndicatorEnabled(true);
+ if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED && secondaryFragment != null) {
+ FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
+ trans.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left);
+ trans.remove(secondaryFragment);
+ trans.show(nowPlayingFragment);
+ trans.commit();
+
+ secondaryFragment = null;
+ nowPlayingFragment.setPrimaryFragment(true);
+ supportInvalidateOptionsMenu();
+ } else {
+ super.removeCurrent();
+ if (drawerToggle != null && backStack.isEmpty()) {
+ drawerToggle.setDrawerIndicatorEnabled(true);
+ }
+ }
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
+ getSupportActionBar().setTitle(title);
+ } else {
+ super.setTitle(title);
}
}
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java
index ea61f2c7..e2535e04 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/EqualizerFragment.java
@@ -104,6 +104,7 @@ public class EqualizerFragment extends SubsonicFragment {
});
setTitle(R.string.equalizer_label);
+ setSubtitle(null);
return rootView;
}
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/LyricsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/LyricsFragment.java
index 826029f5..402bd257 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/LyricsFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/LyricsFragment.java
@@ -62,6 +62,7 @@ public final class LyricsFragment extends SubsonicFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
setTitle(R.string.download_menu_lyrics);
+ setSubtitle(null);
rootView = inflater.inflate(R.layout.lyrics, container, false);
artistView = (TextView) rootView.findViewById(R.id.lyrics_artist);
titleView = (TextView) rootView.findViewById(R.id.lyrics_title);