From 2db461915397e397ddcd9751787c7314d25fb84c Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Wed, 1 Feb 2017 17:18:22 -0500 Subject: [PATCH] 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 --- packages/SystemUI/res/layout/divider.xml | 20 ++++++++++ packages/SystemUI/res/values/config.xml | 2 +- .../com/android/systemui/qs/QSAnimator.java | 1 - .../src/com/android/systemui/qs/QSTile.java | 11 +++-- .../android/systemui/qs/QSTileBaseView.java | 40 ------------------- .../com/android/systemui/qs/QSTileView.java | 4 ++ .../systemui/qs/tiles/BatteryTile.java | 1 + .../systemui/qs/tiles/BluetoothTile.java | 1 + .../android/systemui/qs/tiles/CastTile.java | 1 + .../systemui/qs/tiles/CellularTile.java | 1 + .../android/systemui/qs/tiles/DndTile.java | 1 + .../android/systemui/qs/tiles/WifiTile.java | 1 + 12 files changed, 39 insertions(+), 45 deletions(-) create mode 100644 packages/SystemUI/res/layout/divider.xml diff --git a/packages/SystemUI/res/layout/divider.xml b/packages/SystemUI/res/layout/divider.xml new file mode 100644 index 0000000000000..95814371ed568 --- /dev/null +++ b/packages/SystemUI/res/layout/divider.xml @@ -0,0 +1,20 @@ + + + diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 2f39d1d9cc5a0..d9407ab6b76d1 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -106,7 +106,7 @@ - wifi,cell,battery,dnd,flashlight,rotation,bt,airplane + wifi,cell,bt,dnd,flashlight,rotation,battery,airplane diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java index 602f9bf23cc13..615063ccd0fca 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java @@ -194,7 +194,6 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha translationYBuilder.addFloat(label, "translationY", -yDiff, 0); mTopFiveQs.add(tileView.getIcon()); - mTopFiveQs.add(tileView.getBgCicle()); mAllViews.add(tileView.getIcon()); mAllViews.add(quickTileView); } else if (mFullRows && isIconInAnimatedRow(count)) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index e18654e7253a3..0829ae5f597cf 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -323,9 +323,10 @@ public abstract class QSTile { return Utils.getDisabled(context, Utils.getColorAttr(context, android.R.attr.textColorTertiary)); 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: - return Utils.getColorAttr(context, android.R.attr.colorPrimary); + return Utils.getColorAttr(context, android.R.attr.colorForeground); default: Log.e("QSTile", "Invalid state " + state); return 0; @@ -548,6 +549,7 @@ public abstract class QSTile { public CharSequence minimalContentDescription; public boolean autoMirrorDrawable = true; public boolean disabledByPolicy; + public boolean dualTarget = false; public EnforcedAdmin enforcedAdmin; public String minimalAccessibilityClassName; public String expandedAccessibilityClassName; @@ -569,7 +571,8 @@ public abstract class QSTile { expandedAccessibilityClassName) || !Objects.equals(other.disabledByPolicy, disabledByPolicy) || !Objects.equals(other.state, state) - || !Objects.equals(other.enforcedAdmin, enforcedAdmin); + || !Objects.equals(other.enforcedAdmin, enforcedAdmin) + || !Objects.equals(other.dualTarget, dualTarget); other.icon = icon; other.label = label; other.contentDescription = contentDescription; @@ -580,6 +583,7 @@ public abstract class QSTile { other.autoMirrorDrawable = autoMirrorDrawable; other.disabledByPolicy = disabledByPolicy; other.state = state; + other.dualTarget = dualTarget; if (enforcedAdmin == null) { other.enforcedAdmin = null; } else if (other.enforcedAdmin == null) { @@ -607,6 +611,7 @@ public abstract class QSTile { sb.append(",autoMirrorDrawable=").append(autoMirrorDrawable); sb.append(",disabledByPolicy=").append(disabledByPolicy); sb.append(",enforcedAdmin=").append(enforcedAdmin); + sb.append(",dualTarget=").append(dualTarget); sb.append(",state=").append(state); return sb.append(']'); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java index a177cc3234866..0e04d0a0c825b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileBaseView.java @@ -47,17 +47,12 @@ public class QSTileBaseView extends LinearLayout { private static final String TAG = "QSTileBaseView"; private final H mHandler = new H(); - private final ImageView mBg; protected QSIconView mIcon; protected RippleDrawable mRipple; private Drawable mTileBackground; private String mAccessibilityClass; private boolean mTileState; private boolean mCollapsedView; - private final int mColorActive; - private final int mColorInactive; - private final int mColorDisabled; - private int mCircleColor; public QSTileBaseView(Context context, QSIconView icon) { this(context, icon, false); @@ -72,19 +67,11 @@ public class QSTileBaseView extends LinearLayout { frame.setForegroundGravity(Gravity.CENTER); int size = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_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; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(0, padding, 0, padding); 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(); if (mTileBackground instanceof RippleDrawable) { @@ -100,10 +87,6 @@ public class QSTileBaseView extends LinearLayout { setFocusable(true); } - public View getBgCicle() { - return mBg; - } - protected Drawable newTileBackground() { final int[] attrs = new int[]{android.R.attr.selectableItemBackgroundBorderless}; final TypedArray ta = getContext().obtainStyledAttributes(attrs); @@ -167,16 +150,6 @@ public class QSTileBaseView extends LinearLayout { } 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); if (mCollapsedView && !TextUtils.isEmpty(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() { return mIcon; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index 7126f3c8057fc..232941dc629b7 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -39,6 +39,7 @@ import libcore.util.Objects; /** View that represents a standard quick settings tile. **/ public class QSTileView extends QSTileBaseView { + private final View mDivider; protected TextView mLabel; private ImageView mPadLock; private int mState; @@ -57,6 +58,8 @@ public class QSTileView extends QSTileBaseView { setClickable(true); setId(View.generateViewId()); + mDivider = LayoutInflater.from(context).inflate(R.layout.divider, this, false); + addView(mDivider); createLabel(); setOrientation(VERTICAL); setGravity(Gravity.CENTER); @@ -95,6 +98,7 @@ public class QSTileView extends QSTileBaseView { mState = state.state; mLabel.setText(state.label); } + mDivider.setVisibility(state.dualTarget ? View.VISIBLE : View.INVISIBLE); mLabel.setEnabled(!state.disabledByPolicy); mPadLock.setVisibility(state.disabledByPolicy ? View.VISIBLE : View.GONE); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java index 06f4d9d1467d3..6f1f9774a9c16 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatteryTile.java @@ -118,6 +118,7 @@ public class BatteryTile extends QSTile implements BatteryControll int level = (arg != null) ? (Integer) arg : mLevel; String percentage = NumberFormat.getPercentInstance().format((double) level / 100.0); + state.dualTarget = true; state.state = mCharging ? Tile.STATE_UNAVAILABLE : mPowerSave ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; state.icon = ResourceIcon.get(R.drawable.ic_qs_battery_saver); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java index 91e76cabbc010..4b56ecdfade74 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -115,6 +115,7 @@ public class BluetoothTile extends QSTile { final boolean enabled = mController.isBluetoothEnabled(); final boolean connected = mController.isBluetoothConnected(); final boolean connecting = mController.isBluetoothConnecting(); + state.dualTarget = true; state.value = enabled; state.autoMirrorDrawable = false; state.minimalContentDescription = diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java index 7415765ff2cc8..a4cd14d779260 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java @@ -123,6 +123,7 @@ public class CastTile extends QSTile { @Override protected void handleUpdateState(BooleanState state, Object arg) { + state.dualTarget = true; state.label = mContext.getString(R.string.quick_settings_cast_title); state.contentDescription = state.label; state.value = false; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index bdc95c04dd1e1..bae163fc14513 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -126,6 +126,7 @@ public class CellularTile extends QSTile { } else { state.icon = ResourceIcon.get(iconId); } + state.dualTarget = true; state.isOverlayIconWide = cb.isDataTypeIconWide; state.autoMirrorDrawable = !cb.noSim; state.filter = iconId != R.drawable.ic_qs_no_sim; 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 3c1f50461b634..4072b44423770 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -159,6 +159,7 @@ public class DndTile extends QSTile { final int zen = arg instanceof Integer ? (Integer) arg : mController.getZen(); final boolean newValue = zen != Global.ZEN_MODE_OFF; final boolean valueChanged = state.value != newValue; + state.dualTarget = true; state.value = newValue; state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_ADJUST_VOLUME); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index 2d618576f5a9e..90a9db6b189f9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -150,6 +150,7 @@ public class WifiTile extends QSTile { mDetailAdapter.setItemsVisible(cb.enabled); fireToggleStateChanged(cb.enabled); } + state.dualTarget = true; state.value = cb.enabled; state.connected = wifiConnected; state.activityIn = cb.enabled && cb.activityIn;