Potential fix for a couple bugs

issue 17371274
issue 17368590

Change-Id: I717f9c37613efd9d61e401540ca82aff77058022
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 83f813d..ffce116 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3373,6 +3373,9 @@
             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 @@
             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)