private void doToggleActionBar() { ActionBarCompat bar = mActionBar; if (bar == null) { return; } if (bar.isShowing()) { bar.hide(); } else { bar.show(); } }
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: if (AndroidCompat.SDK < 5) { if (!mBackKeyPressed) { /* This key up event might correspond to a key down delivered to another activity -- ignore */ return false; } mBackKeyPressed = false; } if (mActionBarMode == TermSettings.ACTION_BAR_MODE_HIDES && mActionBar.isShowing()) { mActionBar.hide(); return true; } switch (mSettings.getBackKeyAction()) { case TermSettings.BACK_KEY_STOPS_SERVICE: mStopServiceOnFinish = true; case TermSettings.BACK_KEY_CLOSES_ACTIVITY: finish(); return true; case TermSettings.BACK_KEY_CLOSES_WINDOW: doCloseWindow(); return true; default: return false; } case KeyEvent.KEYCODE_MENU: if (mActionBar != null && !mActionBar.isShowing()) { mActionBar.show(); return true; } else { return super.onKeyUp(keyCode, event); } default: return super.onKeyUp(keyCode, event); } }