syedowaisali / crystal-range-seekbar

537 stars 164 forks source link

setOnRangeSeekbarChangeListener gives wrong Max Value #157

Open gmacdev opened 3 years ago

gmacdev commented 3 years ago

Hey, I'm using the range seekbar and I've set the value as shown below:

XML:

<com.crystal.crystalrangeseekbar.widgets.CrystalRangeSeekbar
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="16dp"
                    android:layout_marginTop="16dp"
                    android:layout_marginEnd="16dp"
                    android:layout_marginBottom="6dp"
                    app:bar_color="@color/grey"
                    app:bar_highlight_color="@color/white"
                    app:corner_radius="20"
                    app:data_type="_integer"
                    app:left_thumb_color="@color/blue"
                    app:left_thumb_color_pressed="@color/white"
                    app:right_thumb_color="@color/blue"
                    app:right_thumb_color_pressed="@color/white" />

Code:

seek_bar
        .setMaxValue(449755406)
        .setMaxStartValue(449755406)
        .setMinValue(32)
        .setMinStartValue(32)
        .apply();

seek_bar.setOnRangeSeekbarChangeListener((minValue, maxValue) -> {
             start_text.setText(String.valueOf(minValue));
             end_text.setText(String.valueOf(maxValue));
    });

But the maxValue under setOnRangeSeekbarChangeListener is 449755392 which is wrong. It should be 449755406.

Here's the screenshot Screenshot_20201231-072849__01

This doesn't happen for all numbers but only for some, like in this case 449755406. Am I doing something wrong or is this a bug?

gmacdev commented 3 years ago

Here's a demo project.

sandipborad commented 3 years ago

Here's a demo project.

Perfect, it's working great. it's save my time. @gmacdev (y)