Skip to content

Commit

Permalink
Fix app crash when opening "other" widgets, closes #1629
Browse files Browse the repository at this point in the history
Use the correct view binding for the list adapter
  • Loading branch information
klassm committed Sep 18, 2021
1 parent 046a9f6 commit 1c53c15
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.view.View
import android.view.ViewGroup
import li.klass.fhem.R
import li.klass.fhem.appwidget.ui.widget.base.AppWidgetView
import li.klass.fhem.databinding.SimpleListItemBinding
import li.klass.fhem.databinding.OneLineCardBinding

class OtherWidgetsAdapter(elements: List<AppWidgetView>, val callback: (view: AppWidgetView) -> Unit)
: androidx.recyclerview.widget.RecyclerView.Adapter<OtherWidgetsAdapter.ViewHolder>() {
Expand All @@ -23,7 +23,7 @@ class OtherWidgetsAdapter(elements: List<AppWidgetView>, val callback: (view: Ap

class ViewHolder(val view: View, val widgetClickedCallback: (view: AppWidgetView) -> Unit) : androidx.recyclerview.widget.RecyclerView.ViewHolder(view) {
fun bind(appWidgetView: AppWidgetView) {
val binding = SimpleListItemBinding.bind(view)
val binding = OneLineCardBinding.bind(view)
binding.text.text = view.context.getString(appWidgetView.getWidgetName())
binding.root.setOnClickListener { widgetClickedCallback(appWidgetView) }
}
Expand Down
2 changes: 1 addition & 1 deletion app/whatsnew-de.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
TODO
* Fix: App Crash beim Öffnen der "Anderen" Widgets
2 changes: 1 addition & 1 deletion app/whatsnew-en.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
TODO
* Fix app crash when opening "other" widgets

0 comments on commit 1c53c15

Please sign in to comment.