summaryrefslogtreecommitdiff
path: root/core/java/android/widget/ImageView.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/widget/ImageView.java')
-rw-r--r--core/java/android/widget/ImageView.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 02065779ef91..222a040d2b3c 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -911,17 +911,11 @@ public class ImageView extends View {
}
if (mDrawable != null) {
- // It's possible for this method to be invoked from the constructor before
- // subclass constructors have run. Drawables can and should trigger invalidations
- // and other activity with their callback on visibility changes, which shouldn't
- // happen before subclass constructors finish. However, we won't have set the
- // drawable as visible until the view becomes attached. This guard below keeps
- // multiple calls to this method from constructors from causing issues.
- if (mDrawable.isVisible()) {
- mDrawable.setVisible(false, false);
- }
mDrawable.setCallback(null);
unscheduleDrawable(mDrawable);
+ if (isAttachedToWindow()) {
+ mDrawable.setVisible(false, false);
+ }
}
mDrawable = d;