From 0d2adfbbb3b2f2990fc2265dfadca0252a5b4bb5 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Thu, 4 Sep 2014 01:27:53 +0200 Subject: [PATCH] Potential fix for a couple bugs issue 17371274 issue 17368590 Change-Id: I717f9c37613efd9d61e401540ca82aff77058022 --- src/com/android/launcher3/AppsCustomizePagedView.java | 6 ++++-- src/com/android/launcher3/Launcher.java | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index 558d8e99b7..a92bff1b63 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -366,8 +366,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // This code triggers requestLayout so must be posted outside of the // layout pass. public void run() { - setDataIsReady(); - onDataReady(getMeasuredWidth(), getMeasuredHeight()); + if (isAttachedToWindow()) { + setDataIsReady(); + onDataReady(getMeasuredWidth(), getMeasuredHeight()); + } } }); } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 83f813dc68..ffce116b90 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3373,6 +3373,9 @@ public class Launcher extends Activity final AnimatorSet stateAnimation = mStateAnimation; final Runnable startAnimRunnable = new Runnable() { public void run() { + if (!toView.isAttachedToWindow()) { + return; + } // Check that mStateAnimation hasn't changed while // we waited for a layout/draw pass if (mStateAnimation != stateAnimation) @@ -3618,6 +3621,9 @@ public class Launcher extends Activity final AnimatorSet stateAnimation = mStateAnimation; final Runnable startAnimRunnable = new Runnable() { public void run() { + if (!fromView.isAttachedToWindow()) { + return; + } // Check that mStateAnimation hasn't changed while // we waited for a layout/draw pass if (mStateAnimation != stateAnimation)