List of usage examples for android.view KeyEvent KEYCODE_VOLUME_UP
int KEYCODE_VOLUME_UP
To view the source code for android.view KeyEvent KEYCODE_VOLUME_UP.
Click Source Link
From source file:com.google.android.marvin.mytalkback.ProcessorVolumeStream.java
private boolean isFromVolumeKey(int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: return true; }/*from w w w . j av a2 s. c om*/ return false; }
From source file:tkj.android.homecontrol.mythmote.MythMote.java
/** * Overridden to allow the hardware volume controls to influence the Myth * front end volume control/*from ww w .j ava 2 s . c o m*/ */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_DOWN: MythCom.GetMythCom(this).SendKey(KEY_VOLUME_DOWN); return true; case KeyEvent.KEYCODE_VOLUME_UP: MythCom.GetMythCom(this).SendKey(KEY_VOLUME_UP); return true; default: return super.onKeyDown(keyCode, event); } }
From source file:com.neuron.fantecremote.FantecActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: send("CMD_VOL_UP"); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: send("CMD_VOL_DOWN"); return true; }/* ww w . j a va2s. co m*/ return super.onKeyDown(keyCode, event); }
From source file:net.reichholf.dreamdroid.abstivities.AbstractHttpActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { return keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || super.onKeyUp(keyCode, event); }
From source file:com.grass.caishi.cc.activity.main.MainActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { super.onKeyUp(keyCode, event); if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) { this.hideNavigationBar(); }/*from ww w . jav a 2 s . c o m*/ return false; }
From source file:com.quarterfull.newsAndroid.NewsDetailActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this); if (mPrefs.getBoolean(SettingsActivity.CB_NAVIGATE_WITH_VOLUME_BUTTONS_STRING, false)) { if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) { if (currentPosition < rssItems.size() - 1) { mViewPager.setCurrentItem(currentPosition + 1, true); }/* w ww . j ava 2s . c om*/ // capture event to avoid volume change at end of feed return true; } else if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP)) { if (currentPosition > 0) { mViewPager.setCurrentItem(currentPosition - 1, true); } // capture event to avoid volume change at beginning of feed return true; } } if (keyCode == KeyEvent.KEYCODE_BACK) { NewsDetailFragment ndf = getNewsDetailFragmentAtPosition(currentPosition);//(NewsDetailFragment) getSupportFragmentManager().findFragmentByTag("android:switcher:" + R.id.pager + ":" + currentPosition); if (ndf != null && ndf.mWebView != null) { if (ndf.urls.size() > 1) { ndf.urls.remove(0); ndf.mWebView.loadUrl(ndf.urls.get(0)); return true; } else if (ndf.urls.size() == 1) { ndf.urls.remove(0); ndf.startLoadRssItemToWebViewTask(); Log.v(TAG, "Load rssitem to webview again"); return true; } } } return super.onKeyDown(keyCode, event); }
From source file:org.apache.cordova.X5CoreAndroid.java
/** * Override the default behavior of the Android volume buttons. * If overridden, when the volume button is pressed, the "volume[up|down]button" JavaScript event will be fired. * * @param button volumeup, volumedown * @param override T=override, F=cancel override *//*from ww w .j ava2s . c om*/ public void overrideButton(String button, boolean override) { LOG.i("App", "WARNING: Volume Button Default Behavior will be overridden. The volume event will be fired!"); if (button.equals("volumeup")) { webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_UP, override); } else if (button.equals("volumedown")) { webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_DOWN, override); } else if (button.equals("menubutton")) { webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_MENU, override); } }
From source file:com.microsoft.mimickeralarm.appcore.AlarmMainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { mAudioManager.adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND); } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { mAudioManager.adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI | AudioManager.FLAG_PLAY_SOUND); } else {// w ww. j av a 2s. c o m return super.onKeyDown(keyCode, event); } return true; }
From source file:de.pixart.messenger.ui.ScanActivity.java
@Override public boolean onKeyDown(final int keyCode, final KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_FOCUS: case KeyEvent.KEYCODE_CAMERA: // don't launch camera app return true; case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: cameraHandler.post(() -> cameraManager.setTorch(keyCode == KeyEvent.KEYCODE_VOLUME_UP)); return true; }//from w w w . ja v a2 s. co m return super.onKeyDown(keyCode, event); }
From source file:com.neuron.fantecremote.FantecActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { return true; }/*from w w w . j av a 2s. com*/ return super.onKeyUp(keyCode, event); }