diff options
author | Mike xdnax <mikecoconut5832@gmail.com> | 2015-12-04 01:34:49 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-12-09 14:23:59 -0800 |
commit | 7ea79cf51c98dead5163ea3c35fe823cbc85d4b6 (patch) | |
tree | d332e91ebbf1b33a3ff0db5daf41ebad23234a15 /packages | |
parent | a616e3a243c31af415318aff273103a1bf523258 (diff) | |
download | frameworks_base-7ea79cf51c98dead5163ea3c35fe823cbc85d4b6.zip frameworks_base-7ea79cf51c98dead5163ea3c35fe823cbc85d4b6.tar.gz frameworks_base-7ea79cf51c98dead5163ea3c35fe823cbc85d4b6.tar.bz2 |
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
Diffstat (limited to 'packages')
4 files changed, 65 insertions, 3 deletions
diff --git a/packages/SystemUI/res/drawable/ic_qs_dnd_on_priority.xml b/packages/SystemUI/res/drawable/ic_qs_dnd_on_priority.xml new file mode 100644 index 0000000..f6f3c89 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_qs_dnd_on_priority.xml @@ -0,0 +1,25 @@ +<!-- + 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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:width="64.0dip" + android:height="64.0dip" + android:viewportWidth="48.0" + android:viewportHeight="48.0"> + <path + android:fillColor="#FFFFFFFF" + 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" /> +</vector>
\ No newline at end of file diff --git a/packages/SystemUI/res/drawable/stat_sys_dnd_priority.xml b/packages/SystemUI/res/drawable/stat_sys_dnd_priority.xml new file mode 100644 index 0000000..2664bc6 --- /dev/null +++ b/packages/SystemUI/res/drawable/stat_sys_dnd_priority.xml @@ -0,0 +1,28 @@ +<!-- + 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.5dip" + android:insetRight="2.5dip"> + <vector + android:width="17.0dip" + android:height="17.0dip" + android:viewportHeight="48.0" + android:viewportWidth="48.0"> + <path + android:fillColor="#FFFFFFFF" + 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" /> + </vector> +</inset>
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index 6c40486..0d43f8c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -141,7 +141,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { state.visible = isVisible(mContext); switch (zen) { case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: - state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on); + state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on_priority); state.label = mContext.getString(R.string.quick_settings_dnd_priority_label); state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_dnd_priority_on); 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 adba01f..ee291f5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -269,8 +269,17 @@ public class PhoneStatusBarPolicy implements Callback { if (DndTile.isVisible(mContext) || DndTile.isCombinedIcon(mContext)) { zenVisible = mZen != Global.ZEN_MODE_OFF; - zenIconId = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS - ? R.drawable.stat_sys_dnd_total_silence : R.drawable.stat_sys_dnd; + switch(mZen) { + case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: + zenIconId = R.drawable.stat_sys_dnd_priority; + break; + case Global.ZEN_MODE_NO_INTERRUPTIONS: + zenIconId = R.drawable.stat_sys_dnd_total_silence; + break; + default: + zenIconId = R.drawable.stat_sys_dnd; + break; + } zenDescription = mContext.getString(R.string.quick_settings_dnd_label); } else if (mZen == Global.ZEN_MODE_NO_INTERRUPTIONS) { zenVisible = true; |