Fix SwitchCompat animating while not visible

Go to love View Animations

BUG: 22626509

Change-Id: I6fe10dd20c8252e0fe2f0c36d5daa0fe04d46481
diff --git a/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java b/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
index 19fe8ff..a8cf47b 100644
--- a/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
+++ b/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
@@ -788,7 +788,7 @@
         // recursively with a different value, so load the REAL value...
         checked = isChecked();
 
-        if (getWindowToken() != null && ViewCompat.isLaidOut(this)) {
+        if (getWindowToken() != null && ViewCompat.isLaidOut(this) && isShown()) {
             animateThumbToCheckedState(checked);
         } else {
             // Immediately move the thumb to the new position.