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
This commit is contained in:
20
packages/SystemUI/res/layout/divider.xml
Normal file
20
packages/SystemUI/res/layout/divider.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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" />
|
||||
@@ -106,7 +106,7 @@
|
||||
|
||||
<!-- The default tiles to display in QuickSettings -->
|
||||
<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>
|
||||
|
||||
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -323,9 +323,10 @@ public abstract class QSTile<TState extends State> {
|
||||
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<TState extends State> {
|
||||
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<TState extends State> {
|
||||
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<TState extends State> {
|
||||
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<TState extends State> {
|
||||
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(']');
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ public class BatteryTile extends QSTile<QSTile.State> 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);
|
||||
|
||||
@@ -115,6 +115,7 @@ public class BluetoothTile extends QSTile<QSTile.BooleanState> {
|
||||
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 =
|
||||
|
||||
@@ -123,6 +123,7 @@ public class CastTile extends QSTile<QSTile.BooleanState> {
|
||||
|
||||
@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;
|
||||
|
||||
@@ -126,6 +126,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
|
||||
} 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;
|
||||
|
||||
@@ -159,6 +159,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> {
|
||||
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);
|
||||
|
||||
@@ -150,6 +150,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
|
||||
mDetailAdapter.setItemsVisible(cb.enabled);
|
||||
fireToggleStateChanged(cb.enabled);
|
||||
}
|
||||
state.dualTarget = true;
|
||||
state.value = cb.enabled;
|
||||
state.connected = wifiConnected;
|
||||
state.activityIn = cb.enabled && cb.activityIn;
|
||||
|
||||
Reference in New Issue
Block a user