@Override public boolean onKeyUp(int keyCode, KeyEvent event) { // Push to talk hardware key if (settings.isPushToTalk() && keyCode == settings.getPushToTalkKey() && event.getAction() == KeyEvent.ACTION_UP) { setPushToTalk(false); return true; } return super.onKeyUp(keyCode, event); }
@Override public boolean onKeyDown(final int keyCode, final KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { final AlertDialog.Builder b = new AlertDialog.Builder(this); b.setTitle(R.string.disconnect); b.setMessage(R.string.disconnectSure); b.setPositiveButton(android.R.string.yes, onDisconnectConfirm); b.setNegativeButton(android.R.string.no, null); b.show(); return true; } // Push to talk hardware key if (settings.isPushToTalk() && keyCode == settings.getPushToTalkKey() && event.getAction() == KeyEvent.ACTION_DOWN) { setPushToTalk(true); return true; } return super.onKeyDown(keyCode, event); }