reset the horizontal scroll state at widget previews

This commit is contained in:
tibbi 2022-09-15 23:38:35 +02:00
parent c2360a120c
commit 2943b83083
2 changed files with 10 additions and 2 deletions

View file

@ -64,6 +64,7 @@ class WidgetsAdapter(
private fun setupListItemsHolder(view: View, listItem: WidgetsListItemsHolder) { private fun setupListItemsHolder(view: View, listItem: WidgetsListItemsHolder) {
view.widget_list_items_holder.removeAllViews() view.widget_list_items_holder.removeAllViews()
view.widget_list_items_scroll_view.scrollX = 0
listItem.widgets.forEachIndexed { index, widget -> listItem.widgets.forEachIndexed { index, widget ->
val imageSize = activity.resources.getDimension(R.dimen.widget_preview_size).toInt() val imageSize = activity.resources.getDimension(R.dimen.widget_preview_size).toInt()
val widgetPreview = LayoutInflater.from(activity).inflate(R.layout.item_widget_preview, null) as ImageView val widgetPreview = LayoutInflater.from(activity).inflate(R.layout.item_widget_preview, null) as ImageView

View file

@ -2,5 +2,12 @@ package com.simplemobiletools.launcher.models
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
data class AppWidget(var appPackageName: String, var appTitle: String, val appIcon: Drawable, val widgetTitle: String, val widgetPreviewImage: Drawable?, var width: Int, val height: Int) : data class AppWidget(
WidgetsListItem() var appPackageName: String,
var appTitle: String,
val appIcon: Drawable,
val widgetTitle: String,
val widgetPreviewImage: Drawable?,
var width: Int,
val height: Int
) : WidgetsListItem()