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.maskyn.fileeditorpro.activity.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { onBackPressed();/* w w w .j a v a2 s. co m*/ return true; } else if (keyCode == KeyEvent.KEYCODE_MENU) { return false; } else { if (mEditor == null) mEditor = (Editor) findViewById(R.id.editor); // this will happen on first key pressed on hard-keyboard only. Once myInputField // gets the focus again, it will automatically receive further key presses. try { if (fileOpened && mEditor != null && !mEditor.hasFocus()) { mEditor.requestFocus(); mEditor.onKeyDown(keyCode, event); return true; } } catch (NullPointerException ex) { } } return false; }
From source file:com.jwork.spycamera.MainFragment.java
public boolean onKeyDown(int keyCode, KeyEvent event) { log.v(this, "onKeyDown(keycode:" + keyCode + ")"); if (keyCode == KeyEvent.KEYCODE_BACK) { return controller.pressBack(); } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { return controller.pressVolumeDown(); // //TODO // LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.linearLayoutPreview); // linearLayout.removeView(svPreview); // return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { return controller.pressVolumeUp(); // //TODO // LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.linearLayoutPreview); // linearLayout.addView(svPreview, 1); // return true; } else if (keyCode == KeyEvent.KEYCODE_MENU) { return controller.pressMenu(); }//from w w w . j a va 2 s . c om return false; }
From source file:it.unipr.ce.dsg.gamidroid.activities.SensorDataViewActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { stopThread();/*from ww w .j a v a 2 s. c om*/ GamiNode.getAndroidGamiNode(mContext).getRfm().stopTemperatureNotificationLookup(); onBackPressed(); } return super.onKeyDown(keyCode, event); }
From source file:cn.edu.sdu.online.activity.FragmentTabsPager.java
/** * ???? /*from w w w . j a v a 2 s. c o m*/ */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) { exitBy2Click(); //? } return false; }
From source file:fm.libre.droid.LibreDroid.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { if (this.libreServiceConn.service.getCurrentPage() > 0) { if (this.libreServiceConn.service.getCurrentPage() == 4) { // Back three pages if we're on the player page to get back to the main menu this.prevPage(); this.prevPage(); }/* w ww. ja va 2 s. c o m*/ this.prevPage(); LibreDroid.this.libreServiceConn.service.stop(); return true; } } return super.onKeyDown(keyCode, event); }
From source file:com.yi4all.rupics.ImageDetailActivity.java
@Override public boolean onKeyDown(int keyCoder, KeyEvent event) { int keyCode = event.getKeyCode(); switch (keyCode) { case KeyEvent.KEYCODE_BACK: if (popMenuPanel.getVisibility() == View.VISIBLE) { popMenuPanel.setVisibility(View.GONE); return true; } else {/*from w w w.j a va2 s . c om*/ return super.onKeyDown(keyCoder, event); } default: return false; } }
From source file:jp.co.rakuten.rakutenvideoplayer.base.BaseActivity.java
/** * Show dialog error//w ww .j a v a 2 s . c o m * @param errStr */ public void showDialogError(String errStr) { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setIcon(R.drawable.icon); adb.setTitle(R.string.str_ErrPlay_Title); adb.setMessage(errStr); adb.setPositiveButton(R.string.str_OK, new OnClickListener() { public void onClick(DialogInterface a0, int a1) { finish(); } }); adb.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { dialog.dismiss(); finish(); return true; } return false; } }); AlertDialog ad = adb.create(); ad.show(); }
From source file:com.kciray.android.filemanager.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { activeDirView.goUp();/*from w w w . ja va 2 s .co m*/ return true; } return super.onKeyDown(keyCode, event); }
From source file:cc.softwarefactory.lokki.android.activities.MainActivity.java
@Override public boolean onKeyUp(int keycode, KeyEvent e) { switch (keycode) { case KeyEvent.KEYCODE_MENU: mNavigationDrawerFragment.toggleDrawer(); return true; case KeyEvent.KEYCODE_BACK: if (selectedOption == 0) { Log.e(TAG, "Exiting app because requested by user."); finish();/*from ww w . j a va2 s . c o m*/ } else if (selectedOption == -10) { // -10 is add contacts screen mNavigationDrawerFragment.selectItem(3); // 3 is contacts screen return true; } else { mNavigationDrawerFragment.selectItem(1); return true; } } return super.onKeyUp(keycode, e); }
From source file:android.car.ui.provider.CarDrawerLayout.java
@Override public boolean dispatchKeyEvent(@NonNull KeyEvent keyEvent) { int action = keyEvent.getAction(); int keyCode = keyEvent.getKeyCode(); final View drawerView = findDrawerView(); if (drawerView != null && getDrawerLockMode(drawerView) == LOCK_MODE_UNLOCKED) { if (isDrawerOpen()) { if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_SOFT_RIGHT) { closeDrawer();/*from w w w . ja v a 2 s . c om*/ return true; } else if (keyCode == KeyEvent.KEYCODE_BACK && action == KeyEvent.ACTION_UP && mDrawerControllerListener != null) { mDrawerControllerListener.onBack(); return true; } else { return drawerView.dispatchKeyEvent(keyEvent); } } } return mContentView.dispatchKeyEvent(keyEvent); }