diff options
author | George Mount <mount@google.com> | 2014-10-22 14:39:43 -0700 |
---|---|---|
committer | George Mount <mount@google.com> | 2014-10-22 14:39:43 -0700 |
commit | cba01b2310e78fc2114ceed285f4e134469ae62b (patch) | |
tree | 53cf8dbeebfe8cec5cb4708cd4cbd95fa2b09a5c /core/java/android/transition/Visibility.java | |
parent | f23b29ad5a730c7b26d9f96c764dc4e0d96fdd16 (diff) | |
download | frameworks_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/Visibility.java')
-rw-r--r-- | core/java/android/transition/Visibility.java | 11 |
1 files changed, 9 insertions, 2 deletions
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); } /** |