From 1382b490adc3971916ca14978f8bd2d9f5f2a344 Mon Sep 17 00:00:00 2001 From: Nicolas Roard Date: Wed, 16 Sep 2009 21:50:06 +0100 Subject: [PATCH] Fix for the progress indicator not spinning --- src/com/android/browser/TitleBar.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java index fea9baf..3bdc18b 100644 --- a/src/com/android/browser/TitleBar.java +++ b/src/com/android/browser/TitleBar.java @@ -181,7 +181,7 @@ public class TitleBar extends LinearLayout { * Update the progress, from 0 to 100. */ /* package */ void setProgress(int newProgress) { - if (newProgress == mHorizontalProgress.getMax()) { + if (newProgress >= mHorizontalProgress.getMax()) { mTitle.setCompoundDrawables(null, null, null, null); ((Animatable) mCircularProgress).stop(); mHorizontalProgress.setVisibility(View.INVISIBLE); @@ -191,7 +191,11 @@ public class TitleBar extends LinearLayout { mInLoad = false; } else { mHorizontalProgress.setProgress(newProgress); - if (!mInLoad) { + if (!mInLoad && getWindowToken() != null) { + // checking the window token lets us be sure that we + // are attached to a window before starting the animation, + // preventing a potential race condition + // (fix for bug http://b/2115736) mTitle.setCompoundDrawables(null, null, mCircularProgress, null); ((Animatable) mCircularProgress).start(); -- 2.11.0