Permalink
Browse files

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.
  • Loading branch information...
pawitp authored and carlosavignano committed May 25, 2013
1 parent f72f6bb commit 36b69d5c2b23ded9fcdd4bc617d59f293cbfe099
@@ -182,6 +182,14 @@
android:text="@string/link_volume_mutes"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
+ <CheckBox
+ android:id="@+id/volume_keys_control_ring_stream"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="start"
+ android:text="@string/volume_keys_control_ring_stream"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ />
</LinearLayout>
<TextView
View
@@ -4410,6 +4410,7 @@
<string name="notification_sound_limiter_title">Notification sound limit</string>
<string name="notification_sound_limiter_summary">Sets the allowed delay between incoming notifications</string>
<string name="notification_sound_default_time">Default</string>
+ <string name="volume_keys_control_ring_stream">Volume keys control ringtone volume</string>
<!-- Display settings screen, notification light settings -->
<string name="notification_light_general_title">General</string>
@@ -187,6 +187,7 @@ protected void onBindDialogView(View view) {
final CheckBox linkCheckBox = (CheckBox) view.findViewById(R.id.link_ring_and_volume);
final CheckBox linkMuteStates = (CheckBox) view.findViewById(R.id.link_mutes);
+ final CheckBox volumeKeysControlRingStream = (CheckBox) view.findViewById(R.id.volume_keys_control_ring_stream);
final View ringerSection = view.findViewById(R.id.ringer_section);
final View notificationSection = view.findViewById(R.id.notification_section);
@@ -256,6 +257,24 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
});
+
+ if (System.getInt(getContext().getContentResolver(),
+ System.VOLUME_KEYS_CONTROL_RING_STREAM, 1) == 1) {
+ volumeKeysControlRingStream.setChecked(true);
+ } else {
+ volumeKeysControlRingStream.setChecked(false);
+ }
+
+ volumeKeysControlRingStream.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Settings.System.putInt(buttonView.getContext().getContentResolver(),
+ Settings.System.VOLUME_KEYS_CONTROL_RING_STREAM, isChecked ? 1 : 0);
+ }
+
+ });
+
} else {
ringerSection.setVisibility(View.GONE);
linkVolumesSection.setVisibility(View.GONE);

0 comments on commit 36b69d5

Please sign in to comment.