milosmns / actual-number-picker

Android: A horizontal number picker
GNU General Public License v3.0
222 stars 36 forks source link

setMax/MinValue programmatically #12

Closed mathias21 closed 7 years ago

mathias21 commented 7 years ago

[ADDED] Added setMaxValue and setMinValue methods to allow to set them programmatically.

It is a bit hard to manage with the boundaries and the logic. For me this works fine, but you need to set proper values from the beginning (I tried to reuse your checks related with possible values). This can be a bit pain in the ass for some algorithms that people can use in their code, but nothing dramatic.

Tested using the following data: StartingMinValue = 2016 (my logic) StartingMaxValue = 2017 (my logic)

setMinValue(2015) -> works. setMinValue(2014) -> works. setMaxValue(2018) -> works. setMaxValue(2019) -> works.

mathias21 commented 7 years ago

@milosmns Now value is saved by setValue method. In this way, regular behaviour will happen, notifying listener. Let me know your thoughts.