mirror of
https://gitea.mayex.net/mayekkuzu/Audinaut.git
synced 2025-01-23 12:44:54 +03:00
Consolidate onBackPressed logic
This commit is contained in:
parent
0a1cc75cc4
commit
8222a3f449
@ -533,21 +533,13 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte
|
||||
finish();
|
||||
}
|
||||
|
||||
boolean onBackPressedSupport() {
|
||||
if (drawerOpen) {
|
||||
drawer.closeDrawers();
|
||||
return false;
|
||||
} else if (backStack.size() > 0) {
|
||||
removeCurrent();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (onBackPressedSupport()) {
|
||||
if (drawerOpen) {
|
||||
drawer.closeDrawers();
|
||||
} else if (backStack.size() > 0) {
|
||||
removeCurrent();
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
@ -421,18 +421,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
||||
public void onBackPressed() {
|
||||
if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED && secondaryFragment == null) {
|
||||
slideUpPanel.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
} else if (onBackPressedSupport()) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean onBackPressedSupport() {
|
||||
if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||
} else if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||
removeCurrent();
|
||||
return false;
|
||||
} else {
|
||||
return super.onBackPressedSupport();
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user