summaryrefslogtreecommitdiffstats
path: root/core/java/android/transition
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2014-10-22 14:39:43 -0700
committerGeorge Mount <mount@google.com>2014-10-22 14:39:43 -0700
commitcba01b2310e78fc2114ceed285f4e134469ae62b (patch)
tree53cf8dbeebfe8cec5cb4708cd4cbd95fa2b09a5c /core/java/android/transition
parentf23b29ad5a730c7b26d9f96c764dc4e0d96fdd16 (diff)
downloadframeworks_base-cba01b2310e78fc2114ceed285f4e134469ae62b.zip
frameworks_base-cba01b2310e78fc2114ceed285f4e134469ae62b.tar.gz
frameworks_base-cba01b2310e78fc2114ceed285f4e134469ae62b.tar.bz2
Fix transition being canceled improperly.
Bug 18092208 When a transition is determining whether or not it should be canceled, the old values and new values are compared. Previously, the if a value was in the old values, but not in the new values then the value was considered changed. This discounts that transitions sometimes don't target views and it may be that no value was populated. Change-Id: I8210ba1e44921fadedf9ead571d380ad34e73d3f
Diffstat (limited to 'core/java/android/transition')
-rw-r--r--core/java/android/transition/Transition.java4
-rw-r--r--core/java/android/transition/Visibility.java11
2 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java
index 6dede46..e99c2cf 100644
--- a/core/java/android/transition/Transition.java
+++ b/core/java/android/transition/Transition.java
@@ -1790,6 +1790,10 @@ public abstract class Transition implements Cloneable {
private static boolean isValueChanged(TransitionValues oldValues, TransitionValues newValues,
String key) {
+ if (oldValues.values.containsKey(key) != newValues.values.containsKey(key)) {
+ // The transition didn't care about this particular value, so we don't care, either.
+ return false;
+ }
Object oldValue = oldValues.values.get(key);
Object newValue = newValues.values.get(key);
boolean changed;
diff --git a/core/java/android/transition/Visibility.java b/core/java/android/transition/Visibility.java
index f58291f..36bac31 100644
--- a/core/java/android/transition/Visibility.java
+++ b/core/java/android/transition/Visibility.java
@@ -484,12 +484,19 @@ public abstract class Visibility extends Transition {
@Override
boolean areValuesChanged(TransitionValues oldValues, TransitionValues newValues) {
- VisibilityInfo changeInfo = getVisibilityChangeInfo(oldValues, newValues);
if (oldValues == null && newValues == null) {
return false;
}
+ if (oldValues != null && newValues != null &&
+ newValues.values.containsKey(PROPNAME_VISIBILITY) !=
+ oldValues.values.containsKey(PROPNAME_VISIBILITY)) {
+ // The transition wasn't targeted in either the start or end, so it couldn't
+ // have changed.
+ return false;
+ }
+ VisibilityInfo changeInfo = getVisibilityChangeInfo(oldValues, newValues);
return changeInfo.visibilityChange && (changeInfo.startVisibility == View.VISIBLE ||
- changeInfo.endVisibility == View.VISIBLE);
+ changeInfo.endVisibility == View.VISIBLE);
}
/**