- Remove circles from icons.
- Add lines to indicate tiles with dual tap targets.
- Change default order
Test: visual
Change-Id: I1eb02641757a76ddf3e3876182f7b2503161bc9e
--- /dev/null
+<?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" />
<!-- 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" -->
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)) {
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;
public CharSequence minimalContentDescription;
public boolean autoMirrorDrawable = true;
public boolean disabledByPolicy;
+ public boolean dualTarget = false;
public EnforcedAdmin enforcedAdmin;
public String minimalAccessibilityClassName;
public String expandedAccessibilityClassName;
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;
other.autoMirrorDrawable = autoMirrorDrawable;
other.disabledByPolicy = disabledByPolicy;
other.state = state;
+ other.dualTarget = dualTarget;
if (enforcedAdmin == null) {
other.enforcedAdmin = null;
} else if (other.enforcedAdmin == null) {
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(']');
}
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);
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) {
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);
}
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);
}
}
- 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;
}
/** 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;
setClickable(true);
setId(View.generateViewId());
+ mDivider = LayoutInflater.from(context).inflate(R.layout.divider, this, false);
+ addView(mDivider);
createLabel();
setOrientation(VERTICAL);
setGravity(Gravity.CENTER);
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);
}
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);
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 =
@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;
} 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;
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);
mDetailAdapter.setItemsVisible(cb.enabled);
fireToggleStateChanged(cb.enabled);
}
+ state.dualTarget = true;
state.value = cb.enabled;
state.connected = wifiConnected;
state.activityIn = cb.enabled && cb.activityIn;