Skip to content

Commit

Permalink
Section switch: Don't display a value text field when a switch is che…
Browse files Browse the repository at this point in the history
…cked

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma committed Jan 5, 2025
1 parent 31ec680 commit 1b7ba98
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 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 @@ -1156,10 +1156,6 @@ class WidgetAdapter(
override fun bind(widget: Widget) {
super.bind(widget)

val hasNoLabelAndValue = labelView.text.isEmpty() && valueView?.text?.isEmpty() != false
labelView.isGone = hasNoLabelAndValue
valueView?.isGone = hasNoLabelAndValue

val mappings = widget.mappingsOrItemOptions
val buttonCount = min(mappings.size, maxButtons)

Expand Down Expand Up @@ -1213,9 +1209,14 @@ class WidgetAdapter(
if (checkedId == null) {
group.clearChecked()
} else {
valueView?.text = ""
group.check(checkedId)
}

val hasNoLabelAndValue = labelView.text.isEmpty() && valueView?.text?.isEmpty() != false
labelView.isGone = hasNoLabelAndValue
valueView?.isGone = hasNoLabelAndValue

group.isVisible = true
}

Expand Down

0 comments on commit 1b7ba98

Please sign in to comment.