diff --git a/lawnchair/src/app/lawnchair/override/CustomizeDialog.kt b/lawnchair/src/app/lawnchair/override/CustomizeDialog.kt index 53a03dba1a..1dab49f0cb 100644 --- a/lawnchair/src/app/lawnchair/override/CustomizeDialog.kt +++ b/lawnchair/src/app/lawnchair/override/CustomizeDialog.kt @@ -148,6 +148,7 @@ fun CustomizeAppDialog( var title by remember { mutableStateOf(prefs.customAppName[componentKey] ?: defaultTitle) } + val launcherAppState = LauncherAppState.getInstance(context) val request = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { if (it.resultCode != Activity.RESULT_OK) return@rememberLauncherForActivityResult @@ -168,7 +169,7 @@ fun CustomizeAppDialog( val newTitle = if (title != defaultTitle) title else null if (newTitle != previousTitle) { prefs.customAppName[componentKey] = newTitle - val model = LauncherAppState.getInstance(context).model + val model = launcherAppState.model model.onAppIconChanged(componentKey.componentName.packageName, componentKey.user) } } diff --git a/lawnchair/src/app/lawnchair/ui/preferences/destinations/SelectIconPreference.kt b/lawnchair/src/app/lawnchair/ui/preferences/destinations/SelectIconPreference.kt index 1cfb6ada15..3e69889b33 100644 --- a/lawnchair/src/app/lawnchair/ui/preferences/destinations/SelectIconPreference.kt +++ b/lawnchair/src/app/lawnchair/ui/preferences/destinations/SelectIconPreference.kt @@ -39,7 +39,8 @@ fun SelectIconPreference(componentKey: ComponentKey) { val iconPacks by LocalPreferenceInteractor.current.iconPacks.collectAsStateWithLifecycle() val navController = LocalNavController.current val scope = rememberCoroutineScope() - val model = LauncherAppState.getInstance(context).model + val launcherAppState = LauncherAppState.getInstance(context) + val model = launcherAppState.model val repo = IconOverrideRepository.INSTANCE.get(context) OnResult { item -> @@ -49,6 +50,7 @@ fun SelectIconPreference(componentKey: ComponentKey) { it.setResult(Activity.RESULT_OK) it.finish() model.onAppIconChanged(componentKey.componentName.packageName, componentKey.user) + launcherAppState.reloadIcons() } } } @@ -68,7 +70,7 @@ fun SelectIconPreference(componentKey: ComponentKey) { it.setResult(Activity.RESULT_OK) it.finish() model.onAppIconChanged(componentKey.componentName.packageName, componentKey.user) - LauncherAppState.INSTANCE.get(context).reloadIcons() + launcherAppState.reloadIcons() } } },