Skip to content

Commit ba462c1

Browse files
Piotr Zawadzkizawadz88
authored andcommitted
Extended progress bar animation time to 200 milliseconds
1 parent 4efc567 commit ba462c1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

material-stepper/src/main/java/com/stepstone/stepper/internal/widget/ColorableProgressBar.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import android.content.res.TypedArray;
2222
import android.graphics.drawable.Drawable;
2323
import android.graphics.drawable.LayerDrawable;
24-
import android.os.Build;
2524
import android.support.annotation.ColorInt;
2625
import android.support.annotation.RestrictTo;
2726
import android.support.v4.content.ContextCompat;
@@ -44,20 +43,17 @@ public class ColorableProgressBar extends ProgressBar {
4443

4544
/**
4645
* Interpolator used for smooth progress animations.
47-
* This is copied from {@link ProgressBar} on Android Nougat.
4846
*/
49-
private static final DecelerateInterpolator PROGRESS_ANIM_INTERPOLATOR =
50-
new DecelerateInterpolator();
47+
private static final DecelerateInterpolator PROGRESS_ANIM_INTERPOLATOR = new DecelerateInterpolator();
5148

5249
/**
5350
* Duration of smooth progress animations.
54-
* This is copied from {@link ProgressBar} on Android Nougat.
5551
*/
56-
private static final int PROGRESS_ANIM_DURATION = 80;
52+
private static final int PROGRESS_ANIM_DURATION = 200;
5753

5854
/**
5955
* A multiplier to be used when setting the current progress of this progress bar.
60-
* It is needed to animate the progress changes below Android Nougat.
56+
* It is needed to animate the progress changes.
6157
*/
6258
private static final int PROGRESS_RANGE_MULTIPLIER = 100;
6359

@@ -123,9 +119,7 @@ public void setProgressBackgroundColor(@ColorInt int backgroundColor) {
123119
}
124120

125121
public void setProgressCompat(int progress, boolean animate) {
126-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
127-
setProgress(progress * PROGRESS_RANGE_MULTIPLIER, animate);
128-
} else if (animate) {
122+
if (animate) {
129123
final ObjectAnimator animator = ObjectAnimator.ofInt(this, PROGRESS_PROPERTY, getProgress(), progress * PROGRESS_RANGE_MULTIPLIER);
130124
animator.setDuration(PROGRESS_ANIM_DURATION);
131125
animator.setInterpolator(PROGRESS_ANIM_INTERPOLATOR);

0 commit comments

Comments
 (0)