Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ea79cf5 authored by Mike xdnax's avatar Mike xdnax Committed by Gerrit Code Review
Browse files

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
parent a616e3a2
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<!--
    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
+28 −0
Original line number Diff line number Diff line
<!--
    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
+1 −1
Original line number Diff line number Diff line
@@ -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);
+11 −2
Original line number Diff line number Diff line
@@ -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;