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

Commit 7694eb9b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Catalyst] Update RangeValue" into main

parents 0c95b9c4 12cc8069
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -161,14 +161,14 @@ interface DiscreteIntValue : DiscreteValue<Int> {
/** Value is between a range. */
interface RangeValue : ValueDescriptor {
    /** The lower bound (inclusive) of the range. */
    val minValue: Int
    fun getMinValue(context: Context): Int

    /** The upper bound (inclusive) of the range. */
    val maxValue: Int
    fun getMaxValue(context: Context): Int

    /** The increment step within the range. 0 means unset, which implies step size is 1. */
    val incrementStep: Int
        get() = 0
    fun getIncrementStep(context: Context) = 0

    override fun isValidValue(context: Context, index: Int) = index in minValue..maxValue
    override fun isValidValue(context: Context, index: Int) =
        index in getMinValue(context)..getMaxValue(context)
}
+3 −3
Original line number Diff line number Diff line
@@ -101,9 +101,9 @@ interface PreferenceBinding {
                    preference.setEntryValues(values)
                }
            } else if (preference is SeekBarPreference && this is RangeValue) {
                preference.min = minValue
                preference.max = maxValue
                preference.seekBarIncrement = incrementStep
                preference.min = getMinValue(context)
                preference.max = getMaxValue(context)
                preference.seekBarIncrement = getIncrementStep(context)
            }
        }
    }