diff options
-rw-r--r-- | res/values/cm_strings.xml | 4 | ||||
-rw-r--r-- | res/xml/button_settings.xml | 6 | ||||
-rw-r--r-- | src/com/android/settings/ButtonSettings.java | 16 |
3 files changed, 24 insertions, 2 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 104ec13..9cc9a66 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -202,7 +202,6 @@ <!-- Profiles --> <string name="profile_menu_delete_title">Delete</string> <string name="profile_menu_triggers_title">Modify triggers</string> - <string name="profile_action_none">Leave unchanged</string> <string name="profile_action_system">System default</string> <string name="profile_action_disable">Turn off</string> @@ -553,4 +552,7 @@ <string name="lto_download_data_wifi_only">GPS assisted data download</string> <string name="lto_download_data_wifi_only_on">Over any networks</string> <string name="lto_download_data_wifi_only_off">Only over Wi\u2011Fi networks</string> + + <string name="volume_keys_control_ring_stream_title">Volume keys control ringtone volume</string> + <string name="volume_keys_control_ring_stream_summary">If on, volume keys control ringtone volume. If off, volume keys control media volume.</string> </resources> diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml index b232cc2..773aebb 100644 --- a/res/xml/button_settings.xml +++ b/res/xml/button_settings.xml @@ -229,6 +229,12 @@ android:summary="@string/volbtn_music_controls_summary" android:defaultValue="true" /> + <com.android.settings.cyanogenmod.SecureSettingSwitchPreference + android:key="volume_keys_control_ring_stream" + android:title="@string/volume_keys_control_ring_stream_title" + android:summary="@string/volume_keys_control_ring_stream_summary" + settings:advanced="true" /> + <ListPreference android:key="volume_key_cursor_control" android:dialogTitle="@string/volbtn_cursor_control_title" 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); |