Merge "Update tint of device details icon" into main

This commit is contained in:
Haijie Hong
2025-03-19 04:42:16 -07:00
committed by Android (Google) Code Review

View File

@@ -265,12 +265,10 @@ class DeviceDetailsFragmentFormatterImpl(
summary = model.summary summary = model.summary
icon = getDrawable(model.icon) icon = getDrawable(model.icon)
onPreferenceClickListener = onPreferenceClickListener =
object : Preference.OnPreferenceClickListener { Preference.OnPreferenceClickListener {
override fun onPreferenceClick(p: Preference): Boolean {
logItemClick(prefKey, EVENT_CLICK_PRIMARY) logItemClick(prefKey, EVENT_CLICK_PRIMARY)
model.action?.let { triggerAction(it) } model.action?.let { triggerAction(it) }
return true true
}
} }
} }
} }
@@ -313,12 +311,10 @@ class DeviceDetailsFragmentFormatterImpl(
isEnabled = !model.disabled isEnabled = !model.disabled
isSwitchEnabled = !model.disabled isSwitchEnabled = !model.disabled
onPreferenceClickListener = onPreferenceClickListener =
object : Preference.OnPreferenceClickListener { Preference.OnPreferenceClickListener {
override fun onPreferenceClick(p: Preference): Boolean {
logItemClick(prefKey, EVENT_CLICK_PRIMARY) logItemClick(prefKey, EVENT_CLICK_PRIMARY)
triggerAction(model.action) triggerAction(model.action)
return true true
}
} }
onPreferenceChangeListener = onPreferenceChangeListener =
object : Preference.OnPreferenceChangeListener { object : Preference.OnPreferenceChangeListener {
@@ -389,6 +385,12 @@ class DeviceDetailsFragmentFormatterImpl(
deviceSettingIcon.bitmap.toDrawable(context.resources) deviceSettingIcon.bitmap.toDrawable(context.resources)
is DeviceSettingIcon.ResourceIcon -> context.getDrawable(deviceSettingIcon.resId) is DeviceSettingIcon.ResourceIcon -> context.getDrawable(deviceSettingIcon.resId)
null -> null null -> null
}?.apply {
setTint(
context.getColor(
com.android.settingslib.widget.theme.R.color.settingslib_materialColorOnSurfaceVariant
)
)
} }
@Composable @Composable