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

Commit 2db46191 authored by Jason Monk's avatar Jason Monk
Browse files

QS: Remove circles and add lines

 - Remove circles from icons.
 - Add lines to indicate tiles with dual tap targets.
 - Change default order

Test: visual
Change-Id: I1eb02641757a76ddf3e3876182f7b2503161bc9e
parent 7985f418
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 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.
-->
<View xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="72dp"
    android:layout_height="1dp"
    android:background="?android:attr/colorForeground"
    android:alpha="?android:attr/disabledAlpha" />
+1 −1
Original line number Original line Diff line number Diff line
@@ -106,7 +106,7 @@


    <!-- The default tiles to display in QuickSettings -->
    <!-- The default tiles to display in QuickSettings -->
    <string name="quick_settings_tiles_default" translatable="false">
    <string name="quick_settings_tiles_default" translatable="false">
        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane
        wifi,cell,bt,dnd,flashlight,rotation,battery,airplane
    </string>
    </string>


    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
+0 −1
Original line number Original line Diff line number Diff line
@@ -194,7 +194,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
                translationYBuilder.addFloat(label, "translationY", -yDiff, 0);
                translationYBuilder.addFloat(label, "translationY", -yDiff, 0);


                mTopFiveQs.add(tileView.getIcon());
                mTopFiveQs.add(tileView.getIcon());
                mTopFiveQs.add(tileView.getBgCicle());
                mAllViews.add(tileView.getIcon());
                mAllViews.add(tileView.getIcon());
                mAllViews.add(quickTileView);
                mAllViews.add(quickTileView);
            } else if (mFullRows && isIconInAnimatedRow(count)) {
            } else if (mFullRows && isIconInAnimatedRow(count)) {
+8 −3
Original line number Original line Diff line number Diff line
@@ -323,9 +323,10 @@ public abstract class QSTile<TState extends State> {
                return Utils.getDisabled(context,
                return Utils.getDisabled(context,
                        Utils.getColorAttr(context, android.R.attr.textColorTertiary));
                        Utils.getColorAttr(context, android.R.attr.textColorTertiary));
            case Tile.STATE_INACTIVE:
            case Tile.STATE_INACTIVE:
                return Utils.getColorAttr(context, android.R.attr.textColorSecondary);
                return Utils.getDisabled(context,
                        Utils.getColorAttr(context, android.R.attr.colorForeground));
            case Tile.STATE_ACTIVE:
            case Tile.STATE_ACTIVE:
                return Utils.getColorAttr(context, android.R.attr.colorPrimary);
                return Utils.getColorAttr(context, android.R.attr.colorForeground);
            default:
            default:
                Log.e("QSTile", "Invalid state " + state);
                Log.e("QSTile", "Invalid state " + state);
                return 0;
                return 0;
@@ -548,6 +549,7 @@ public abstract class QSTile<TState extends State> {
        public CharSequence minimalContentDescription;
        public CharSequence minimalContentDescription;
        public boolean autoMirrorDrawable = true;
        public boolean autoMirrorDrawable = true;
        public boolean disabledByPolicy;
        public boolean disabledByPolicy;
        public boolean dualTarget = false;
        public EnforcedAdmin enforcedAdmin;
        public EnforcedAdmin enforcedAdmin;
        public String minimalAccessibilityClassName;
        public String minimalAccessibilityClassName;
        public String expandedAccessibilityClassName;
        public String expandedAccessibilityClassName;
@@ -569,7 +571,8 @@ public abstract class QSTile<TState extends State> {
                    expandedAccessibilityClassName)
                    expandedAccessibilityClassName)
                    || !Objects.equals(other.disabledByPolicy, disabledByPolicy)
                    || !Objects.equals(other.disabledByPolicy, disabledByPolicy)
                    || !Objects.equals(other.state, state)
                    || !Objects.equals(other.state, state)
                    || !Objects.equals(other.enforcedAdmin, enforcedAdmin);
                    || !Objects.equals(other.enforcedAdmin, enforcedAdmin)
                    || !Objects.equals(other.dualTarget, dualTarget);
            other.icon = icon;
            other.icon = icon;
            other.label = label;
            other.label = label;
            other.contentDescription = contentDescription;
            other.contentDescription = contentDescription;
@@ -580,6 +583,7 @@ public abstract class QSTile<TState extends State> {
            other.autoMirrorDrawable = autoMirrorDrawable;
            other.autoMirrorDrawable = autoMirrorDrawable;
            other.disabledByPolicy = disabledByPolicy;
            other.disabledByPolicy = disabledByPolicy;
            other.state = state;
            other.state = state;
            other.dualTarget = dualTarget;
            if (enforcedAdmin == null) {
            if (enforcedAdmin == null) {
                other.enforcedAdmin = null;
                other.enforcedAdmin = null;
            } else if (other.enforcedAdmin == null) {
            } else if (other.enforcedAdmin == null) {
@@ -607,6 +611,7 @@ public abstract class QSTile<TState extends State> {
            sb.append(",autoMirrorDrawable=").append(autoMirrorDrawable);
            sb.append(",autoMirrorDrawable=").append(autoMirrorDrawable);
            sb.append(",disabledByPolicy=").append(disabledByPolicy);
            sb.append(",disabledByPolicy=").append(disabledByPolicy);
            sb.append(",enforcedAdmin=").append(enforcedAdmin);
            sb.append(",enforcedAdmin=").append(enforcedAdmin);
            sb.append(",dualTarget=").append(dualTarget);
            sb.append(",state=").append(state);
            sb.append(",state=").append(state);
            return sb.append(']');
            return sb.append(']');
        }
        }
+0 −40
Original line number Original line Diff line number Diff line
@@ -47,17 +47,12 @@ public class QSTileBaseView extends LinearLayout {


    private static final String TAG = "QSTileBaseView";
    private static final String TAG = "QSTileBaseView";
    private final H mHandler = new H();
    private final H mHandler = new H();
    private final ImageView mBg;
    protected QSIconView mIcon;
    protected QSIconView mIcon;
    protected RippleDrawable mRipple;
    protected RippleDrawable mRipple;
    private Drawable mTileBackground;
    private Drawable mTileBackground;
    private String mAccessibilityClass;
    private String mAccessibilityClass;
    private boolean mTileState;
    private boolean mTileState;
    private boolean mCollapsedView;
    private boolean mCollapsedView;
    private final int mColorActive;
    private final int mColorInactive;
    private final int mColorDisabled;
    private int mCircleColor;


    public QSTileBaseView(Context context, QSIconView icon) {
    public QSTileBaseView(Context context, QSIconView icon) {
        this(context, icon, false);
        this(context, icon, false);
@@ -72,19 +67,11 @@ public class QSTileBaseView extends LinearLayout {
        frame.setForegroundGravity(Gravity.CENTER);
        frame.setForegroundGravity(Gravity.CENTER);
        int size = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size);
        int size = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size);
        addView(frame, new LayoutParams(size, size));
        addView(frame, new LayoutParams(size, size));
        mBg = new ImageView(getContext());
        mBg.setScaleType(ScaleType.FIT_CENTER);
        mBg.setImageResource(R.drawable.ic_qs_circle);
        frame.addView(mBg);
        mIcon = icon;
        mIcon = icon;
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.setMargins(0, padding, 0, padding);
        params.setMargins(0, padding, 0, padding);
        frame.addView(mIcon, params);
        frame.addView(mIcon, params);
        mColorActive = Utils.getColorAttr(context, android.R.attr.textColorPrimary);
        mColorDisabled = Utils.getDisabled(context,
                Utils.getColorAttr(context, android.R.attr.textColorTertiary));
        mColorInactive = Utils.getColorAttr(context, android.R.attr.textColorSecondary);


        mTileBackground = newTileBackground();
        mTileBackground = newTileBackground();
        if (mTileBackground instanceof RippleDrawable) {
        if (mTileBackground instanceof RippleDrawable) {
@@ -100,10 +87,6 @@ public class QSTileBaseView extends LinearLayout {
        setFocusable(true);
        setFocusable(true);
    }
    }


    public View getBgCicle() {
        return mBg;
    }

    protected Drawable newTileBackground() {
    protected Drawable newTileBackground() {
        final int[] attrs = new int[]{android.R.attr.selectableItemBackgroundBorderless};
        final int[] attrs = new int[]{android.R.attr.selectableItemBackgroundBorderless};
        final TypedArray ta = getContext().obtainStyledAttributes(attrs);
        final TypedArray ta = getContext().obtainStyledAttributes(attrs);
@@ -167,16 +150,6 @@ public class QSTileBaseView extends LinearLayout {
    }
    }


    protected void handleStateChanged(QSTile.State state) {
    protected void handleStateChanged(QSTile.State state) {
        int circleColor = getCircleColor(state.state);
        if (circleColor != mCircleColor) {
            if (mBg.isShown()) {
                QSIconView.animateGrayScale(mCircleColor, circleColor, mBg);
            } else {
                QSIconView.setTint(mBg, circleColor);
            }
            mCircleColor = circleColor;
        }

        mIcon.setIcon(state);
        mIcon.setIcon(state);
        if (mCollapsedView && !TextUtils.isEmpty(state.minimalContentDescription)) {
        if (mCollapsedView && !TextUtils.isEmpty(state.minimalContentDescription)) {
            setContentDescription(state.minimalContentDescription);
            setContentDescription(state.minimalContentDescription);
@@ -193,19 +166,6 @@ public class QSTileBaseView extends LinearLayout {
        }
        }
    }
    }


    private int getCircleColor(int state) {
        switch (state) {
            case Tile.STATE_ACTIVE:
                return mColorActive;
            case Tile.STATE_INACTIVE:
            case Tile.STATE_UNAVAILABLE:
                return mColorDisabled;
            default:
                Log.e(TAG, "Invalid state " + state);
                return 0;
        }
    }

    public QSIconView getIcon() {
    public QSIconView getIcon() {
        return mIcon;
        return mIcon;
    }
    }
Loading