summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2016-03-31 15:35:35 -0700
committerAdam Powell <adamp@google.com>2016-03-31 15:36:18 -0700
commit4b2e12cc9e5ac5111a2d581868bbf4df8078ed23 (patch)
tree0771d665a5de219d7e29eeb2f26f1ade4d59afa6 /core/java
parent33b30609ff916a1a9476fdecbf60c19cff56f76c (diff)
Revert "Only call Drawable.setVisible(false) for visible outgoing drawables"
This reverts commit 35e2ea02035e8b7eb7de5d7a1d51bf030dcb5b76. This patch was based on two different wrong assumptions. Bug 27822069 Change-Id: I20b1017f91f3fce3c23dd8446459d6f3e3150a48
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/View.java16
-rw-r--r--core/java/android/widget/ImageView.java12
2 files changed, 5 insertions, 23 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index dd79e62717b0..1a3a283e259a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -18072,13 +18072,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* to clear the previous drawable. setVisible first while we still have the callback set.
*/
if (mBackground != null) {
- // It's possible for this method to be invoked from the View 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 (mBackground.isVisible()) {
+ if (isAttachedToWindow()) {
mBackground.setVisible(false, false);
}
mBackground.setCallback(null);
@@ -18313,13 +18307,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
if (mForegroundInfo.mDrawable != null) {
- // It's possible for this method to be invoked from the View 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 (mForegroundInfo.mDrawable.isVisible()) {
+ if (isAttachedToWindow()) {
mForegroundInfo.mDrawable.setVisible(false, false);
}
mForegroundInfo.mDrawable.setCallback(null);
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;