Merge pull request #1233 from Andries-Smit/fix/numberpicker-set-limit
Fix/number picker set limit
This commit is contained in:
commit
ecefcdf9c2
1 changed files with 8 additions and 0 deletions
|
@ -192,6 +192,14 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
|
||||||
set(value) {
|
set(value) {
|
||||||
if (watcher != null) editText?.removeTextChangedListener(watcher)
|
if (watcher != null) editText?.removeTextChangedListener(watcher)
|
||||||
currentValue = value
|
currentValue = value
|
||||||
|
if (currentValue > maxValue) {
|
||||||
|
currentValue = maxValue
|
||||||
|
ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
|
||||||
|
}
|
||||||
|
if (currentValue < minValue) {
|
||||||
|
currentValue = minValue
|
||||||
|
ToastUtils.showToastInUiThread(context, context.getString(R.string.youareonallowedlimit))
|
||||||
|
}
|
||||||
callValueChangedListener()
|
callValueChangedListener()
|
||||||
updateEditText()
|
updateEditText()
|
||||||
if (watcher != null) editText?.addTextChangedListener(watcher)
|
if (watcher != null) editText?.addTextChangedListener(watcher)
|
||||||
|
|
Loading…
Reference in a new issue