Merge "Show mute icon in sound settings page"
This commit is contained in:
committed by
Android (Google) Code Review
commit
b976044f57
@@ -47,6 +47,8 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
|||||||
private final RingReceiver mReceiver = new RingReceiver();
|
private final RingReceiver mReceiver = new RingReceiver();
|
||||||
private final H mHandler = new H();
|
private final H mHandler = new H();
|
||||||
|
|
||||||
|
private int mMuteIcon;
|
||||||
|
|
||||||
public RingVolumePreferenceController(Context context) {
|
public RingVolumePreferenceController(Context context) {
|
||||||
this(context, KEY_RING_VOLUME);
|
this(context, KEY_RING_VOLUME);
|
||||||
}
|
}
|
||||||
@@ -94,7 +96,7 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMuteIcon() {
|
public int getMuteIcon() {
|
||||||
return R.drawable.ic_volume_ringer_vibrate;
|
return mMuteIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRingerMode() {
|
private void updateRingerMode() {
|
||||||
@@ -104,11 +106,6 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
|||||||
updatePreferenceIcon();
|
updatePreferenceIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean wasRingerModeVibrate() {
|
|
||||||
return mVibrator != null && mRingerMode == AudioManager.RINGER_MODE_SILENT
|
|
||||||
&& mHelper.getLastAudibleStreamVolume(getAudioStream()) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateEffectsSuppressor() {
|
private void updateEffectsSuppressor() {
|
||||||
final ComponentName suppressor = NotificationManager.from(mContext).getEffectsSuppressor();
|
final ComponentName suppressor = NotificationManager.from(mContext).getEffectsSuppressor();
|
||||||
if (Objects.equals(suppressor, mSuppressor)) return;
|
if (Objects.equals(suppressor, mSuppressor)) return;
|
||||||
@@ -122,10 +119,15 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
|||||||
|
|
||||||
private void updatePreferenceIcon() {
|
private void updatePreferenceIcon() {
|
||||||
if (mPreference != null) {
|
if (mPreference != null) {
|
||||||
mPreference.showIcon(
|
if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
|
||||||
mRingerMode == AudioManager.RINGER_MODE_VIBRATE || wasRingerModeVibrate()
|
mMuteIcon = R.drawable.ic_volume_ringer_vibrate;
|
||||||
? com.android.internal.R.drawable.ic_audio_ring_notif_vibrate
|
mPreference.showIcon(com.android.internal.R.drawable.ic_audio_ring_notif_vibrate);
|
||||||
: com.android.internal.R.drawable.ic_audio_ring_notif);
|
} else if (mRingerMode == AudioManager.RINGER_MODE_SILENT) {
|
||||||
|
mMuteIcon = R.drawable.ic_volume_ringer_mute;
|
||||||
|
mPreference.showIcon(com.android.internal.R.drawable.ic_audio_ring_notif_mute);
|
||||||
|
} else {
|
||||||
|
mPreference.showIcon(com.android.internal.R.drawable.ic_audio_ring_notif);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user