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
--- /dev/null
+<!--
+ 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="64dp"
+ android:height="64dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+ <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>
--- /dev/null
+<!--
+ 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:viewportHeight="48"
+ android:viewportWidth="48">
+ <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>
checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_ADJUST_VOLUME);
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);
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;