Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a25d877 authored by Haijie Hong's avatar Haijie Hong
Browse files

Allow to uncheck SegmentedButtonPreference

Bug: 416612263
Test: local build
Flag: EXEMPT minor fix
Change-Id: Ic878a4b7d64cde366f3016e878883a3565483c3e
parent e96acc16
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -155,14 +155,17 @@ class SegmentedButtonPreference @JvmOverloads constructor(
    }

    private fun applyCheckIndex(index: Int) {
        buttonGroup?.getChildAt(index)?.let { button ->
        val button = buttonGroup?.getChildAt(index) ?: run {
            buttonGroup?.clearChecked()
            return
        }
        if (button.id == View.NO_ID || button.isGone) {
            buttonGroup?.clearChecked()
            return
        }

        buttonGroup?.check(button.id)
    }
    }

    private sealed interface SegmentedButtonIcon {
        data class DrawableIcon(val drawable: Drawable) : SegmentedButtonIcon