Loading packages/SystemUI/src/com/android/systemui/controls/ControlStatus.kt +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.controls import android.content.ComponentName import android.graphics.drawable.Icon import android.service.controls.Control import android.service.controls.DeviceTypes Loading @@ -28,6 +29,7 @@ interface ControlInterface { val subtitle: CharSequence val removed: Boolean get() = false val customIcon: Icon? @DeviceTypes.DeviceType val deviceType: Int } Loading @@ -46,6 +48,9 @@ data class ControlStatus( override val subtitle: CharSequence get() = control.subtitle override val customIcon: Icon? get() = control.customIcon @DeviceTypes.DeviceType override val deviceType: Int get() = control.deviceType } packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt +10 −6 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ internal class ControlHolder( updateFavorite(!favorite.isChecked) favoriteCallback(wrapper.controlId, favorite.isChecked) } applyRenderInfo(renderInfo, wrapper.deviceType) applyRenderInfo(renderInfo, wrapper) } override fun updateFavorite(favorite: Boolean) { Loading @@ -254,18 +254,22 @@ internal class ControlHolder( return RenderInfo.lookup(itemView.context, component, deviceType) } private fun applyRenderInfo(ri: RenderInfo, @DeviceTypes.DeviceType deviceType: Int) { private fun applyRenderInfo(ri: RenderInfo, ci: ControlInterface) { val context = itemView.context val fg = context.getResources().getColorStateList(ri.foreground, context.getTheme()) ci.customIcon?.let { icon.setImageIcon(it) } ?: run { icon.setImageDrawable(ri.icon) // Do not color app icons if (deviceType != DeviceTypes.TYPE_ROUTINE) { if (ci.deviceType != DeviceTypes.TYPE_ROUTINE) { icon.setImageTintList(fg) } } } } /** * Accessibility delegate for [ControlHolder]. Loading packages/SystemUI/src/com/android/systemui/controls/management/ControlsModel.kt +5 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.controls.management import android.content.ComponentName import android.graphics.drawable.Icon import androidx.recyclerview.widget.RecyclerView import com.android.systemui.controls.ControlInterface import com.android.systemui.controls.ControlStatus Loading Loading @@ -126,6 +127,9 @@ data class ControlInfoWrapper( get() = controlInfo.controlSubtitle override val deviceType: Int get() = controlInfo.deviceType override val customIcon: Icon? // Will need to address to support for edit activity get() = null } data class DividerWrapper( Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ControlStatus.kt +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.controls import android.content.ComponentName import android.graphics.drawable.Icon import android.service.controls.Control import android.service.controls.DeviceTypes Loading @@ -28,6 +29,7 @@ interface ControlInterface { val subtitle: CharSequence val removed: Boolean get() = false val customIcon: Icon? @DeviceTypes.DeviceType val deviceType: Int } Loading @@ -46,6 +48,9 @@ data class ControlStatus( override val subtitle: CharSequence get() = control.subtitle override val customIcon: Icon? get() = control.customIcon @DeviceTypes.DeviceType override val deviceType: Int get() = control.deviceType }
packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt +10 −6 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ internal class ControlHolder( updateFavorite(!favorite.isChecked) favoriteCallback(wrapper.controlId, favorite.isChecked) } applyRenderInfo(renderInfo, wrapper.deviceType) applyRenderInfo(renderInfo, wrapper) } override fun updateFavorite(favorite: Boolean) { Loading @@ -254,18 +254,22 @@ internal class ControlHolder( return RenderInfo.lookup(itemView.context, component, deviceType) } private fun applyRenderInfo(ri: RenderInfo, @DeviceTypes.DeviceType deviceType: Int) { private fun applyRenderInfo(ri: RenderInfo, ci: ControlInterface) { val context = itemView.context val fg = context.getResources().getColorStateList(ri.foreground, context.getTheme()) ci.customIcon?.let { icon.setImageIcon(it) } ?: run { icon.setImageDrawable(ri.icon) // Do not color app icons if (deviceType != DeviceTypes.TYPE_ROUTINE) { if (ci.deviceType != DeviceTypes.TYPE_ROUTINE) { icon.setImageTintList(fg) } } } } /** * Accessibility delegate for [ControlHolder]. Loading
packages/SystemUI/src/com/android/systemui/controls/management/ControlsModel.kt +5 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.controls.management import android.content.ComponentName import android.graphics.drawable.Icon import androidx.recyclerview.widget.RecyclerView import com.android.systemui.controls.ControlInterface import com.android.systemui.controls.ControlStatus Loading Loading @@ -126,6 +127,9 @@ data class ControlInfoWrapper( get() = controlInfo.controlSubtitle override val deviceType: Int get() = controlInfo.deviceType override val customIcon: Icon? // Will need to address to support for edit activity get() = null } data class DividerWrapper( Loading