2121import android .content .res .TypedArray ;
2222import android .graphics .drawable .Drawable ;
2323import android .graphics .drawable .LayerDrawable ;
24- import android .os .Build ;
2524import android .support .annotation .ColorInt ;
2625import android .support .annotation .RestrictTo ;
2726import 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