Loading packages/SystemUI/src/com/android/systemui/controls/ControlStatus.kt +3 −1 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ package com.android.systemui.controls import android.content.ComponentName import android.service.controls.Control data class ControlStatus( val control: Control, val component: ComponentName, var favorite: Boolean, val removed: Boolean = false ) packages/SystemUI/src/com/android/systemui/controls/controller/ControlsControllerImpl.kt +6 −2 Original line number Diff line number Diff line Loading @@ -238,7 +238,11 @@ class ControlsControllerImpl @Inject constructor ( } val removed = findRemoved(favoritesForComponentKeys.toSet(), controls) val controlsWithFavorite = controls.map { ControlStatus(it, it.controlId in favoritesForComponentKeys) ControlStatus( it, componentName, it.controlId in favoritesForComponentKeys ) } val loadData = createLoadDataObject( Favorites.getControlsForComponent(componentName) Loading Loading @@ -290,7 +294,7 @@ class ControlsControllerImpl @Inject constructor ( .setTitle(controlInfo.controlTitle) .setDeviceType(controlInfo.deviceType) .build() return ControlStatus(control, true, setRemoved) return ControlStatus(control, componentName, true, setRemoved) } private fun findRemoved(favoriteKeys: Set<String>, list: List<Control>): Set<String> { Loading packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt +6 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.systemui.controls.management import android.content.ComponentName import android.graphics.Rect import android.graphics.drawable.Icon import android.service.controls.DeviceTypes import android.view.LayoutInflater import android.view.View Loading Loading @@ -147,7 +147,7 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang override fun bindData(wrapper: ElementWrapper) { wrapper as ControlWrapper val data = wrapper.controlStatus val renderInfo = getRenderInfo(data.control.deviceType) val renderInfo = getRenderInfo(data.component, data.control.deviceType) title.text = data.control.title subtitle.text = data.control.subtitle favorite.isChecked = data.favorite Loading @@ -160,16 +160,17 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang } private fun getRenderInfo( component: ComponentName, @DeviceTypes.DeviceType deviceType: Int ): RenderInfo { return RenderInfo.lookup(deviceType, true) return RenderInfo.lookup(itemView.context, component, deviceType, true) } private fun applyRenderInfo(ri: RenderInfo) { val context = itemView.context val fg = context.getResources().getColorStateList(ri.foreground, context.getTheme()) icon.setImageIcon(Icon.createWithResource(context, ri.iconResourceId)) icon.setImageDrawable(ri.icon) icon.setImageTintList(fg) } } Loading packages/SystemUI/src/com/android/systemui/controls/management/ControlsRequestDialog.kt +3 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.app.Dialog import android.content.ComponentName import android.content.DialogInterface import android.content.Intent import android.graphics.drawable.Icon import android.os.Bundle import android.os.UserHandle import android.service.controls.Control Loading Loading @@ -137,11 +136,10 @@ class ControlsRequestDialog @Inject constructor( } fun createDialog(label: CharSequence): Dialog { val renderInfo = RenderInfo.lookup(control.deviceType, true) val renderInfo = RenderInfo.lookup(this, component, control.deviceType, true) val frame = LayoutInflater.from(this).inflate(R.layout.controls_dialog, null).apply { requireViewById<ImageView>(R.id.icon).apply { setImageIcon(Icon.createWithResource(context, renderInfo.iconResourceId)) setImageDrawable(renderInfo.icon) setImageTintList( context.resources.getColorStateList(renderInfo.foreground, context.theme)) } Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.PendingIntent import android.content.Intent import android.provider.Settings import android.service.controls.actions.BooleanAction import android.service.controls.actions.CommandAction import android.util.Log import android.view.HapticFeedbackConstants Loading @@ -36,6 +37,10 @@ object ControlActionCoordinator { cvh.clipLayer.setLevel(nextLevel) } fun touch(cvh: ControlViewHolder, templateId: String) { cvh.action(CommandAction(templateId)) } fun longPress(cvh: ControlViewHolder) { // Long press snould only be called when there is valid control state, otherwise ignore cvh.cws.control?.let { Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ControlStatus.kt +3 −1 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ package com.android.systemui.controls import android.content.ComponentName import android.service.controls.Control data class ControlStatus( val control: Control, val component: ComponentName, var favorite: Boolean, val removed: Boolean = false )
packages/SystemUI/src/com/android/systemui/controls/controller/ControlsControllerImpl.kt +6 −2 Original line number Diff line number Diff line Loading @@ -238,7 +238,11 @@ class ControlsControllerImpl @Inject constructor ( } val removed = findRemoved(favoritesForComponentKeys.toSet(), controls) val controlsWithFavorite = controls.map { ControlStatus(it, it.controlId in favoritesForComponentKeys) ControlStatus( it, componentName, it.controlId in favoritesForComponentKeys ) } val loadData = createLoadDataObject( Favorites.getControlsForComponent(componentName) Loading Loading @@ -290,7 +294,7 @@ class ControlsControllerImpl @Inject constructor ( .setTitle(controlInfo.controlTitle) .setDeviceType(controlInfo.deviceType) .build() return ControlStatus(control, true, setRemoved) return ControlStatus(control, componentName, true, setRemoved) } private fun findRemoved(favoriteKeys: Set<String>, list: List<Control>): Set<String> { Loading
packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt +6 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.systemui.controls.management import android.content.ComponentName import android.graphics.Rect import android.graphics.drawable.Icon import android.service.controls.DeviceTypes import android.view.LayoutInflater import android.view.View Loading Loading @@ -147,7 +147,7 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang override fun bindData(wrapper: ElementWrapper) { wrapper as ControlWrapper val data = wrapper.controlStatus val renderInfo = getRenderInfo(data.control.deviceType) val renderInfo = getRenderInfo(data.component, data.control.deviceType) title.text = data.control.title subtitle.text = data.control.subtitle favorite.isChecked = data.favorite Loading @@ -160,16 +160,17 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang } private fun getRenderInfo( component: ComponentName, @DeviceTypes.DeviceType deviceType: Int ): RenderInfo { return RenderInfo.lookup(deviceType, true) return RenderInfo.lookup(itemView.context, component, deviceType, true) } private fun applyRenderInfo(ri: RenderInfo) { val context = itemView.context val fg = context.getResources().getColorStateList(ri.foreground, context.getTheme()) icon.setImageIcon(Icon.createWithResource(context, ri.iconResourceId)) icon.setImageDrawable(ri.icon) icon.setImageTintList(fg) } } Loading
packages/SystemUI/src/com/android/systemui/controls/management/ControlsRequestDialog.kt +3 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.app.Dialog import android.content.ComponentName import android.content.DialogInterface import android.content.Intent import android.graphics.drawable.Icon import android.os.Bundle import android.os.UserHandle import android.service.controls.Control Loading Loading @@ -137,11 +136,10 @@ class ControlsRequestDialog @Inject constructor( } fun createDialog(label: CharSequence): Dialog { val renderInfo = RenderInfo.lookup(control.deviceType, true) val renderInfo = RenderInfo.lookup(this, component, control.deviceType, true) val frame = LayoutInflater.from(this).inflate(R.layout.controls_dialog, null).apply { requireViewById<ImageView>(R.id.icon).apply { setImageIcon(Icon.createWithResource(context, renderInfo.iconResourceId)) setImageDrawable(renderInfo.icon) setImageTintList( context.resources.getColorStateList(renderInfo.foreground, context.theme)) } Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.PendingIntent import android.content.Intent import android.provider.Settings import android.service.controls.actions.BooleanAction import android.service.controls.actions.CommandAction import android.util.Log import android.view.HapticFeedbackConstants Loading @@ -36,6 +37,10 @@ object ControlActionCoordinator { cvh.clipLayer.setLevel(nextLevel) } fun touch(cvh: ControlViewHolder, templateId: String) { cvh.action(CommandAction(templateId)) } fun longPress(cvh: ControlViewHolder) { // Long press snould only be called when there is valid control state, otherwise ignore cvh.cws.control?.let { Loading