Overhaul vibrate and silent settings to match hard keys.

We go back to the old style of toggling between Mute/Vibrate/Normal.
There is an addition of a checkbox to indicate Vibrate on ring/notif.

Icons in volume dialogs are no longer touchable.

Bug: 5586083

This simplifies the logic in SoundSettings quite a bit, since there's a 1-1 mapping
with ringer mode.

Don't disable volume sliders when muted, so you can go to zero and back up by sliding
your finger. This is because the icons are not clickable anymore.

Change-Id: Ia7ce7e1bf108419eb107f03b7720101efe1598b1
This commit is contained in:
Amith Yamasani
2011-11-29 16:38:14 -08:00
parent 2fa017f874
commit dfb654367d
6 changed files with 73 additions and 166 deletions

View File

@@ -53,7 +53,7 @@ import android.widget.TextView;
* Special preference type that allows configuration of both the ring volume and
* notification volume.
*/
public class RingerVolumePreference extends VolumePreference implements OnClickListener {
public class RingerVolumePreference extends VolumePreference {
private static final String TAG = "RingerVolumePreference";
private static final int MSG_RINGER_MODE_CHANGED = 101;
@@ -126,7 +126,6 @@ public class RingerVolumePreference extends VolumePreference implements OnClickL
}
}
if (mSeekBars[i] != null) {
mSeekBars[i].setEnabled(!muted);
final int volume = muted ? mAudioManager.getLastAudibleStreamVolume(streamType)
: mAudioManager.getStreamVolume(streamType);
mSeekBars[i].setProgress(volume);
@@ -176,9 +175,6 @@ public class RingerVolumePreference extends VolumePreference implements OnClickL
// Register callbacks for mute/unmute buttons
for (int i = 0; i < mCheckBoxes.length; i++) {
ImageView checkbox = (ImageView) view.findViewById(CHECKBOX_VIEW_ID[i]);
if ((silentableStreams & (1 << SEEKBAR_TYPE[i])) != 0) {
checkbox.setOnClickListener(this);
}
mCheckBoxes[i] = checkbox;
}
@@ -363,21 +359,4 @@ public class RingerVolumePreference extends VolumePreference implements OnClickL
}
};
}
public void onClick(View v) {
// Touching any of the mute buttons causes us to get the state from the system and toggle it
switch(mAudioManager.getRingerMode()) {
case AudioManager.RINGER_MODE_NORMAL:
mAudioManager.setRingerMode(
(Settings.System.getInt(getContext().getContentResolver(),
Settings.System.VIBRATE_IN_SILENT, 1) == 1)
? AudioManager.RINGER_MODE_VIBRATE
: AudioManager.RINGER_MODE_SILENT);
break;
case AudioManager.RINGER_MODE_VIBRATE:
case AudioManager.RINGER_MODE_SILENT:
mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
break;
}
}
}