diff options
| author | Dake Gu <dake@google.com> | 2014-07-22 14:53:53 -0700 |
|---|---|---|
| committer | George Mount <mount@google.com> | 2014-08-21 15:50:17 -0700 |
| commit | c94e2b393f6eba684ee2c84eaa50746fc1459d0f (patch) | |
| tree | a975f657cdefffa64c8f381fd11c445bc815ca37 /core/java/android/transition/Transition.java | |
| parent | b89d5cc2c64112a0ff7e66e4dd3bb2114caed935 (diff) | |
Add Parent Change to ChangeTransform
Bug 16460123
Modified ChangeTransform to support any pivot changes.
Modified ChangeTransform to support changes between parents.
Change-Id: I6374890dab9f3d795f334b951bdb9d51d434b8ee
Diffstat (limited to 'core/java/android/transition/Transition.java')
| -rw-r--r-- | core/java/android/transition/Transition.java | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java index 0d32d4038e29..59ba71fa8208 100644 --- a/core/java/android/transition/Transition.java +++ b/core/java/android/transition/Transition.java @@ -112,8 +112,8 @@ import com.android.internal.R; * * Further information on XML resource descriptions for transitions can be found for * {@link android.R.styleable#Transition}, {@link android.R.styleable#TransitionSet}, - * {@link android.R.styleable#TransitionTarget}, {@link android.R.styleable#Fade}, and - * {@link android.R.styleable#Slide}. + * {@link android.R.styleable#TransitionTarget}, {@link android.R.styleable#Fade}, + * {@link android.R.styleable#Slide}, and {@link android.R.styleable#ChangeTransform}. * */ public abstract class Transition implements Cloneable { @@ -1755,24 +1755,40 @@ public abstract class Transition implements Cloneable { // if oldValues null, then transition didn't care to stash values, // and won't get canceled if (oldValues != null && newValues != null) { - for (String key : oldValues.values.keySet()) { - Object oldValue = oldValues.values.get(key); - Object newValue = newValues.values.get(key); - if (oldValue != null && newValue != null && - !oldValue.equals(newValue)) { - valuesChanged = true; - if (DBG) { - Log.d(LOG_TAG, "Transition.playTransition: " + - "oldValue != newValue for " + key + - ": old, new = " + oldValue + ", " + newValue); + String[] properties = getTransitionProperties(); + if (properties != null) { + int count = properties.length; + for (int i = 0; i < count; i++) { + if (isValueChanged(oldValues, newValues, properties[i])) { + valuesChanged = true; + break; + } + } + } else { + for (String key : oldValues.values.keySet()) { + if (isValueChanged(oldValues, newValues, key)) { + valuesChanged = true; + break; } - break; } } } return valuesChanged; } + private static boolean isValueChanged(TransitionValues oldValues, TransitionValues newValues, + String key) { + Object oldValue = oldValues.values.get(key); + Object newValue = newValues.values.get(key); + boolean changed = (oldValue != null && newValue != null && !oldValue.equals(newValue)); + if (DBG && changed) { + Log.d(LOG_TAG, "Transition.playTransition: " + + "oldValue != newValue for " + key + + ": old, new = " + oldValue + ", " + newValue); + } + return changed; + } + /** * This is a utility method used by subclasses to handle standard parts of * setting up and running an Animator: it sets the {@link #getDuration() |
