Merge "Fix App List pages flickers"

This commit is contained in:
Chaohui Wang
2023-02-13 09:41:17 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 10 deletions

View File

@@ -159,7 +159,7 @@ private fun <T : AppRecord> AppListModel<T>.AppListWidget(
}
private fun <T : AppRecord> T.itemKey(option: Int) =
listOf(option, app.packageName, app.userId, System.identityHashCode(this))
listOf(option, app.packageName, app.userId)
/** Returns group title if this is the first item of the group. */
private fun <T : AppRecord> AppListModel<T>.getGroupTitleIfFirst(

View File

@@ -2,7 +2,6 @@ package com.android.settingslib.spaprivileged.template.app
import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.runtime.remember
import com.android.settingslib.spa.framework.theme.SettingsDimension
import com.android.settingslib.spa.widget.preference.SwitchPreferenceModel
import com.android.settingslib.spa.widget.preference.TwoTargetSwitchPreference
@@ -16,14 +15,12 @@ fun <T : AppRecord> AppListItemModel<T>.AppListSwitchItem(
onCheckedChange: ((newChecked: Boolean) -> Unit)?,
) {
TwoTargetSwitchPreference(
model = remember {
object : SwitchPreferenceModel {
override val title = label
override val summary = this@AppListSwitchItem.summary
override val checked = checked
override val changeable = changeable
override val onCheckedChange = onCheckedChange
}
model = object : SwitchPreferenceModel {
override val title = label
override val summary = this@AppListSwitchItem.summary
override val checked = checked
override val changeable = changeable
override val onCheckedChange = onCheckedChange
},
icon = { AppIcon(record.app, SettingsDimension.appIconItemSize) },
onClick = onClick,