Zen: Dim status bar alarm icon when zen = total silence.
Bug: 21359239 Change-Id: I5bf207c4c181869127ed8b90787cbd7d9bb0f6c2
This commit is contained in:
32
packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml
Normal file
32
packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:insetLeft="2.5dp"
|
||||
android:insetRight="2.5dp">
|
||||
|
||||
<vector
|
||||
android:width="17dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
|
||||
<path
|
||||
android:fillColor="#4dffffff"
|
||||
android:pathData="M22.0,5.7l-4.6,-3.9l-1.3,1.5l4.6,3.9L22.0,5.7zM7.9,3.4L6.6,1.9L2.0,5.7l1.3,1.5L7.9,3.4zM12.5,8.0L11.0,8.0l0.0,6.0l4.7,2.9l0.8,-1.2l-4.0,-2.4L12.5,8.0zM12.0,4.0c-5.0,0.0 -9.0,4.0 -9.0,9.0c0.0,5.0 4.0,9.0 9.0,9.0s9.0,-4.0 9.0,-9.0C21.0,8.0 17.0,4.0 12.0,4.0zM12.0,20.0c-3.9,0.0 -7.0,-3.1 -7.0,-7.0c0.0,-3.9 3.1,-7.0 7.0,-7.0c3.9,0.0 7.0,3.1 7.0,7.0C19.0,16.9 15.9,20.0 12.0,20.0z"/>
|
||||
|
||||
</vector>
|
||||
|
||||
</inset>
|
||||
@@ -67,6 +67,7 @@ public class PhoneStatusBarPolicy {
|
||||
private final Handler mHandler = new Handler();
|
||||
private final CastController mCast;
|
||||
private final HotspotController mHotspot;
|
||||
private final AlarmManager mAlarmManager;
|
||||
|
||||
// Assume it's all good unless we hear otherwise. We don't always seem
|
||||
// to get broadcasts that it *is* there.
|
||||
@@ -112,7 +113,8 @@ public class PhoneStatusBarPolicy {
|
||||
mContext = context;
|
||||
mCast = cast;
|
||||
mHotspot = hotspot;
|
||||
mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
mService = (StatusBarManager) context.getSystemService(Context.STATUS_BAR_SERVICE);
|
||||
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
|
||||
// listen for broadcasts
|
||||
IntentFilter filter = new IntentFilter();
|
||||
@@ -173,9 +175,11 @@ public class PhoneStatusBarPolicy {
|
||||
}
|
||||
|
||||
private void updateAlarm() {
|
||||
AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
|
||||
boolean alarmSet = alarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null;
|
||||
mService.setIconVisibility(SLOT_ALARM_CLOCK, alarmSet);
|
||||
final boolean hasAlarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT) != null;
|
||||
final boolean zenNone = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS;
|
||||
mService.setIconVisibility(SLOT_ALARM_CLOCK, hasAlarm);
|
||||
mService.setIcon(SLOT_ALARM_CLOCK, zenNone ? R.drawable.stat_sys_alarm_dim
|
||||
: R.drawable.stat_sys_alarm, 0, null);
|
||||
}
|
||||
|
||||
private final void updateSimState(Intent intent) {
|
||||
@@ -259,6 +263,7 @@ public class PhoneStatusBarPolicy {
|
||||
mService.setIconVisibility(SLOT_VOLUME, volumeVisible);
|
||||
mVolumeVisible = volumeVisible;
|
||||
}
|
||||
updateAlarm();
|
||||
}
|
||||
|
||||
private final void updateBluetooth() {
|
||||
|
||||
Reference in New Issue
Block a user