diff options
author | John Spurlock <jspurlock@google.com> | 2015-05-29 19:50:06 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-29 19:50:07 +0000 |
commit | 2473e1e92241b532294524afb9e668497cd86258 (patch) | |
tree | a3cd43bbca8402fcc843caac85c5dc6008ba8fd7 | |
parent | 2400197f10ff2ca8d393eac47a65a09dc0cea3e9 (diff) | |
parent | 157822682fa808f2f6607cf9edb97e1cca8c1441 (diff) | |
download | frameworks_base-2473e1e92241b532294524afb9e668497cd86258.zip frameworks_base-2473e1e92241b532294524afb9e668497cd86258.tar.gz frameworks_base-2473e1e92241b532294524afb9e668497cd86258.tar.bz2 |
Merge "Zen: Dim status bar alarm icon when zen = total silence." into mnc-dev
-rw-r--r-- | packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml | 32 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java | 13 |
2 files changed, 41 insertions, 4 deletions
diff --git a/packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml b/packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml new file mode 100644 index 0000000..c8e2ac1 --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_alarm_dim.xml @@ -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>
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index 5942b46..7c10c66 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -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() { |