Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cba01b23 authored by George Mount's avatar George Mount
Browse files

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
parent f23b29ad
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
+9 −2
Original line number Diff line number Diff line
@@ -484,10 +484,17 @@ 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);
    }