wg: Collapse fab when pressing back before exiting
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
f1fa46829d
commit
f9d68185e2
@ -63,9 +63,18 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
TunnelListFragment fragment = null;
|
||||
try {
|
||||
fragment =
|
||||
((TunnelListFragment)
|
||||
getSupportFragmentManager().getFragments().get(0));
|
||||
} catch (ClassCastException ignored) {
|
||||
}
|
||||
if (fragment == null || !(fragment.collapseActionMenu())) {
|
||||
if (!moveToState(State.ofLayer(state.layer - 1)))
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
|
@ -193,6 +193,14 @@ public class TunnelListFragment extends BaseFragment {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
public boolean collapseActionMenu() {
|
||||
if (binding.createMenu.isExpanded()) {
|
||||
binding.createMenu.collapse();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onRequestCreateConfig(@SuppressWarnings("unused") final View view) {
|
||||
startActivity(new Intent(getActivity(), TunnelCreatorActivity.class));
|
||||
if (binding != null)
|
||||
|
Loading…
Reference in New Issue
Block a user