widget: async update

This commit is contained in:
Thibault Deckers 2024-07-08 20:37:40 +02:00
parent b743d0de47
commit 22eee299c5

View file

@ -41,12 +41,16 @@ class HomeWidgetProvider : AppWidgetProvider() {
for (widgetId in appWidgetIds) { for (widgetId in appWidgetIds) {
val widgetInfo = appWidgetManager.getAppWidgetOptions(widgetId) val widgetInfo = appWidgetManager.getAppWidgetOptions(widgetId)
defaultScope.launch { goAsync().run {
val backgroundProps = getProps(context, widgetId, widgetInfo, drawEntryImage = false) defaultScope.launch {
updateWidgetImage(context, appWidgetManager, widgetId, backgroundProps) val backgroundProps = getProps(context, widgetId, widgetInfo, drawEntryImage = false)
updateWidgetImage(context, appWidgetManager, widgetId, backgroundProps)
val imageProps = getProps(context, widgetId, widgetInfo, drawEntryImage = true, reuseEntry = false) val imageProps = getProps(context, widgetId, widgetInfo, drawEntryImage = true, reuseEntry = false)
updateWidgetImage(context, appWidgetManager, widgetId, imageProps) updateWidgetImage(context, appWidgetManager, widgetId, imageProps)
finish()
}
} }
} }
} }