Fix bug where state changes were being suppressed if the drawable was offscreen.

Bug: 13563559
Change-Id: Iea22f1a4ae7b71dd6a555fdd2efb9047a61522a6
diff --git a/src/com/android/bitmap/drawable/TileDrawable.java b/src/com/android/bitmap/drawable/TileDrawable.java
index d188281..5c5c226 100644
--- a/src/com/android/bitmap/drawable/TileDrawable.java
+++ b/src/com/android/bitmap/drawable/TileDrawable.java
@@ -142,7 +142,7 @@
                 setAlpha(255);
             } else {
                 // fade out
-                if (mPaint.getAlpha() == 255 && !getBounds().isEmpty()) {
+                if (mPaint.getAlpha() == 255) {
                     mFadeOutAnimator.start();
                 }
             }
diff --git a/src/com/android/bitmap/view/BitmapDrawableImageView.java b/src/com/android/bitmap/view/BitmapDrawableImageView.java
index e9df6d3..9a88f3f 100644
--- a/src/com/android/bitmap/view/BitmapDrawableImageView.java
+++ b/src/com/android/bitmap/view/BitmapDrawableImageView.java
@@ -118,7 +118,8 @@
     protected void onAttachedToWindow() {
         super.onAttachedToWindow();
         mAttachedToWindow = true;
-        if (mDrawable != null && mDrawable.getKey() == null) {
+        if (mDrawable != null && mDrawable.getKey() == null
+              && mDrawable.getPreviousKey() != null) {
             mDrawable.bind(mDrawable.getPreviousKey());
         }
     }