frameworks/base
Revision | 5fb1cb702d369d978067340a930f0d1b70ff8c29 (tree) |
---|---|
Zeit | 2016-10-08 21:22:42 |
Autor | Mike xdnax <mikecoconut5832@gmai...> |
Commiter | Steve Kondik |
SystemUI: Enable three icon switching within QS DND tile
This expands the QS DND tile to use three states instead of two.
Java commits by @nicholaschum
What this does:
- Removes the two states (true/false) clause {? XXX:YYY;} and uses an
switch(mZen) instead for the two cases and the default. If in the
future, we want to add another tile, just add another case.
- Adds two vector drawables originally by Cataclysm dev @atl4ntis,
modified and reformatted - this allows for themers to theme this
resource as well by adding the two new drawables.
PS1: Uses if/elsif/else clause
PS2: Update to use switch(mZen) clause
Change-Id: If34e225bdc81e944a12ffd764a521de934aca3b3
@@ -0,0 +1,25 @@ | ||
1 | +<!-- | |
2 | + Copyright (C) 2015 The Android Open Source Project | |
3 | + | |
4 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + you may not use this file except in compliance with the License. | |
6 | + You may obtain a copy of the License at | |
7 | + | |
8 | + http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + | |
10 | + Unless required by applicable law or agreed to in writing, software | |
11 | + distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + See the License for the specific language governing permissions and | |
14 | + limitations under the License. | |
15 | +--> | |
16 | +<vector | |
17 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
18 | + android:width="64dp" | |
19 | + android:height="64dp" | |
20 | + android:viewportWidth="48" | |
21 | + android:viewportHeight="48"> | |
22 | + <path | |
23 | + android:fillColor="#FFFFFFFF" | |
24 | + android:pathData="M24,4C12.95,4,4,12.95,4,24s8.95,20,20,20s20-8.95,20-20S35.05,4,24,4z M34,26h-8v8h-4v-8h-8v-4h8v-8h4v8h8V26z" /> | |
25 | +</vector> |
@@ -0,0 +1,28 @@ | ||
1 | +<!-- | |
2 | + Copyright (C) 2015 The Android Open Source Project | |
3 | + | |
4 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + you may not use this file except in compliance with the License. | |
6 | + You may obtain a copy of the License at | |
7 | + | |
8 | + http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + | |
10 | + Unless required by applicable law or agreed to in writing, software | |
11 | + distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + See the License for the specific language governing permissions and | |
14 | + limitations under the License. | |
15 | +--> | |
16 | +<inset xmlns:android="http://schemas.android.com/apk/res/android" | |
17 | + android:insetLeft="2.5dp" | |
18 | + android:insetRight="2.5dp"> | |
19 | + <vector | |
20 | + android:width="17dp" | |
21 | + android:height="17dp" | |
22 | + android:viewportHeight="48" | |
23 | + android:viewportWidth="48"> | |
24 | + <path | |
25 | + android:fillColor="#FFFFFFFF" | |
26 | + android:pathData="M24,4C12.95,4,4,12.95,4,24s8.95,20,20,20s20-8.95,20-20S35.05,4,24,4z M34,26h-8v8h-4v-8h-8v-4h8v-8h4v8h8V26z" /> | |
27 | + </vector> | |
28 | +</inset> |
@@ -142,7 +142,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { | ||
142 | 142 | checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_ADJUST_VOLUME); |
143 | 143 | switch (zen) { |
144 | 144 | case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: |
145 | - state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on); | |
145 | + state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on_priority); | |
146 | 146 | state.label = mContext.getString(R.string.quick_settings_dnd_priority_label); |
147 | 147 | state.contentDescription = mContext.getString( |
148 | 148 | R.string.accessibility_quick_settings_dnd_priority_on); |
@@ -258,8 +258,17 @@ public class PhoneStatusBarPolicy implements Callback, RotationLockController.Ro | ||
258 | 258 | |
259 | 259 | if (DndTile.isVisible(mContext) || DndTile.isCombinedIcon(mContext)) { |
260 | 260 | zenVisible = mZen != Global.ZEN_MODE_OFF; |
261 | - zenIconId = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS | |
262 | - ? R.drawable.stat_sys_dnd_total_silence : R.drawable.stat_sys_dnd; | |
261 | + switch (mZen) { | |
262 | + case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: | |
263 | + zenIconId = R.drawable.stat_sys_dnd_priority; | |
264 | + break; | |
265 | + case Global.ZEN_MODE_NO_INTERRUPTIONS: | |
266 | + zenIconId = R.drawable.stat_sys_dnd_total_silence; | |
267 | + break; | |
268 | + default: | |
269 | + zenIconId = R.drawable.stat_sys_dnd; | |
270 | + break; | |
271 | + } | |
263 | 272 | zenDescription = mContext.getString(R.string.quick_settings_dnd_label); |
264 | 273 | } else if (mZen == Global.ZEN_MODE_NO_INTERRUPTIONS) { |
265 | 274 | zenVisible = true; |