oli107 / material-range-bar

Android widget for selecting a range of values.
Apache License 2.0
1.68k stars 370 forks source link

It is possible to move thumb out of range #23

Open WonderCsabo opened 8 years ago

WonderCsabo commented 8 years ago

If i drag the thumb fast towards the edge of the screen, it is possible to move the thumb out of the range. I am using pinRadius 0dp and selectorSize 16dp.

Please see attached screenshot. Normally the min value is 0.

screenshot_20151112-123210

WonderCsabo commented 8 years ago

This also happens if i click the side of the thumb towards to end of the range.

WonderCsabo commented 8 years ago

@oli107 this only happens if pinRadius="0dp".

WonderCsabo commented 8 years ago

@oli107 after some debugging the problems happens in onActionUp, but i could not find the exact line.

WonderCsabo commented 8 years ago

@oli107 sorry for pinging but can you check this issue?

rameen commented 8 years ago

yes its a bug.I have replicated it many times. There is no check for bounds.

rmasarovic commented 8 years ago

my dummy qucik fix workeround : private RangeBar rangeBar; private int min; private int max;

rangeBar.setOnRangeBarChangeListener(new RangeBar.OnRangeBarChangeListener() { @Override public void onRangeChangeListener(RangeBar rangeBar, int leftPinIndex, int rightPinIndex, String leftPinValue, String rightPinValue) { int left = Integer.valueOf(leftPinValue); int right = Integer.valueOf(rightPinValue); if (left < min) { rangeBar.setRangePinsByValue(min, right); } if (right > max) { rangeBar.setRangePinsByValue(left, max); } }