mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-02-17 20:10:36 +01:00
rely on className instead of shortClassName at widgets
This commit is contained in:
parent
a337f5e081
commit
833a3f0529
@ -95,7 +95,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
|||||||
val widgetPreviewImage = info.loadPreviewImage(context, resources.displayMetrics.densityDpi) ?: appIcon
|
val widgetPreviewImage = info.loadPreviewImage(context, resources.displayMetrics.densityDpi) ?: appIcon
|
||||||
val widthCells = Math.min(COLUMN_COUNT, getTileCount(info.minWidth))
|
val widthCells = Math.min(COLUMN_COUNT, getTileCount(info.minWidth))
|
||||||
val heightCells = Math.min(ROW_COUNT, getTileCount(info.minHeight))
|
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)
|
val widget = AppWidget(appPackageName, appTitle, appIcon, widgetTitle, widgetPreviewImage, widthCells, heightCells, false, className)
|
||||||
appWidgets.add(widget)
|
appWidgets.add(widget)
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
|||||||
appWidget.appPackageName,
|
appWidget.appPackageName,
|
||||||
"",
|
"",
|
||||||
type,
|
type,
|
||||||
appWidget.shortClassName,
|
appWidget.className,
|
||||||
-1,
|
-1,
|
||||||
appWidget.widgetPreviewImage
|
appWidget.widgetPreviewImage
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ data class AppWidget(
|
|||||||
var widthCells: Int,
|
var widthCells: Int,
|
||||||
val heightCells: Int,
|
val heightCells: Int,
|
||||||
val isShortcut: Boolean,
|
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() {
|
) : WidgetsListItem() {
|
||||||
override fun getHashToCompare() = getStringToCompare().hashCode()
|
override fun getHashToCompare() = getStringToCompare().hashCode()
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ data class HomeScreenGridItem(
|
|||||||
@ColumnInfo(name = "package_name") var packageName: String,
|
@ColumnInfo(name = "package_name") var packageName: String,
|
||||||
@ColumnInfo(name = "title") var title: String,
|
@ColumnInfo(name = "title") var title: String,
|
||||||
@ColumnInfo(name = "type") var type: Int,
|
@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,
|
@ColumnInfo(name = "widget_id") var widgetId: Int,
|
||||||
|
|
||||||
@Ignore var drawable: Drawable?
|
@Ignore var drawable: Drawable?
|
||||||
|
@ -287,7 +287,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
|
|||||||
private fun bindWidget(item: HomeScreenGridItem, isInitialDrawAfterLaunch: Boolean) {
|
private fun bindWidget(item: HomeScreenGridItem, isInitialDrawAfterLaunch: Boolean) {
|
||||||
val activity = context as MainActivity
|
val activity = context as MainActivity
|
||||||
val infoList = appWidgetManager!!.installedProviders
|
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) {
|
if (appWidgetProviderInfo != null) {
|
||||||
val appWidgetId = appWidgetHost.allocateAppWidgetId()
|
val appWidgetId = appWidgetHost.allocateAppWidgetId()
|
||||||
activity.handleWidgetBinding(appWidgetManager, appWidgetId, appWidgetProviderInfo) { canBind ->
|
activity.handleWidgetBinding(appWidgetManager, appWidgetId, appWidgetProviderInfo) { canBind ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user