Fix colors for a11y
Use the new color spec. Use textColor_Inverse for textColor_onAccent, as they are the same in QS. Also, fix a bug where we were calling the wrong method to obtain color for secondary label. Fixes: 187918647 Fixes: 187489493 Test: manual Change-Id: I2f2b62deacfa81e37854a0f9a534eca1713da1ae
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
android:right="@dimen/rounded_slider_icon_inset">
|
||||
<com.android.systemui.util.AlphaTintDrawableWrapper
|
||||
android:drawable="@drawable/ic_brightness"
|
||||
android:tint="?android:attr/colorBackground"
|
||||
android:alpha="0.8"/>
|
||||
android:tint="?android:attr/textColorPrimaryInverse"
|
||||
/>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -34,7 +34,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="@color/qs_footer_action_border"/>
|
||||
<stroke android:width="1dp" android:color="?android:attr/colorBackground"/>
|
||||
<corners android:radius="@dimen/qs_footer_action_corner_radius"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
android:focusable="true"
|
||||
android:padding="@dimen/qs_footer_icon_padding"
|
||||
android:src="@*android:drawable/ic_mode_edit"
|
||||
android:tint="?android:attr/colorForeground" />
|
||||
android:tint="?android:attr/textColorPrimary" />
|
||||
|
||||
<com.android.systemui.statusbar.phone.MultiUserSwitch
|
||||
android:id="@+id/multi_user_switch"
|
||||
@@ -126,7 +126,7 @@
|
||||
android:padding="@dimen/qs_footer_icon_padding"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_settings"
|
||||
android:tint="?android:attr/colorForeground" />
|
||||
android:tint="?android:attr/textColorPrimary" />
|
||||
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||
android:id="@+id/tuner_icon"
|
||||
@@ -152,7 +152,7 @@
|
||||
android:padding="@dimen/qs_footer_icon_padding"
|
||||
android:src="@*android:drawable/ic_lock_power_off"
|
||||
android:contentDescription="@string/accessibility_quick_settings_power_menu"
|
||||
android:tint="?android:attr/colorForeground" />
|
||||
android:tint="?android:attr/textColorPrimary" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
<color name="status_bar_clock_color">#FFFFFFFF</color>
|
||||
<color name="qs_user_detail_icon_muted">#FFFFFFFF</color> <!-- not so muted after all -->
|
||||
<color name="qs_tile_disabled_color">#9E9E9E</color> <!-- 38% black -->
|
||||
<color name="qs_footer_action_border">#2E312C</color>
|
||||
|
||||
<!-- The color of the background in the separated list of the Global Actions menu -->
|
||||
<color name="global_actions_separated_background">#F5F5F5</color>
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.QS.Status.NoCarrierText">
|
||||
<item name="android:textColor">?android:attr/textColorTertiary</item>
|
||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.QS.Build">
|
||||
|
||||
@@ -244,11 +244,13 @@ public class QSIconViewImpl extends QSIconView {
|
||||
public static int getIconColorForState(Context context, int state) {
|
||||
switch (state) {
|
||||
case Tile.STATE_UNAVAILABLE:
|
||||
return Utils.getColorAttrDefaultColor(context, android.R.attr.textColorTertiary);
|
||||
return Utils.applyAlpha(QSTileViewImpl.UNAVAILABLE_ALPHA,
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary));
|
||||
case Tile.STATE_INACTIVE:
|
||||
return Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary);
|
||||
case Tile.STATE_ACTIVE:
|
||||
return Utils.getColorAttrDefaultColor(context, android.R.attr.colorPrimary);
|
||||
return Utils.getColorAttrDefaultColor(context,
|
||||
android.R.attr.textColorPrimaryInverse);
|
||||
default:
|
||||
Log.e("QSIconView", "Invalid state " + state);
|
||||
return 0;
|
||||
|
||||
@@ -61,6 +61,7 @@ open class QSTileViewImpl @JvmOverloads constructor(
|
||||
private const val LABEL_NAME = "label"
|
||||
private const val SECONDARY_LABEL_NAME = "secondaryLabel"
|
||||
private const val CHEVRON_NAME = "chevron"
|
||||
const val UNAVAILABLE_ALPHA = 0.3f
|
||||
}
|
||||
|
||||
override var heightOverride: Int = HeightOverrideable.NO_OVERRIDE
|
||||
@@ -68,15 +69,20 @@ open class QSTileViewImpl @JvmOverloads constructor(
|
||||
private val colorActive = Utils.getColorAttrDefaultColor(context,
|
||||
com.android.internal.R.attr.colorAccentPrimary)
|
||||
private val colorInactive = Utils.getColorAttrDefaultColor(context, R.attr.offStateColor)
|
||||
private val colorUnavailable =
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.colorBackground)
|
||||
private val colorUnavailable = Utils.applyAlpha(UNAVAILABLE_ALPHA, colorInactive)
|
||||
|
||||
private val colorLabelActive =
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimaryInverse)
|
||||
private val colorLabelInactive =
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
|
||||
private val colorLabelUnavailable =
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorTertiary)
|
||||
private val colorLabelUnavailable = Utils.applyAlpha(UNAVAILABLE_ALPHA, colorLabelInactive)
|
||||
|
||||
private val colorSecondaryLabelActive =
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondaryInverse)
|
||||
private val colorSecondaryLabelInactive =
|
||||
Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondary)
|
||||
private val colorSecondaryLabelUnavailable =
|
||||
Utils.applyAlpha(UNAVAILABLE_ALPHA, colorSecondaryLabelInactive)
|
||||
|
||||
private lateinit var label: TextView
|
||||
protected lateinit var secondaryLabel: TextView
|
||||
@@ -404,7 +410,7 @@ open class QSTileViewImpl @JvmOverloads constructor(
|
||||
),
|
||||
colorValuesHolder(
|
||||
SECONDARY_LABEL_NAME,
|
||||
label.currentTextColor,
|
||||
secondaryLabel.currentTextColor,
|
||||
getSecondaryLabelColorForState(state.state)
|
||||
),
|
||||
colorValuesHolder(
|
||||
@@ -418,7 +424,7 @@ open class QSTileViewImpl @JvmOverloads constructor(
|
||||
setAllColors(
|
||||
getBackgroundColorForState(state.state),
|
||||
getLabelColorForState(state.state),
|
||||
getLabelColorForState(state.state),
|
||||
getSecondaryLabelColorForState(state.state),
|
||||
getChevronColorForState(state.state)
|
||||
)
|
||||
}
|
||||
@@ -533,8 +539,9 @@ open class QSTileViewImpl @JvmOverloads constructor(
|
||||
|
||||
private fun getSecondaryLabelColorForState(state: Int): Int {
|
||||
return when (state) {
|
||||
Tile.STATE_ACTIVE -> colorLabelActive
|
||||
Tile.STATE_INACTIVE, Tile.STATE_UNAVAILABLE -> colorLabelUnavailable
|
||||
Tile.STATE_ACTIVE -> colorSecondaryLabelActive
|
||||
Tile.STATE_INACTIVE -> colorSecondaryLabelInactive
|
||||
Tile.STATE_UNAVAILABLE -> colorSecondaryLabelUnavailable
|
||||
else -> {
|
||||
Log.e(TAG, "Invalid state $state")
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user