summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/ButtonSettings.java
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2013-04-21 22:52:33 +0700
committerAdnan Begovic <adnan@cyngn.com>2015-10-29 17:36:31 -0700
commit7152dd4b22b7234b5cb63e6038e472dcc0997503 (patch)
treecc8aad13536b6285ce2b5e2a80714d2fb6c1ee02 /src/com/android/settings/ButtonSettings.java
parent14c91238695b94d3bdff6404e3b791fb00a4375f (diff)
downloadpackages_apps_Settings-7152dd4b22b7234b5cb63e6038e472dcc0997503.zip
packages_apps_Settings-7152dd4b22b7234b5cb63e6038e472dcc0997503.tar.gz
packages_apps_Settings-7152dd4b22b7234b5cb63e6038e472dcc0997503.tar.bz2
Option to use volume keys to control media volume anytime (1/2)
Some users don't adjust ringtone volume often (e.g. only use toggle to switch between silent and non-silent) mode. Having an option to use the volume keys to control media volume anytime allows media volume to be controllled/muted before entering a game or other apps with sound in an undesirable location. Change-Id: I6dbd25d1a14bcf5b1bf0b0468b96f4b4f8efdb14
Diffstat (limited to 'src/com/android/settings/ButtonSettings.java')
-rw-r--r--src/com/android/settings/ButtonSettings.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/com/android/settings/ButtonSettings.java b/src/com/android/settings/ButtonSettings.java
index f9d29e2..d200679 100644
--- a/src/com/android/settings/ButtonSettings.java
+++ b/src/com/android/settings/ButtonSettings.java
@@ -77,6 +77,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
private static final String KEY_HOME_ANSWER_CALL = "home_answer_call";
private static final String KEY_BLUETOOTH_INPUT_SETTINGS = "bluetooth_input_settings";
private static final String KEY_VOLUME_MUSIC_CONTROLS = "volbtn_music_controls";
+ private static final String KEY_VOLUME_CONTROL_RING_STREAM = "volume_keys_control_ring_stream";
private static final String CATEGORY_POWER = "power_key";
private static final String CATEGORY_HOME = "home_key";
@@ -123,6 +124,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
private ListPreference mVolumeKeyCursorControl;
private SwitchPreference mVolumeWakeScreen;
private SwitchPreference mVolumeMusicControls;
+ private SwitchPreference mVolumeControlRingStream;
private SwitchPreference mSwapVolumeButtons;
private SwitchPreference mDisableNavigationKeys;
private SwitchPreference mNavigationBarLeftPref;
@@ -201,7 +203,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
initRecentsLongPressAction(KEY_NAVIGATION_RECENTS_LONG_PRESS);
final CmHardwareManager cmHardwareManager =
- (CmHardwareManager) context.getSystemService(Context.CMHW_SERVICE);
+ (CmHardwareManager) getActivity().getSystemService(Context.CMHW_SERVICE);
// Only visible on devices that does not have a navigation bar already,
// and don't even try unless the existing keys can be disabled
@@ -390,6 +392,14 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
mVolumeWakeScreen = (SwitchPreference) findPreference(Settings.System.VOLUME_WAKE_SCREEN);
mVolumeMusicControls = (SwitchPreference) findPreference(KEY_VOLUME_MUSIC_CONTROLS);
+ mVolumeControlRingStream = (SwitchPreference)
+ findPreference(KEY_VOLUME_CONTROL_RING_STREAM);
+ int volumeControlRingtone = Settings.System.getInt(getContentResolver(),
+ Settings.System.VOLUME_KEYS_CONTROL_RING_STREAM, 1);
+ if (mVolumeControlRingStream != null) {
+ mVolumeControlRingStream.setChecked(volumeControlRingtone > 0);
+ }
+
if (mVolumeWakeScreen != null) {
if (mVolumeMusicControls != null) {
mVolumeMusicControls.setDependency(Settings.System.VOLUME_WAKE_SCREEN);
@@ -666,6 +676,10 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
? (Utils.isTablet(getActivity()) ? 2 : 1) : 0;
Settings.System.putInt(getActivity().getContentResolver(),
Settings.System.SWAP_VOLUME_KEYS_ON_ROTATION, value);
+ } else if (preference == mVolumeControlRingStream) {
+ int value = mVolumeControlRingStream.isChecked() ? 1 : 0;
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.VOLUME_KEYS_CONTROL_RING_STREAM, value);
} else if (preference == mDisableNavigationKeys) {
mDisableNavigationKeys.setEnabled(false);
mNavigationPreferencesCat.setEnabled(false);