summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2018-06-05 18:33:09 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-05 15:22:40 +0200
commit3c3de065c61d5f846da76394ebda0e9cd06fd88a (patch)
tree90a2929a7af9dc9e6afc4bcef49c2b94b117b00f
parenta17ec6b1f755ad2bbe733393bba340ef474deeae (diff)
MainActivity: collapse action menu on toolbar touch
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
-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