diff options
author | Romain Guy <romainguy@android.com> | 2010-02-25 14:32:39 -0800 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2010-02-25 14:32:39 -0800 |
commit | a05e8a5869ad2117485938cd52d4b891672a1873 (patch) | |
tree | 0167bbdbf8d34ad09ea0b3f665c3e81f215ca546 /core | |
parent | 2299a553bc35ecc15dab0e36732b126e1eb8d446 (diff) | |
download | frameworks_base-a05e8a5869ad2117485938cd52d4b891672a1873.zip frameworks_base-a05e8a5869ad2117485938cd52d4b891672a1873.tar.gz frameworks_base-a05e8a5869ad2117485938cd52d4b891672a1873.tar.bz2 |
Prevent ProgressBar from updating itself when hidden.
Bug #2470737
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/ProgressBar.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index 6dc9f78..202e658 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -696,8 +696,7 @@ public class ProgressBar extends View { * <p>Start the indeterminate progress animation.</p> */ void startAnimation() { - int visibility = getVisibility(); - if (visibility != VISIBLE) { + if (getVisibility() != VISIBLE) { return; } @@ -771,7 +770,7 @@ public class ProgressBar extends View { // let's be nice with the UI thread if (v == GONE || v == INVISIBLE) { stopAnimation(); - } else if (v == VISIBLE) { + } else { startAnimation(); } } @@ -779,6 +778,20 @@ public class ProgressBar extends View { } @Override + protected void onVisibilityChanged(View changedView, int visibility) { + super.onVisibilityChanged(changedView, visibility); + + if (mIndeterminate) { + // let's be nice with the UI thread + if (visibility == GONE || visibility == INVISIBLE) { + stopAnimation(); + } else { + startAnimation(); + } + } + } + + @Override public void invalidateDrawable(Drawable dr) { if (!mInDrawing) { if (verifyDrawable(dr)) { |