From fbb56780aded378d87803d3d586ad008c3254667 Mon Sep 17 00:00:00 2001 From: mueller-ma Date: Tue, 18 Jul 2023 10:17:59 +0200 Subject: [PATCH] Show label and icon for all Widgets Closes #3421 --- .idea/kotlinc.xml | 2 +- .../org/openhab/habdroid/ui/WidgetAdapter.kt | 6 ++-- .../main/res/layout/widgetlist_chartitem.xml | 29 +++++++++++++------ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 217e5c51fbf..fdf8d994a65 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/mobile/src/main/java/org/openhab/habdroid/ui/WidgetAdapter.kt b/mobile/src/main/java/org/openhab/habdroid/ui/WidgetAdapter.kt index 9591a724ddd..f119a9c427a 100644 --- a/mobile/src/main/java/org/openhab/habdroid/ui/WidgetAdapter.kt +++ b/mobile/src/main/java/org/openhab/habdroid/ui/WidgetAdapter.kt @@ -453,16 +453,14 @@ class WidgetAdapter( initData: ViewHolderInitData, @LayoutRes layoutResId: Int, @LayoutRes compactModeLayoutResId: Int = layoutResId - ) : ViewHolder(initData, layoutResId, compactModeLayoutResId) { - protected var boundWidget: Widget? = null - private set + ) : LabeledItemBaseViewHolder(initData, layoutResId, compactModeLayoutResId) { protected val widgetContentView: View = itemView.findViewById(R.id.widget_content) private val dataSaverView: View = itemView.findViewById(R.id.data_saver) private val dataSaverButton: Button = itemView.findViewById(R.id.data_saver_button) private val dataSaverHint: TextView = itemView.findViewById(R.id.data_saver_hint) override fun bind(widget: Widget) { - boundWidget = widget + super.bind(widget) if (!showDataSaverPlaceholderIfNeeded(widget, canBindWithoutDataTransfer(widget))) { bindAfterDataSaverCheck(widget) } diff --git a/mobile/src/main/res/layout/widgetlist_chartitem.xml b/mobile/src/main/res/layout/widgetlist_chartitem.xml index 2d96714f465..5cdc8d7d672 100644 --- a/mobile/src/main/res/layout/widgetlist_chartitem.xml +++ b/mobile/src/main/res/layout/widgetlist_chartitem.xml @@ -1,20 +1,31 @@ - - + + + android:descendantFocusability="blocksDescendants"> + + + + + + - - +