Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca720584 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Use vibrate icon in volume settings when appropriate.

Clicking on icon will now put it in vibrate mode (instead of silent)
if vibrate is enabled for silent mode.

Bug: 5530217
Change-Id: Icd314981734af2cb37cf47fe27fc697bf447af73
parent d9bf0d1a
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -116,9 +116,15 @@ public class RingerVolumePreference extends VolumePreference implements OnClickL
            boolean muted = mAudioManager.isStreamMute(streamType);

            if (mCheckBoxes[i] != null) {
                if (streamType == AudioManager.STREAM_RING && muted
                        && mAudioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)) {
                    mCheckBoxes[i].setImageResource(
                            com.android.internal.R.drawable.ic_audio_ring_notif_vibrate);
                } else {
                    mCheckBoxes[i].setImageResource(
                            muted ? SEEKBAR_MUTED_RES_ID[i] : SEEKBAR_UNMUTED_RES_ID[i]);
                }
            }
            if (mSeekBars[i] != null) {
                mSeekBars[i].setEnabled(!muted);
                final int volume = muted ? mAudioManager.getLastAudibleStreamVolume(streamType)
@@ -362,7 +368,11 @@ public class RingerVolumePreference extends VolumePreference implements OnClickL
        // 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(AudioManager.RINGER_MODE_SILENT);
                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: