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

Commit 44d5d407 authored by Haijie Hong's avatar Haijie Hong Committed by Android (Google) Code Review
Browse files

Merge "Allow to uncheck SegmentedButtonPreference" into main

parents 17e0936f 9a25d877
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -160,14 +160,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