Merge "API Council changes." into mnc-dev

This commit is contained in:
George Mount
2015-06-08 16:36:20 +00:00
committed by Android (Google) Code Review
4 changed files with 25 additions and 20 deletions

View File

@@ -33776,7 +33776,6 @@ package android.transition {
method public android.transition.Transition addTarget(java.lang.String); method public android.transition.Transition addTarget(java.lang.String);
method public android.transition.Transition addTarget(java.lang.Class); method public android.transition.Transition addTarget(java.lang.Class);
method public android.transition.Transition addTarget(android.view.View); method public android.transition.Transition addTarget(android.view.View);
method protected boolean areValuesChanged(android.transition.TransitionValues, android.transition.TransitionValues);
method public boolean canRemoveViews(); method public boolean canRemoveViews();
method public abstract void captureEndValues(android.transition.TransitionValues); method public abstract void captureEndValues(android.transition.TransitionValues);
method public abstract void captureStartValues(android.transition.TransitionValues); method public abstract void captureStartValues(android.transition.TransitionValues);
@@ -33803,6 +33802,7 @@ package android.transition {
method public java.util.List<android.view.View> getTargets(); method public java.util.List<android.view.View> getTargets();
method public java.lang.String[] getTransitionProperties(); method public java.lang.String[] getTransitionProperties();
method public android.transition.TransitionValues getTransitionValues(android.view.View, boolean); method public android.transition.TransitionValues getTransitionValues(android.view.View, boolean);
method public boolean isTransitionRequired(android.transition.TransitionValues, android.transition.TransitionValues);
method public android.transition.Transition removeListener(android.transition.Transition.TransitionListener); method public android.transition.Transition removeListener(android.transition.Transition.TransitionListener);
method public android.transition.Transition removeTarget(int); method public android.transition.Transition removeTarget(int);
method public android.transition.Transition removeTarget(java.lang.String); method public android.transition.Transition removeTarget(java.lang.String);

View File

@@ -36041,7 +36041,6 @@ package android.transition {
method public android.transition.Transition addTarget(java.lang.String); method public android.transition.Transition addTarget(java.lang.String);
method public android.transition.Transition addTarget(java.lang.Class); method public android.transition.Transition addTarget(java.lang.Class);
method public android.transition.Transition addTarget(android.view.View); method public android.transition.Transition addTarget(android.view.View);
method protected boolean areValuesChanged(android.transition.TransitionValues, android.transition.TransitionValues);
method public boolean canRemoveViews(); method public boolean canRemoveViews();
method public abstract void captureEndValues(android.transition.TransitionValues); method public abstract void captureEndValues(android.transition.TransitionValues);
method public abstract void captureStartValues(android.transition.TransitionValues); method public abstract void captureStartValues(android.transition.TransitionValues);
@@ -36068,6 +36067,7 @@ package android.transition {
method public java.util.List<android.view.View> getTargets(); method public java.util.List<android.view.View> getTargets();
method public java.lang.String[] getTransitionProperties(); method public java.lang.String[] getTransitionProperties();
method public android.transition.TransitionValues getTransitionValues(android.view.View, boolean); method public android.transition.TransitionValues getTransitionValues(android.view.View, boolean);
method public boolean isTransitionRequired(android.transition.TransitionValues, android.transition.TransitionValues);
method public android.transition.Transition removeListener(android.transition.Transition.TransitionListener); method public android.transition.Transition removeListener(android.transition.Transition.TransitionListener);
method public android.transition.Transition removeTarget(int); method public android.transition.Transition removeTarget(int);
method public android.transition.Transition removeTarget(java.lang.String); method public android.transition.Transition removeTarget(java.lang.String);

View File

@@ -19,6 +19,7 @@ package android.transition;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator; import android.animation.TimeInterpolator;
import android.annotation.Nullable;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Path; import android.graphics.Path;
@@ -700,7 +701,7 @@ public abstract class Transition implements Cloneable {
continue; continue;
} }
// Only bother trying to animate with values that differ between start/end // Only bother trying to animate with values that differ between start/end
boolean isChanged = start == null || end == null || areValuesChanged(start, end); boolean isChanged = start == null || end == null || isTransitionRequired(start, end);
if (isChanged) { if (isChanged) {
if (DBG) { if (DBG) {
View view = (end != null) ? end.view : start.view; View view = (end != null) ? end.view : start.view;
@@ -1747,7 +1748,7 @@ public abstract class Transition implements Cloneable {
endValues = mEndValues.viewValues.get(oldView); endValues = mEndValues.viewValues.get(oldView);
} }
boolean cancel = (startValues != null || endValues != null) && boolean cancel = (startValues != null || endValues != null) &&
oldInfo.transition.areValuesChanged(oldValues, endValues); oldInfo.transition.isTransitionRequired(oldValues, endValues);
if (cancel) { if (cancel) {
if (anim.isRunning() || anim.isStarted()) { if (anim.isRunning() || anim.isStarted()) {
if (DBG) { if (DBG) {
@@ -1770,32 +1771,36 @@ public abstract class Transition implements Cloneable {
} }
/** /**
* Returns whether transition values have changed between the start scene and the end scene * Returns whether or not the transition should create an Animator, based on the values
* (thus determining whether animation is required). The default implementation compares the * captured during {@link #captureStartValues(TransitionValues)} and
* {@link #captureEndValues(TransitionValues)}. The default implementation compares the
* property values returned from {@link #getTransitionProperties()}, or all property values if * property values returned from {@link #getTransitionProperties()}, or all property values if
* {@code getTransitionProperties()} returns null. Subclasses may override this method to * {@code getTransitionProperties()} returns null. Subclasses may override this method to
* provide logic more specific to their transition implementation. * provide logic more specific to the transition implementation.
* *
* @param oldValues the first set of values, may be {@code null} * @param startValues the values from captureStartValues, This may be {@code null} if the
* @param newValues the second set of values, may be {@code null} * View did not exist in the start state.
* @param endValues the values from captureEndValues. This may be {@code null} if the View
* did not exist in the end state.
*/ */
protected boolean areValuesChanged(TransitionValues oldValues, TransitionValues newValues) { public boolean isTransitionRequired(@Nullable TransitionValues startValues,
@Nullable TransitionValues endValues) {
boolean valuesChanged = false; boolean valuesChanged = false;
// if oldValues null, then transition didn't care to stash values, // if startValues null, then transition didn't care to stash values,
// and won't get canceled // and won't get canceled
if (oldValues != null && newValues != null) { if (startValues != null && endValues != null) {
String[] properties = getTransitionProperties(); String[] properties = getTransitionProperties();
if (properties != null) { if (properties != null) {
int count = properties.length; int count = properties.length;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if (isValueChanged(oldValues, newValues, properties[i])) { if (isValueChanged(startValues, endValues, properties[i])) {
valuesChanged = true; valuesChanged = true;
break; break;
} }
} }
} else { } else {
for (String key : oldValues.values.keySet()) { for (String key : startValues.values.keySet()) {
if (isValueChanged(oldValues, newValues, key)) { if (isValueChanged(startValues, endValues, key)) {
valuesChanged = true; valuesChanged = true;
break; break;
} }

View File

@@ -462,18 +462,18 @@ public abstract class Visibility extends Transition {
} }
@Override @Override
protected boolean areValuesChanged(TransitionValues oldValues, TransitionValues newValues) { public boolean isTransitionRequired(TransitionValues startValues, TransitionValues newValues) {
if (oldValues == null && newValues == null) { if (startValues == null && newValues == null) {
return false; return false;
} }
if (oldValues != null && newValues != null && if (startValues != null && newValues != null &&
newValues.values.containsKey(PROPNAME_VISIBILITY) != newValues.values.containsKey(PROPNAME_VISIBILITY) !=
oldValues.values.containsKey(PROPNAME_VISIBILITY)) { startValues.values.containsKey(PROPNAME_VISIBILITY)) {
// The transition wasn't targeted in either the start or end, so it couldn't // The transition wasn't targeted in either the start or end, so it couldn't
// have changed. // have changed.
return false; return false;
} }
VisibilityInfo changeInfo = getVisibilityChangeInfo(oldValues, newValues); VisibilityInfo changeInfo = getVisibilityChangeInfo(startValues, newValues);
return changeInfo.visibilityChange && (changeInfo.startVisibility == View.VISIBLE || return changeInfo.visibilityChange && (changeInfo.startVisibility == View.VISIBLE ||
changeInfo.endVisibility == View.VISIBLE); changeInfo.endVisibility == View.VISIBLE);
} }