if a widget has no preview image, use the app icon

This commit is contained in:
tibbi 2022-09-14 20:55:32 +02:00
parent 716b7fbfec
commit 9455479cd4

View file

@ -49,7 +49,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
val appTitle = appMetadata.appTitle
val appIcon = appMetadata.appIcon
val widgetTitle = info.loadLabel(context.packageManager)
val widgetPreviewImage = info.loadPreviewImage(context, DisplayMetrics.DENSITY_MEDIUM)
val widgetPreviewImage = info.loadPreviewImage(context, DisplayMetrics.DENSITY_MEDIUM) ?: appIcon
val width = info.minWidth
val height = info.minHeight
val widget = AppWidget(appPackageName, appTitle, appIcon, widgetTitle, widgetPreviewImage, width, height)