From f82154de8c5274d41c6ae1cbd0170f9e20462a45 Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Wed, 10 Jun 2015 17:46:58 -0400 Subject: [PATCH] Settings: Follow frameworks change to volume sliders. Bug: 21267436 Change-Id: I72c6411346429ebf428662d1c6d6d8a7529c0d67 --- .../settings/notification/NotificationSettings.java | 7 ++++++- .../settings/notification/VolumeSeekBarPreference.java | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java index 00f54978db1..98f2517b61a 100644 --- a/src/com/android/settings/notification/NotificationSettings.java +++ b/src/com/android/settings/notification/NotificationSettings.java @@ -198,11 +198,16 @@ public class NotificationSettings extends SettingsPreferenceFragment implements private void updateRingOrNotificationPreference() { mRingOrNotificationPreference.showIcon(mSuppressor != null ? com.android.internal.R.drawable.ic_audio_ring_notif_mute - : mRingerMode == AudioManager.RINGER_MODE_VIBRATE + : mRingerMode == AudioManager.RINGER_MODE_VIBRATE || wasRingerModeVibrate() ? com.android.internal.R.drawable.ic_audio_ring_notif_vibrate : com.android.internal.R.drawable.ic_audio_ring_notif); } + private boolean wasRingerModeVibrate() { + return mVibrator != null && mRingerMode == AudioManager.RINGER_MODE_SILENT + && mAudioManager.getLastAudibleStreamVolume(AudioManager.STREAM_RING) == 0; + } + private void updateRingerMode() { final int ringerMode = mAudioManager.getRingerModeInternal(); if (mRingerMode == ringerMode) return; diff --git a/src/com/android/settings/notification/VolumeSeekBarPreference.java b/src/com/android/settings/notification/VolumeSeekBarPreference.java index 409944f06fa..2bbf9efb109 100644 --- a/src/com/android/settings/notification/VolumeSeekBarPreference.java +++ b/src/com/android/settings/notification/VolumeSeekBarPreference.java @@ -48,6 +48,7 @@ public class VolumeSeekBarPreference extends SeekBarPreference private TextView mSuppressionTextView; private String mSuppressionText; private boolean mMuted; + private boolean mZenMuted; private int mIconResId; private int mMuteIconResId; private boolean mStopped; @@ -122,9 +123,10 @@ public class VolumeSeekBarPreference extends SeekBarPreference } } @Override - public void onMuted(boolean muted) { - if (mMuted == muted) return; + public void onMuted(boolean muted, boolean zenMuted) { + if (mMuted == muted && mZenMuted == zenMuted) return; mMuted = muted; + mZenMuted = zenMuted; updateIconView(); } }; @@ -150,7 +152,7 @@ public class VolumeSeekBarPreference extends SeekBarPreference if (mIconView == null) return; if (mIconResId != 0) { mIconView.setImageResource(mIconResId); - } else if (mMuteIconResId != 0 && mMuted) { + } else if (mMuteIconResId != 0 && mMuted && !mZenMuted) { mIconView.setImageResource(mMuteIconResId); } else { mIconView.setImageDrawable(getIcon());