Skip to content

Commit

Permalink
Show label and icon for all Widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
mueller-ma committed Jul 18, 2023
1 parent fa27b14 commit fbb5678
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions mobile/src/main/java/org/openhab/habdroid/ui/WidgetAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
29 changes: 20 additions & 9 deletions mobile/src/main/res/layout/widgetlist_chartitem.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
style="@style/WidgetListItemContainer">

<org.openhab.habdroid.ui.widget.WidgetImageView
android:id="@+id/widget_content"
<include layout="@layout/widgetlist_icontext" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:imageScalingType="scaleToFitWithViewAdjustment"
app:emptyHeightToWidthRatio="50%"
app:progressIndicator="@drawable/ic_image_loading_themed"
app:addRandomnessToUrl="true" />
android:descendantFocusability="blocksDescendants">

<org.openhab.habdroid.ui.widget.WidgetImageView
android:id="@+id/widget_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:imageScalingType="scaleToFitWithViewAdjustment"
app:emptyHeightToWidthRatio="50%"
app:progressIndicator="@drawable/ic_image_loading_themed"
app:addRandomnessToUrl="true" />

<include layout="@layout/widgetlist_data_saver" />
</FrameLayout>


<include layout="@layout/widgetlist_data_saver" />

</FrameLayout>
</LinearLayout>

0 comments on commit fbb5678

Please sign in to comment.