Skip to content

Commit

Permalink
[Slider] remove unnecessary code
Browse files Browse the repository at this point in the history
Resolves #4537

GIT_ORIGIN_REV_ID=e508df4affbda49f20a64dba7502fb21d90f0a3a
PiperOrigin-RevId: 716261754
  • Loading branch information
manabu-nakamura authored and pekingme committed Jan 16, 2025
1 parent 6a7c034 commit 867fd01
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions lib/java/com/google/android/material/slider/BaseSlider.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ abstract class BaseSlider<
+ " stepSize(%s)";
private static final String EXCEPTION_ILLEGAL_VALUE_FROM =
"valueFrom(%s) must be smaller than valueTo(%s)";
private static final String EXCEPTION_ILLEGAL_VALUE_TO =
"valueTo(%s) must be greater than valueFrom(%s)";
private static final String EXCEPTION_ILLEGAL_STEP_SIZE =
"The stepSize(%s) must be 0, or a factor of the valueFrom(%s)-valueTo(%s) range";
private static final String EXCEPTION_ILLEGAL_MIN_SEPARATION =
Expand Down Expand Up @@ -667,20 +665,6 @@ private boolean maybeIncreaseTrackSidePadding() {
return true;
}

private void validateValueFrom() {
if (valueFrom >= valueTo) {
throw new IllegalStateException(
String.format(EXCEPTION_ILLEGAL_VALUE_FROM, valueFrom, valueTo));
}
}

private void validateValueTo() {
if (valueTo <= valueFrom) {
throw new IllegalStateException(
String.format(EXCEPTION_ILLEGAL_VALUE_TO, valueTo, valueFrom));
}
}

private boolean valueLandsOnTick(float value) {
// Check that the value is a multiple of stepSize given the offset of valueFrom.
double result =
Expand Down Expand Up @@ -709,6 +693,11 @@ private void validateStepSize() {
}

private void validateValues() {
if (valueFrom >= valueTo) {
throw new IllegalStateException(
String.format(EXCEPTION_ILLEGAL_VALUE_FROM, valueFrom, valueTo));
}

for (Float value : values) {
if (value < valueFrom || value > valueTo) {
throw new IllegalStateException(
Expand Down Expand Up @@ -762,10 +751,8 @@ private void warnAboutFloatingPointError() {

private void validateConfigurationIfDirty() {
if (dirtyConfig) {
validateValueFrom();
validateValueTo();
validateStepSize();
validateValues();
validateStepSize();
validateMinSeparation();
warnAboutFloatingPointError();
dirtyConfig = false;
Expand Down

0 comments on commit 867fd01

Please sign in to comment.