oli107 / material-range-bar

Android widget for selecting a range of values.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The range bar allows you to swipe past the end

zsweigart opened this issue · comments

If you swipe on an angle (e.g. down and to the left) past the end of the range bar you can set the value to outside the range bar entirely. Once you are in that state backgrounding and foregrounding the app causes an exception to be thrown in setRangePinsByIndices because the left value is less than the minimum value. I have been able to get around it using

`
mRangeBar.setOnRangeBarChangeListener(
(rangeBar, i, i1, left, right) -> {
Logger.d(TAG, "onRangeChangeListener");

    if (Integer.parseInt(rangeBar.getLeftPinValue()) < minValue) {
      left = String.valueOf(minValue);
      mRangeBar.setRangePinsByValue(Integer.parseInt(left), Integer.parseInt(right));
    }

    if (Integer.parseInt(rangeBar.getRightPinValue()) > maxValue) {
      right = String.valueOf(maxValue);
      mRangeBar.setRangePinsByValue(Integer.parseInt(left), Integer.parseInt(right));
    }

});
`

but that is just a hacky workaround and this should be built into the library

I tried it but it does not apply...

If I move my finger thousands of times, the same problem continue to happen...