Merge "[ProgressBar] Fix: Media volume bar indicates a wrong value" am: 4a9f0495ee
Change-Id: I46229f54fc2bc093d3326fd679625aca30ccefc9
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.annotation.InterpolatorRes;
|
import android.annotation.InterpolatorRes;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
@@ -246,6 +248,8 @@ public class ProgressBar extends View {
|
|||||||
|
|
||||||
private AccessibilityEventSender mAccessibilityEventSender;
|
private AccessibilityEventSender mAccessibilityEventSender;
|
||||||
|
|
||||||
|
private ObjectAnimator mLastProgressAnimator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new progress bar with range 0...100 and initial progress of 0.
|
* Create a new progress bar with range 0...100 and initial progress of 0.
|
||||||
* @param context the application environment
|
* @param context the application environment
|
||||||
@@ -1544,8 +1548,19 @@ public class ProgressBar extends View {
|
|||||||
animator.setAutoCancel(true);
|
animator.setAutoCancel(true);
|
||||||
animator.setDuration(PROGRESS_ANIM_DURATION);
|
animator.setDuration(PROGRESS_ANIM_DURATION);
|
||||||
animator.setInterpolator(PROGRESS_ANIM_INTERPOLATOR);
|
animator.setInterpolator(PROGRESS_ANIM_INTERPOLATOR);
|
||||||
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
mLastProgressAnimator = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
animator.start();
|
animator.start();
|
||||||
|
mLastProgressAnimator = animator;
|
||||||
} else {
|
} else {
|
||||||
|
if (isPrimary && mLastProgressAnimator != null) {
|
||||||
|
mLastProgressAnimator.cancel();
|
||||||
|
mLastProgressAnimator = null;
|
||||||
|
}
|
||||||
setVisualProgress(id, scale);
|
setVisualProgress(id, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user