Skip to content

Commit

Permalink
[Carousel] Fixed mutli-browse catalog demo crashing due to invalid po…
Browse files Browse the repository at this point in the history
…sition slider values.

PiperOrigin-RevId: 522072959
  • Loading branch information
hunterstich authored and paulfthomas committed Apr 10, 2023
1 parent ef57f69 commit 5bc7a50
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -123,15 +123,15 @@ public void onStopTrackingTouch(@NonNull Slider slider) {

private static Runnable updateSliderRange(Slider slider, CarouselAdapter adapter) {
return () -> {
if (adapter.getItemCount() == 0) {
slider.setValueFrom(0);
slider.setValueTo(0);
if (adapter.getItemCount() <= 1) {
slider.setEnabled(false);
return;
}

slider.setValue(1);
slider.setValueFrom(1);
slider.setValue(1);
slider.setValueTo(adapter.getItemCount());
slider.setEnabled(true);
};
}
}

0 comments on commit 5bc7a50

Please sign in to comment.