summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android/activity/MainActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com/wireguard/android/activity/MainActivity.java')
-rw-r--r--app/src/main/java/com/wireguard/android/activity/MainActivity.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/src/main/java/com/wireguard/android/activity/MainActivity.java b/app/src/main/java/com/wireguard/android/activity/MainActivity.java
index c43c0023..bfb3be7e 100644
--- a/app/src/main/java/com/wireguard/android/activity/MainActivity.java
+++ b/app/src/main/java/com/wireguard/android/activity/MainActivity.java
@@ -63,8 +63,17 @@ public class MainActivity extends BaseActivity {
@Override
public void onBackPressed() {
- if (!moveToState(State.ofLayer(state.layer - 1)))
- super.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