summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java
diff options
context:
space:
mode:
authorHarsh Shandilya <harsh@prjkt.io>2018-06-05 18:33:09 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-05 15:22:40 +0200
commit74d79ba8e9f28aab58bf47c1e6f297fc01bb59fe (patch)
tree90a2929a7af9dc9e6afc4bcef49c2b94b117b00f /app/src/main/java
parente2e7b7d023225a57cd7052fb4697ce8c3d281925 (diff)
MainActivity: collapse action menu on toolbar touch
Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/wireguard/android/activity/MainActivity.java9
1 files changed, 9 insertions, 0 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 2ed1da61..e60fa8cf 100644
--- a/app/src/main/java/com/wireguard/android/activity/MainActivity.java
+++ b/app/src/main/java/com/wireguard/android/activity/MainActivity.java
@@ -95,6 +95,15 @@ public class MainActivity extends BaseActivity {
moveToState(initialState);
}
updateActionBar();
+ final int actionBarId = getResources().getIdentifier("action_bar", "id", getPackageName());
+ if (actionBarId != 0 && findViewById(actionBarId) != null) {
+ findViewById(actionBarId).setOnTouchListener((v, e) -> {
+ try {
+ ((TunnelListFragment) getSupportFragmentManager().getFragments().get(0)).collapseActionMenu();
+ } catch (final ClassCastException ignored) { }
+ return false;
+ });
+ }
}
@Override