Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4158)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBarAnimatingView.java

Issue 1966943004: Fix smooth progress behavior on JellyBean (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBar.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBarAnimatingView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBarAnimatingView.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBarAnimatingView.java
index 9c4c0418a3b15d89002ad8f48165beca1feed45c..71a01accf8fce0496cb91b3fcd316080619cebfb 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBarAnimatingView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBarAnimatingView.java
@@ -61,6 +61,12 @@ public class ToolbarProgressBarAnimatingView extends ImageView {
private float mLastAnimatedFraction;
/**
+ * If the animation is currently running. This is needed because Animator.isStarted() is not
+ * reliable on JellyBean.
+ */
+ private boolean mIsAnimationRunning;
+
+ /**
* An animation update listener that moves an ImageView across the progress bar.
*/
private class ProgressBarUpdateListener implements AnimatorUpdateListener {
@@ -77,7 +83,6 @@ public class ToolbarProgressBarAnimatingView extends ImageView {
*/
public ToolbarProgressBarAnimatingView(Context context, LayoutParams layoutParams) {
super(context);
-
setLayoutParams(layoutParams);
mIsRtl = LocalizationUtils.isLayoutRtl();
@@ -117,7 +122,8 @@ public class ToolbarProgressBarAnimatingView extends ImageView {
*/
public void startAnimation() {
mIsCanceled = false;
- if (!mAnimatorSet.isStarted()) {
+ if (!mIsAnimationRunning) {
+ mIsAnimationRunning = true;
// Set the initial start delay to 0ms so it starts immediately.
mAnimatorSet.setStartDelay(0);
@@ -180,7 +186,7 @@ public class ToolbarProgressBarAnimatingView extends ImageView {
*/
public void cancelAnimation() {
mIsCanceled = true;
- mAnimatorSet.cancel();
+ mIsAnimationRunning = false;
// Reset position and alpha.
setScaleX(0.0f);
setTranslationX(0.0f);
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBar.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698