summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Chen <christinech@google.com>2013-09-11 19:16:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-11 19:16:59 +0000
commit4f617aa68f637f7f4960df5b6faeaf6846b998cf (patch)
tree2ffa5440eca236e3074d18fa6b0e422ed773b521
parentc69ef13bc2b5f948e99752dcdb8e44e78ab201bf (diff)
parent54204d9ca705845eee0dc3ddcaf830b9b922fca9 (diff)
Merge "Adds null pointer check for AnimationUtils." into klp-dev
-rw-r--r--InCallUI/src/com/android/incallui/AnimationUtils.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/AnimationUtils.java b/InCallUI/src/com/android/incallui/AnimationUtils.java
index aef3cdfb6..d214c8569 100644
--- a/InCallUI/src/com/android/incallui/AnimationUtils.java
+++ b/InCallUI/src/com/android/incallui/AnimationUtils.java
@@ -209,11 +209,14 @@ public class AnimationUtils {
final ImageView imageView, final Drawable from, final Drawable to) {
// We skip the cross-fade when those two Drawables are equal, or they are BitmapDrawables
// pointing to the same Bitmap.
- final boolean areSameImage = from.equals(to) ||
- ((from instanceof BitmapDrawable)
- && (to instanceof BitmapDrawable)
- && ((BitmapDrawable) from).getBitmap()
- .equals(((BitmapDrawable) to).getBitmap()));
+ final boolean drawableIsEqual = (from != null && to != null && from.equals(to));
+ final boolean hasFromImage = ((from instanceof BitmapDrawable) &&
+ ((BitmapDrawable) from).getBitmap() != null);
+ final boolean hasToImage = ((to instanceof BitmapDrawable) &&
+ ((BitmapDrawable) to).getBitmap() != null);
+ final boolean areSameImage = drawableIsEqual || (hasFromImage && hasToImage &&
+ ((BitmapDrawable) from).getBitmap().equals(((BitmapDrawable) to).getBitmap()));
+
if (!areSameImage) {
if (FADE_DBG) {
log("Start cross-fade animation for " + imageView
@@ -263,6 +266,9 @@ public class AnimationUtils {
imageView.setImageDrawable(transitionDrawable);
transitionDrawable.startTransition(ANIMATION_DURATION); */
imageView.setTag(to);
+ } else if (!hasFromImage && hasToImage) {
+ imageView.setImageDrawable(to);
+ imageView.setTag(to);
} else {
if (FADE_DBG) {
log("*Not* start cross-fade. " + imageView);