List of usage examples for android.view KeyEvent KEYCODE_VOLUME_DOWN
int KEYCODE_VOLUME_DOWN
To view the source code for android.view KeyEvent KEYCODE_VOLUME_DOWN.
Click Source Link
From source file:paulscode.android.mupen64plusae.persistent.GlobalPrefs.java
/** * Instantiates a new user preferences wrapper. * * @param context//from ww w . j a v a2 s. c om * The application context. */ public GlobalPrefs(Context context, AppData appData) { mPreferences = PreferenceManager.getDefaultSharedPreferences(context); // Locale mLocaleCode = mPreferences.getString(KEY_LOCALE_OVERRIDE, DEFAULT_LOCALE_OVERRIDE); mLocale = TextUtils.isEmpty(mLocaleCode) ? Locale.getDefault() : createLocale(mLocaleCode); final Locale[] availableLocales = Locale.getAvailableLocales(); String[] values = context.getResources().getStringArray(R.array.localeOverride_values); String[] entries = new String[values.length]; for (int i = values.length - 1; i > 0; i--) { final Locale locale = createLocale(values[i]); // Get intersection of languages (available on device) and (translated for Mupen) if (ArrayUtils.contains(availableLocales, locale)) { // Get the name of the language, as written natively entries[i] = WordUtils.capitalize(locale.getDisplayName(locale)); } else { // Remove the item from the list entries = (String[]) ArrayUtils.remove(entries, i); values = (String[]) ArrayUtils.remove(values, i); } } entries[0] = context.getString(R.string.localeOverride_entrySystemDefault); mLocaleNames = entries; mLocaleCodes = values; // Files userDataDir = mPreferences.getString("pathGameSaves", ""); galleryCacheDir = userDataDir + "/GalleryCache"; coverArtDir = galleryCacheDir + "/CoverArt"; unzippedRomsDir = galleryCacheDir + "/UnzippedRoms"; profilesDir = userDataDir + "/Profiles"; crashLogDir = userDataDir + "/CrashLogs"; coreUserDataDir = userDataDir + "/CoreConfig/UserData"; coreUserCacheDir = userDataDir + "/CoreConfig/UserCache"; hiResTextureDir = coreUserDataDir + "/mupen64plus/hires_texture/"; // MUST match what rice assumes natively textureCacheDir = coreUserCacheDir + "/mupen64plus/cache"; romInfoCache_cfg = galleryCacheDir + "/romInfoCache.cfg"; controllerProfiles_cfg = profilesDir + "/controller.cfg"; touchscreenProfiles_cfg = profilesDir + "/touchscreen.cfg"; emulationProfiles_cfg = profilesDir + "/emulation.cfg"; customCheats_txt = profilesDir + "/customCheats.txt"; touchscreenCustomSkinsDir = userDataDir + "/CustomSkins"; legacyAutoSaves = userDataDir + "/AutoSaves"; legacySlotSaves = userDataDir + "/SlotSaves"; // Plug-ins audioPlugin = new Plugin(mPreferences, appData.libsDir, "audioPlugin"); // Library prefs isRecentShown = mPreferences.getBoolean("showRecentlyPlayed", true); isFullNameShown = mPreferences.getBoolean("showFullNames", true); // Touchscreen prefs isTouchscreenFeedbackEnabled = mPreferences.getBoolean("touchscreenFeedback", false); touchscreenScale = (mPreferences.getInt("touchscreenScale", 100)) / 100.0f; touchscreenTransparency = (255 * mPreferences.getInt("touchscreenTransparency", 100)) / 100; touchscreenAutoHold = getSafeInt(mPreferences, "touchscreenAutoHold", 0); // Video prefs displayOrientation = getSafeInt(mPreferences, "displayOrientation", 0); displayPosition = getSafeInt(mPreferences, "displayPosition", Gravity.CENTER_VERTICAL); final int transparencyPercent = mPreferences.getInt("displayActionBarTransparency", 50); displayActionBarTransparency = (255 * transparencyPercent) / 100; isFpsEnabled = mPreferences.getBoolean("displayFps", false); final int selectedHardwareType = getSafeInt(mPreferences, "videoHardwareType", -1); isPolygonOffsetHackEnabled = selectedHardwareType > -2; videoHardwareType = selectedHardwareType < 0 ? appData.hardwareInfo.hardwareType : selectedHardwareType; switch (videoHardwareType) { case HardwareInfo.HARDWARE_TYPE_OMAP: videoPolygonOffset = 0.2f; break; case HardwareInfo.HARDWARE_TYPE_OMAP_2: videoPolygonOffset = -1.5f; break; case HardwareInfo.HARDWARE_TYPE_QUALCOMM: videoPolygonOffset = -0.2f; break; case HardwareInfo.HARDWARE_TYPE_IMAP: videoPolygonOffset = -0.001f; break; case HardwareInfo.HARDWARE_TYPE_TEGRA: videoPolygonOffset = -2.0f; break; case HardwareInfo.HARDWARE_TYPE_UNKNOWN: videoPolygonOffset = -1.5f; break; default: videoPolygonOffset = SafeMethods.toFloat(mPreferences.getString("videoPolygonOffset", "-1.5"), -1.5f); break; } isImmersiveModeEnabled = mPreferences.getBoolean("displayImmersiveMode", false); // Audio prefs audioSwapChannels = mPreferences.getBoolean("audioSwapChannels", false); audioSDLSecondaryBufferSize = getSafeInt(mPreferences, "audioSDLBufferSize", 2048); audioSLESSecondaryBufferSize = getSafeInt(mPreferences, "audioSLESBufferSize2", 256); audioSLESSecondaryBufferNbr = getSafeInt(mPreferences, "audioSLESBufferNbr2", 20); audioSLESSamplingRate = getSafeInt(mPreferences, "audioSLESSamplingRate", 0); if (audioPlugin.enabled) isFramelimiterEnabled = !mPreferences.getBoolean("audioSynchronize", true); else isFramelimiterEnabled = !mPreferences.getString("audioPlugin", "").equals("nospeedlimit"); // User interface modes final String navMode = mPreferences.getString("navigationMode", "auto"); if (navMode.equals("bigscreen")) isBigScreenMode = true; else if (navMode.equals("standard")) isBigScreenMode = false; else isBigScreenMode = AppData.IS_OUYA_HARDWARE || appData.isAndroidTv; // TODO: Add other systems as they enter market // Peripheral share mode isControllerShared = mPreferences.getBoolean("inputShareController", false); maxAutoSaves = mPreferences.getInt("gameAutoSaves", 5); // Determine the key codes that should not be mapped to controls final boolean volKeysMappable = mPreferences.getBoolean("inputVolumeMappable", false); final List<Integer> unmappables = new ArrayList<>(); unmappables.add(KeyEvent.KEYCODE_MENU); // Back key is needed to show/hide the action bar in HC+ unmappables.add(KeyEvent.KEYCODE_BACK); if (!volKeysMappable) { unmappables.add(KeyEvent.KEYCODE_VOLUME_UP); unmappables.add(KeyEvent.KEYCODE_VOLUME_DOWN); unmappables.add(KeyEvent.KEYCODE_VOLUME_MUTE); } unmappableKeyCodes = Collections.unmodifiableList(unmappables); // Controller profiles controllerProfile1 = loadControllerProfile(mPreferences, GamePrefs.CONTROLLER_PROFILE1, getControllerProfileDefault(1), GetControllerProfilesConfig(), appData.GetControllerProfilesConfig()); controllerProfile2 = loadControllerProfile(mPreferences, GamePrefs.CONTROLLER_PROFILE2, getControllerProfileDefault(2), GetControllerProfilesConfig(), appData.GetControllerProfilesConfig()); controllerProfile3 = loadControllerProfile(mPreferences, GamePrefs.CONTROLLER_PROFILE3, getControllerProfileDefault(3), GetControllerProfilesConfig(), appData.GetControllerProfilesConfig()); controllerProfile4 = loadControllerProfile(mPreferences, GamePrefs.CONTROLLER_PROFILE4, getControllerProfileDefault(4), GetControllerProfilesConfig(), appData.GetControllerProfilesConfig()); // Player map playerMap = new PlayerMap(mPreferences.getString(GamePrefs.PLAYER_MAP, "")); // Determine whether controller deconfliction is needed int numControllers = 0; numControllers += controllerProfile1 != null ? 1 : 0; numControllers += controllerProfile2 != null ? 1 : 0; numControllers += controllerProfile3 != null ? 1 : 0; numControllers += controllerProfile4 != null ? 1 : 0; playerMap.setEnabled(numControllers > 1 && !isControllerShared); }
From source file:com.example.bluetooth_faster_connection.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { mMessageService.write(BluetoothMessageService.VOL_UP); return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { mMessageService.write(BluetoothMessageService.VOL_DOWN); return true; }/*from www .ja v a 2 s . co m*/ return super.onKeyDown(keyCode, event); }
From source file:com.smc.tw.waltz.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (DEBUG)//from ww w . j av a2 s . c om Log.d(TAG, "onKeyDown code:" + keyCode); switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: { mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; } case KeyEvent.KEYCODE_VOLUME_DOWN: { mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; } default: break; } return super.onKeyDown(keyCode, event); }
From source file:com.mschlauch.comfortreader.FullscreenActivity.java
public boolean onKeyDown(int keyCode, KeyEvent event) { int duration = Toast.LENGTH_SHORT; //VOLUME KEY DOWN if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { Context context = getApplicationContext(); CharSequence text = "??"; if (started == false) { previousButtonClicked(contentView); text = "<<"; }//from ww w . j a v a 2 s .c om toast = Toast.makeText(context, text, duration); toast.show(); stop(); keyCode = -900000; return true; } //VOLUME KEY UP else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { Context context = getApplicationContext(); CharSequence text = ""; if (started == true) { text = "??"; toast = Toast.makeText(context, text, duration); toast.show(); } playButtonClicked(contentView); keyCode = -900000; return true; } else if (keyCode == KeyEvent.KEYCODE_MENU) { menuButtonClicked(contentView); return true; } super.onKeyDown(keyCode, event); return true; }
From source file:android.support.v7.app.MediaRouteControllerDialog.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) { mRoute.requestUpdateVolume(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ? -1 : 1); return true; }/* w ww .j a va2s. c om*/ return super.onKeyDown(keyCode, event); }
From source file:android.support.v7.app.MediaRouteControllerDialog.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) { return true; }//from w ww.j a v a2 s . c o m return super.onKeyUp(keyCode, event); }
From source file:android.widget.TiVideoView4.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (mIsPrepared && keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL && mMediaPlayer != null && mMediaController != null) { if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) { if (mMediaPlayer.isPlaying()) { pause();/* w ww. j a va 2 s.c om*/ mMediaController.show(); } else { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP && mMediaPlayer.isPlaying()) { pause(); mMediaController.show(); } else { toggleMediaControlsVisiblity(); } } return super.onKeyDown(keyCode, event); }
From source file:de.spiritcroc.modular_remote.MainActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (volumeButtonSettingsShortcutCount) { case 0://from www. j a v a2 s.co m case 1: case 4: case 6: resetVolumeButtonSettingsShortcutHandler.removeCallbacks(resetVolumeButtonSettingsShortcut); if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { volumeButtonSettingsShortcutCount++; resetVolumeButtonSettingsShortcutHandler.postDelayed(resetVolumeButtonSettingsShortcut, 1000); } else { volumeButtonSettingsShortcutCount = 0; } break; case 2: case 3: case 5: resetVolumeButtonSettingsShortcutHandler.removeCallbacks(resetVolumeButtonSettingsShortcut); if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { volumeButtonSettingsShortcutCount++; resetVolumeButtonSettingsShortcutHandler.postDelayed(resetVolumeButtonSettingsShortcut, 1000); } else { volumeButtonSettingsShortcutCount = 0; } break; case 7: resetVolumeButtonSettingsShortcutHandler.removeCallbacks(resetVolumeButtonSettingsShortcut); if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { Toast.makeText(getApplicationContext(), R.string.toast_volume_button_settings_shortcut, Toast.LENGTH_LONG).show(); startActivity( new Intent(this, SettingsActivity.class).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)); } volumeButtonSettingsShortcutCount = 0; break; default: volumeButtonSettingsShortcutCount = 0; break; } return pages.get(viewPager.getCurrentItem()).onKeyDown(keyCode) || super.onKeyDown(keyCode, event); }
From source file:org.protocoderrunner.apprunner.AppRunnerActivity.java
public boolean checkVolumeKeys(int keyCode) { boolean r;//from w ww.j av a 2s . c om if (keyVolumeEnabled && (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) { r = true; } else { r = false; } return r; }