Controls UI - Fix routine icons

App icons may not respond well to tinting, as currently defined, and
the spec calls for them to remain untouched. Make sure to limit the
icon size.

Bug: 152397193
Test: visual

Change-Id: I36afecfc440fb82814c5bd00ca20e4d71ce40789
This commit is contained in:
Matt Pietal
2020-03-26 08:48:50 -04:00
parent 5e8e9e5f1a
commit f8cc0fa2ad
4 changed files with 10 additions and 4 deletions

View File

@@ -30,8 +30,8 @@
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/control_icon_size"
android:layout_height="@dimen/control_icon_size"
android:paddingTop="@dimen/control_padding_adjustment"
android:clickable="false"
android:focusable="false"

View File

@@ -1225,6 +1225,7 @@
<dimen name="controls_top_margin">44dp</dimen>
<dimen name="control_header_text_size">22sp</dimen>
<dimen name="control_text_size">14sp</dimen>
<dimen name="control_icon_size">24dp</dimen>
<dimen name="control_spacing">4dp</dimen>
<dimen name="control_list_divider">1dp</dimen>
<dimen name="control_corner_radius">12dp</dimen>

View File

@@ -21,6 +21,7 @@ import android.graphics.drawable.ClipDrawable
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.LayerDrawable
import android.service.controls.Control
import android.service.controls.DeviceTypes
import android.service.controls.actions.ControlAction
import android.service.controls.templates.ControlTemplate
import android.service.controls.templates.StatelessTemplate
@@ -156,7 +157,11 @@ class ControlViewHolder(
statusExtra.setTextColor(fg)
icon.setImageDrawable(ri.icon)
icon.setImageTintList(fg)
// do not color app icons
if (deviceType != DeviceTypes.TYPE_ROUTINE) {
icon.setImageTintList(fg)
}
(clipLayer.getDrawable() as GradientDrawable).apply {
setColor(context.getResources().getColor(bg, context.getTheme()))

View File

@@ -64,7 +64,7 @@ data class RenderInfo(
val iconState = deviceIconMap.getValue(iconKey)
val resourceId = iconState[enabled]
var icon: Drawable? = null
var icon: Drawable?
if (resourceId == APP_ICON_ID) {
icon = appIconMap.get(componentName)
if (icon == null) {