mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-02-16 11:31:46 +01:00
pass the proper context at creating widgets
This commit is contained in:
parent
624cc02299
commit
0bb2c1066e
@ -95,8 +95,8 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
||||
val widgetPreviewImage = info.loadPreviewImage(context, resources.displayMetrics.densityDpi) ?: appIcon
|
||||
val widthCells = Math.min(COLUMN_COUNT, getTileCount(info.minWidth))
|
||||
val heightCells = Math.min(ROW_COUNT, getTileCount(info.minHeight))
|
||||
val widget =
|
||||
AppWidget(appPackageName, appTitle, appIcon, widgetTitle, widgetPreviewImage, widthCells, heightCells, false, info.provider.shortClassName)
|
||||
val className = info.provider.shortClassName
|
||||
val widget = AppWidget(appPackageName, appTitle, appIcon, widgetTitle, widgetPreviewImage, widthCells, heightCells, false, className)
|
||||
appWidgets.add(widget)
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
|
||||
null
|
||||
)
|
||||
} else {
|
||||
val widgetView = appWidgetHost.createView(context, appWidgetId, appWidgetProviderInfo) as MyAppWidgetHostView
|
||||
// we have to pass the base context here, else there will be errors with the themes
|
||||
val widgetView = appWidgetHost.createView(activity.baseContext, appWidgetId, appWidgetProviderInfo) as MyAppWidgetHostView
|
||||
widgetView.setAppWidget(appWidgetId, appWidgetProviderInfo)
|
||||
|
||||
widgetView.x = item.left * rowWidth + sideMargins.left.toFloat()
|
||||
|
Loading…
x
Reference in New Issue
Block a user