List of usage examples for android.view KeyEvent KEYCODE_BACK
int KEYCODE_BACK
To view the source code for android.view KeyEvent KEYCODE_BACK.
Click Source Link
From source file:com.ichi2.anki.CardEditor.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { Log.i(AnkiDroidApp.TAG, "CardEditor - onBackPressed()"); closeCardEditor();//w w w. j a va 2s. c o m return true; } return super.onKeyDown(keyCode, event); }
From source file:com.hichinaschool.flashcards.anki.CardEditor.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { // Log.i(AnkiDroidApp.TAG, "CardEditor - onBackPressed()"); closeCardEditor();//from w w w .j a v a 2 s . c o m return true; } return super.onKeyDown(keyCode, event); }
From source file:cn.finalteam.galleryfinal.PhotoEditActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (mCropState && !(mCropPhotoAction && !GalleryFinal.getFunctionConfig().isRotate() && !GalleryFinal.getFunctionConfig().isCamera())) { if ((GalleryFinal.getFunctionConfig().isForceCrop() && GalleryFinal.getFunctionConfig().isForceCropEdit())) { mIvCrop.performClick();/* w w w .ja va 2 s . c o m*/ return true; } } } return super.onKeyDown(keyCode, event); }
From source file:com.ieeton.user.activity.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if ((System.currentTimeMillis() - mExitTime) > 2000) { Utils.showToast(this, "??", Toast.LENGTH_SHORT); mExitTime = System.currentTimeMillis(); } else {/* w w w . j ava 2 s. c om*/ Utils.exitApp(this); } return true; } return super.onKeyDown(keyCode, event); }
From source file:com.edible.ocr.CaptureActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { // First check if we're paused in continuous mode, and if so, just unpause. if (isPaused) { Log.d(TAG, "only resuming continuous recognition, not quitting..."); resumeContinuousDecoding();/*from w w w.ja va 2s . c o m*/ return true; } // Exit the app if we're not viewing an OCR result. if (lastResult == null) { setResult(RESULT_CANCELED); finish(); return true; } else { // Go back to previewing in regular OCR mode. resetStatusView(); if (handler != null) { handler.sendEmptyMessage(R.id.restart_preview); } return true; } } else if (keyCode == KeyEvent.KEYCODE_CAMERA) { if (isContinuousModeActive) { onShutterButtonPressContinuous(); } else { handler.hardwareShutterButtonClick(); } return true; } else if (keyCode == KeyEvent.KEYCODE_FOCUS) { // Only perform autofocus if user is not holding down the button. if (event.getRepeatCount() == 0) { cameraManager.requestAutoFocus(500L); } return true; } return super.onKeyDown(keyCode, event); }
From source file:com.abc.driver.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { if (menu_display) { menuWindow.dismiss();/*w ww . j a va 2 s . c o m*/ menu_display = false; } else { onBackPressed(); } } else if (keyCode == KeyEvent.KEYCODE_MENU) { if (!menu_display) { inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); layout = inflater.inflate(R.layout.main_menu, null); menuWindow = new PopupWindow(layout, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); menuWindow.showAtLocation(this.findViewById(R.id.mainweixin), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); mClose = (LinearLayout) layout.findViewById(R.id.menu_close); mCloseBtn = (LinearLayout) layout.findViewById(R.id.menu_close_btn); mCloseBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(); menuWindow.dismiss(); } }); menu_display = true; } else { menuWindow.dismiss(); menu_display = false; } return false; } return false; }
From source file:org.openremote.android.console.GroupActivity.java
/** * If press back key, finish the activity. * /*from w w w . j a v a2s. c o m*/ * @see android.app.Activity#onKeyDown(int, android.view.KeyEvent) */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { finish(); return true; } return super.onKeyDown(keyCode, event); }
From source file:com.fvd.nimbus.BrowseActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); return true; }// w ww .ja v a 2 s.c o m if (floatMenu.isExpanded()) { //toggleTools(); floatMenu.collapse(); return true; } if (isInSelectionMode()) { wv.endSelectionMode(); //wv.loadUrl("javascript:android.clearSelection();"); return true; } /*if (wv.canGoBack()){ wv.goBack(); return true; }*/ //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up ); overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); } else if (keyCode == KeyEvent.KEYCODE_HOME) { //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up ); overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); finish(); } return super.onKeyDown(keyCode, event); }
From source file:com.justwayward.reader.ui.activity.ReadActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) { mTocListPopupWindow.dismiss(); gone(mTvBookReadTocTitle);/* w w w . j a v a 2s. c om*/ visible(mTvBookReadReading, mTvBookReadCommunity, mTvBookReadChangeSource); return true; } else if (isVisible(rlReadAaSet)) { gone(rlReadAaSet); return true; } else if (isVisible(mLlBookReadBottom)) { hideReadBar(); return true; } else if (!CollectionsManager.getInstance().isCollected(bookId)) { showJoinBookShelfDialog(recommendBooks); return true; } break; case KeyEvent.KEYCODE_MENU: toggleReadBar(); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: if (SettingManager.getInstance().isVolumeFlipEnable()) { return true; } break; case KeyEvent.KEYCODE_VOLUME_UP: if (SettingManager.getInstance().isVolumeFlipEnable()) { return true; } break; default: break; } return super.onKeyDown(keyCode, event); }