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,8 +63,17 @@ public class MainActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (!moveToState(State.ofLayer(state.layer - 1)))
|
TunnelListFragment fragment = null;
|
||||||
super.onBackPressed();
|
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
|
@Override
|
||||||
|
@ -193,6 +193,14 @@ public class TunnelListFragment extends BaseFragment {
|
|||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean collapseActionMenu() {
|
||||||
|
if (binding.createMenu.isExpanded()) {
|
||||||
|
binding.createMenu.collapse();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void onRequestCreateConfig(@SuppressWarnings("unused") final View view) {
|
public void onRequestCreateConfig(@SuppressWarnings("unused") final View view) {
|
||||||
startActivity(new Intent(getActivity(), TunnelCreatorActivity.class));
|
startActivity(new Intent(getActivity(), TunnelCreatorActivity.class));
|
||||||
if (binding != null)
|
if (binding != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user