MainActivity: collapse action menu on toolbar touch

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2018-06-05 18:33:09 +05:30 committed by Jason A. Donenfeld
parent a17ec6b1f7
commit 3c3de065c6

View File

@ -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