mirror of
https://gitea.mayex.net/mayekkuzu/Audinaut.git
synced 2025-01-23 18:14: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();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean onBackPressedSupport() {
|
|
||||||
if (drawerOpen) {
|
|
||||||
drawer.closeDrawers();
|
|
||||||
return false;
|
|
||||||
} else if (backStack.size() > 0) {
|
|
||||||
removeCurrent();
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (onBackPressedSupport()) {
|
if (drawerOpen) {
|
||||||
|
drawer.closeDrawers();
|
||||||
|
} else if (backStack.size() > 0) {
|
||||||
|
removeCurrent();
|
||||||
|
} else {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,18 +421,10 @@ public class SubsonicFragmentActivity extends SubsonicActivity implements Downlo
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED && secondaryFragment == null) {
|
if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED && secondaryFragment == null) {
|
||||||
slideUpPanel.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
slideUpPanel.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||||
} else if (onBackPressedSupport()) {
|
} else if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
boolean onBackPressedSupport() {
|
|
||||||
if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
|
||||||
removeCurrent();
|
removeCurrent();
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
return super.onBackPressedSupport();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user