Update for AppListItem
Bug: 260660819 Test: Manually with Settings Change-Id: I67b8ff2d8e280c18e191c63ca891a8d7d3706aed
This commit is contained in:
@@ -64,10 +64,9 @@ private fun AllAppListPage() {
|
|||||||
listModel = remember { AllAppListModel() },
|
listModel = remember { AllAppListModel() },
|
||||||
showInstantApps = true,
|
showInstantApps = true,
|
||||||
moreOptions = { ResetAppPreferences(resetAppDialogPresenter::open) }
|
moreOptions = { ResetAppPreferences(resetAppDialogPresenter::open) }
|
||||||
) { itemModel ->
|
) {
|
||||||
AppListItem(
|
AppListItem(
|
||||||
itemModel = itemModel,
|
onClick = AppInfoSettingsProvider.navigator(app = record.app),
|
||||||
onClick = AppInfoSettingsProvider.navigator(app = itemModel.record.app),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ object UsageStatsPageProvider : SettingsPageProvider {
|
|||||||
title = stringResource(R.string.testing_usage_stats),
|
title = stringResource(R.string.testing_usage_stats),
|
||||||
listModel = rememberContext(::UsageStatsListModel),
|
listModel = rememberContext(::UsageStatsListModel),
|
||||||
primaryUserOnly = true,
|
primaryUserOnly = true,
|
||||||
) { itemModel ->
|
) { AppListItem {} }
|
||||||
AppListItem(itemModel) {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ object AppListNotificationsPageProvider : SettingsPageProvider {
|
|||||||
AppListPage(
|
AppListPage(
|
||||||
title = stringResource(R.string.app_notifications_title),
|
title = stringResource(R.string.app_notifications_title),
|
||||||
listModel = rememberContext(::AppNotificationsListModel),
|
listModel = rememberContext(::AppNotificationsListModel),
|
||||||
) {
|
) { AppNotificationsItem() }
|
||||||
AppNotificationsItem(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -62,24 +60,21 @@ object AppListNotificationsPageProvider : SettingsPageProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AppNotificationsItem(
|
private fun AppListItemModel<AppNotificationsRecord>.AppNotificationsItem() {
|
||||||
itemModel: AppListItemModel<AppNotificationsRecord>,
|
|
||||||
) {
|
|
||||||
val appNotificationsRepository = rememberContext(::AppNotificationRepository)
|
val appNotificationsRepository = rememberContext(::AppNotificationRepository)
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
AppListSwitchItem(
|
AppListSwitchItem(
|
||||||
itemModel = itemModel,
|
|
||||||
onClick = {
|
onClick = {
|
||||||
navigateToAppNotificationSettings(
|
navigateToAppNotificationSettings(
|
||||||
context = context,
|
context = context,
|
||||||
app = itemModel.record.app,
|
app = record.app,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
checked = itemModel.record.controller.isEnabled.observeAsState(),
|
checked = record.controller.isEnabled.observeAsState(),
|
||||||
changeable = produceState(initialValue = false) {
|
changeable = produceState(initialValue = false) {
|
||||||
value = appNotificationsRepository.isChangeable(itemModel.record.app)
|
value = appNotificationsRepository.isChangeable(record.app)
|
||||||
},
|
},
|
||||||
onCheckedChange = itemModel.record.controller::setEnabled,
|
onCheckedChange = record.controller::setEnabled,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ object AppLanguagesPageProvider : SettingsPageProvider {
|
|||||||
SettingsBody(stringResource(R.string.desc_app_locale_selection_supported))
|
SettingsBody(stringResource(R.string.desc_app_locale_selection_supported))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
) {
|
) { AppLanguageItem() }
|
||||||
AppLanguageItem(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -68,16 +66,13 @@ object AppLanguagesPageProvider : SettingsPageProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AppLanguageItem(itemModel: AppListItemModel<AppLanguagesRecord>) {
|
private fun AppListItemModel<AppLanguagesRecord>.AppLanguageItem() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
AppListItem(
|
AppListItem {
|
||||||
itemModel = itemModel,
|
|
||||||
onClick = {
|
|
||||||
val intent = Intent(context, AppLocalePickerActivity::class.java).apply {
|
val intent = Intent(context, AppLocalePickerActivity::class.java).apply {
|
||||||
setData(Uri.parse("package:${itemModel.record.app.packageName}"))
|
data = Uri.parse("package:${record.app.packageName}")
|
||||||
putExtra("uid", itemModel.record.app.uid)
|
putExtra("uid", record.app.uid)
|
||||||
}
|
}
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
)
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user