Fix icon style preview crashing with no previewContext

Make loadModelData use appContext directly for LauncherAppState

Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
Pun Butrach
2025-09-06 19:03:39 +07:00
parent 5973434dcd
commit e8f9c75b2b
@@ -78,10 +78,10 @@ class LauncherPreviewView(
@WorkerThread
private fun loadModelData() {
val widgetHostId = LauncherWidgetHolder.APPWIDGET_HOST_ID
val inflationContext = ContextThemeWrapper(appContext, Themes.getActivityThemeRes(appContext))
LauncherAppState.getInstance(inflationContext).model.loadAsync { dataModel ->
LauncherAppState.getInstance(appContext).model.loadAsync { dataModel ->
if (dataModel != null) {
MAIN_EXECUTOR.execute {
val inflationContext = ContextThemeWrapper(context, Themes.getActivityThemeRes(context))
renderView(inflationContext, dataModel, widgetHostId, null)
}
} else {