syedowaisali / crystal-range-seekbar

537 stars 164 forks source link

Limiting the value and infinite loop error #106

Open saurabhdtu opened 6 years ago

saurabhdtu commented 6 years ago

I am trying to limit the max value of the seekbar to a certain value in this case 11 on a range from 1 to 50. But the when i try to do this the code enters into infinite loop. Is there any way to limit the value of range ?

 crystalRangeSeekbar.setOnRangeSeekbarChangeListener(new OnRangeSeekbarChangeListener() {
            @Override
            public void valueChanged(Number minValue, Number maxValue) {
                if (maxValue.intValue() > 11) {

 crystalRangeSeekbar.setMaxStartValue(11).setMinStartValue(1).apply();
                    crystalRangeSeekbar.apply();
                    return;
                }
                MainActivity.this.minValue = minValue.intValue();
                MainActivity.this.maxValue = maxValue.intValue();
            }
        });