From 833a3f052935d1927e569bc287a24ef14a88b279 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 1 Oct 2022 10:23:05 +0200 Subject: [PATCH] rely on className instead of shortClassName at widgets --- .../simplemobiletools/launcher/fragments/WidgetsFragment.kt | 4 ++-- .../kotlin/com/simplemobiletools/launcher/models/AppWidget.kt | 2 +- .../simplemobiletools/launcher/models/HomeScreenGridItem.kt | 2 +- .../com/simplemobiletools/launcher/views/HomeScreenGrid.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt index f25deb0..c8a3bcf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt @@ -95,7 +95,7 @@ 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 className = info.provider.shortClassName + val className = info.provider.className val widget = AppWidget(appPackageName, appTitle, appIcon, widgetTitle, widgetPreviewImage, widthCells, heightCells, false, className) appWidgets.add(widget) } @@ -239,7 +239,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment appWidget.appPackageName, "", type, - appWidget.shortClassName, + appWidget.className, -1, appWidget.widgetPreviewImage ) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/models/AppWidget.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/models/AppWidget.kt index 6e3134a..7404987 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/models/AppWidget.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/models/AppWidget.kt @@ -11,7 +11,7 @@ data class AppWidget( var widthCells: Int, val heightCells: Int, val isShortcut: Boolean, - val shortClassName: String // identifier to know which app widget are we using + val className: String // identifier to know which app widget are we using ) : WidgetsListItem() { override fun getHashToCompare() = getStringToCompare().hashCode() diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/models/HomeScreenGridItem.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/models/HomeScreenGridItem.kt index 6b60f16..0411504 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/models/HomeScreenGridItem.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/models/HomeScreenGridItem.kt @@ -17,7 +17,7 @@ data class HomeScreenGridItem( @ColumnInfo(name = "package_name") var packageName: String, @ColumnInfo(name = "title") var title: String, @ColumnInfo(name = "type") var type: Int, - @ColumnInfo(name = "short_class_name") var shortClassName: String, + @ColumnInfo(name = "class_name") var className: String, @ColumnInfo(name = "widget_id") var widgetId: Int, @Ignore var drawable: Drawable? diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt index 71d8c52..aeec1b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt @@ -287,7 +287,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel private fun bindWidget(item: HomeScreenGridItem, isInitialDrawAfterLaunch: Boolean) { val activity = context as MainActivity val infoList = appWidgetManager!!.installedProviders - val appWidgetProviderInfo = infoList.firstOrNull { it.provider.shortClassName == item.shortClassName } + val appWidgetProviderInfo = infoList.firstOrNull { it.provider.className == item.className } if (appWidgetProviderInfo != null) { val appWidgetId = appWidgetHost.allocateAppWidgetId() activity.handleWidgetBinding(appWidgetManager, appWidgetId, appWidgetProviderInfo) { canBind ->