Loading api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -45895,7 +45895,8 @@ package android.transition { } public class TransitionValues { ctor public TransitionValues(); ctor public deprecated TransitionValues(); ctor public TransitionValues(android.view.View); field public final java.util.Map<java.lang.String, java.lang.Object> values; field public android.view.View view; } core/java/android/transition/Transition.java +6 −10 Original line number Diff line number Diff line Loading @@ -531,7 +531,7 @@ public abstract class Transition implements Cloneable { View view = unmatchedStart.keyAt(i); if (view != null && isValidTarget(view)) { TransitionValues end = unmatchedEnd.remove(view); if (end != null && end.view != null && isValidTarget(end.view)) { if (end != null && isValidTarget(end.view)) { TransitionValues start = unmatchedStart.removeAt(i); mStartValuesList.add(start); mEndValuesList.add(end); Loading Loading @@ -738,9 +738,8 @@ public abstract class Transition implements Cloneable { if (end != null) { view = end.view; String[] properties = getTransitionProperties(); if (view != null && properties != null && properties.length > 0) { infoValues = new TransitionValues(); infoValues.view = view; if (properties != null && properties.length > 0) { infoValues = new TransitionValues(view); TransitionValues newValues = endValues.viewValues.get(view); if (newValues != null) { for (int j = 0; j < properties.length; ++j) { Loading Loading @@ -1431,8 +1430,7 @@ public abstract class Transition implements Cloneable { int id = mTargetIds.get(i); View view = sceneRoot.findViewById(id); if (view != null) { TransitionValues values = new TransitionValues(); values.view = view; TransitionValues values = new TransitionValues(view); if (start) { captureStartValues(values); } else { Loading @@ -1449,8 +1447,7 @@ public abstract class Transition implements Cloneable { } for (int i = 0; i < mTargets.size(); ++i) { View view = mTargets.get(i); TransitionValues values = new TransitionValues(); values.view = view; TransitionValues values = new TransitionValues(view); if (start) { captureStartValues(values); } else { Loading Loading @@ -1576,8 +1573,7 @@ public abstract class Transition implements Cloneable { } } if (view.getParent() instanceof ViewGroup) { TransitionValues values = new TransitionValues(); values.view = view; TransitionValues values = new TransitionValues(view); if (start) { captureStartValues(values); } else { Loading core/java/android/transition/TransitionValues.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.transition; import android.annotation.NonNull; import android.util.ArrayMap; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -43,19 +44,32 @@ import java.util.Map; */ public class TransitionValues { /** @deprecated Use {@link #TransitionValues(View)} instead */ @Deprecated public TransitionValues() { } public TransitionValues(@NonNull View view) { this.view = view; } /** * The View with these values */ @SuppressWarnings("NullableProblems") // Can't make it final because of deprecated constructor. @NonNull public View view; /** * The set of values tracked by transitions for this scene */ @NonNull public final Map<String, Object> values = new ArrayMap<String, Object>(); /** * The Transitions that targeted this view. */ @NonNull final ArrayList<Transition> targetedTransitions = new ArrayList<Transition>(); @Override Loading core/java/android/transition/Visibility.java +87 −58 Original line number Diff line number Diff line Loading @@ -360,15 +360,49 @@ public abstract class Visibility extends Transition { return null; } View startView = (startValues != null) ? startValues.view : null; View endView = (endValues != null) ? endValues.view : null; if (startValues == null) { // startValues(and startView) will never be null for disappear transition. return null; } final View startView = startValues.view; final View endView = (endValues != null) ? endValues.view : null; View overlayView = null; View viewToKeep = null; boolean reusingOverlayView = false; View savedOverlayView = (View) startView.getTag(R.id.transition_overlay_view_tag); if (savedOverlayView != null) { // we've already created overlay for the start view. // it means that we are applying two visibility // transitions for the same view overlayView = savedOverlayView; reusingOverlayView = true; } else { boolean needOverlayForStartView = false; if (endView == null || endView.getParent() == null) { if (endView != null) { // endView was removed from its parent - add it to the overlay overlayView = endView; } else if (startView != null) { } else { needOverlayForStartView = true; } } else { // visibility change if (endVisibility == View.INVISIBLE) { viewToKeep = endView; } else { // Becoming GONE if (startView == endView) { viewToKeep = endView; } else { needOverlayForStartView = true; } } } if (needOverlayForStartView) { // endView does not exist. Use startView only under certain // conditions, because placing a view in an overlay necessitates // it being removed from its current parent Loading @@ -385,38 +419,27 @@ public abstract class Visibility extends Transition { if (!parentVisibilityInfo.visibilityChange) { overlayView = TransitionUtils.copyViewImage(sceneRoot, startView, startParent); } else if (startParent.getParent() == null) { } else { int id = startParent.getId(); if (id != View.NO_ID && sceneRoot.findViewById(id) != null && mCanRemoveViews) { if (startParent.getParent() == null && id != View.NO_ID && sceneRoot.findViewById(id) != null && mCanRemoveViews) { // no parent, but its parent is unparented but the parent // hierarchy has been replaced by a new hierarchy with the same id // and it is safe to un-parent startView overlayView = startView; } else { // TODO: Handle this case as well } } } } } else { // visibility change if (endVisibility == View.INVISIBLE) { viewToKeep = endView; } else { // Becoming GONE if (startView == endView) { viewToKeep = endView; } else if (mCanRemoveViews) { overlayView = startView; } else { overlayView = TransitionUtils.copyViewImage(sceneRoot, startView, (View) startView.getParent()); } } } final int finalVisibility = endVisibility; if (overlayView != null) { // TODO: Need to do this for general case of adding to overlay final ViewGroupOverlay overlay; if (!reusingOverlayView) { overlay = sceneRoot.getOverlay(); int[] screenLoc = (int[]) startValues.values.get(PROPNAME_SCREEN_LOCATION); int screenX = screenLoc[0]; int screenY = screenLoc[1]; Loading @@ -424,12 +447,16 @@ public abstract class Visibility extends Transition { sceneRoot.getLocationOnScreen(loc); overlayView.offsetLeftAndRight((screenX - loc[0]) - overlayView.getLeft()); overlayView.offsetTopAndBottom((screenY - loc[1]) - overlayView.getTop()); final ViewGroupOverlay overlay = sceneRoot.getOverlay(); overlay.add(overlayView); } else { overlay = null; } Animator animator = onDisappear(sceneRoot, overlayView, startValues, endValues); if (!reusingOverlayView) { if (animator == null) { overlay.remove(overlayView); } else { startView.setTagInternal(R.id.transition_overlay_view_tag, overlayView); final View finalOverlayView = overlayView; addListener(new TransitionListenerAdapter() { Loading @@ -449,11 +476,13 @@ public abstract class Visibility extends Transition { @Override public void onTransitionEnd(Transition transition) { startView.setTagInternal(R.id.transition_overlay_view_tag, null); overlay.remove(finalOverlayView); transition.removeListener(this); } }); } } return animator; } Loading @@ -463,7 +492,7 @@ public abstract class Visibility extends Transition { Animator animator = onDisappear(sceneRoot, viewToKeep, startValues, endValues); if (animator != null) { DisappearListener disappearListener = new DisappearListener(viewToKeep, finalVisibility, mSuppressLayout); endVisibility, mSuppressLayout); animator.addListener(disappearListener); animator.addPauseListener(disappearListener); addListener(disappearListener); Loading core/res/res/values/ids.xml +3 −0 Original line number Diff line number Diff line Loading @@ -175,4 +175,7 @@ <!-- Accessibility action to notify a window there is an outside touch. --> <item type="id" name="accessibilityActionOutsideTouch" /> <!-- A tag used to save the view added to a transition overlay --> <item type="id" name="transition_overlay_view_tag" /> </resources> Loading
api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -45895,7 +45895,8 @@ package android.transition { } public class TransitionValues { ctor public TransitionValues(); ctor public deprecated TransitionValues(); ctor public TransitionValues(android.view.View); field public final java.util.Map<java.lang.String, java.lang.Object> values; field public android.view.View view; }
core/java/android/transition/Transition.java +6 −10 Original line number Diff line number Diff line Loading @@ -531,7 +531,7 @@ public abstract class Transition implements Cloneable { View view = unmatchedStart.keyAt(i); if (view != null && isValidTarget(view)) { TransitionValues end = unmatchedEnd.remove(view); if (end != null && end.view != null && isValidTarget(end.view)) { if (end != null && isValidTarget(end.view)) { TransitionValues start = unmatchedStart.removeAt(i); mStartValuesList.add(start); mEndValuesList.add(end); Loading Loading @@ -738,9 +738,8 @@ public abstract class Transition implements Cloneable { if (end != null) { view = end.view; String[] properties = getTransitionProperties(); if (view != null && properties != null && properties.length > 0) { infoValues = new TransitionValues(); infoValues.view = view; if (properties != null && properties.length > 0) { infoValues = new TransitionValues(view); TransitionValues newValues = endValues.viewValues.get(view); if (newValues != null) { for (int j = 0; j < properties.length; ++j) { Loading Loading @@ -1431,8 +1430,7 @@ public abstract class Transition implements Cloneable { int id = mTargetIds.get(i); View view = sceneRoot.findViewById(id); if (view != null) { TransitionValues values = new TransitionValues(); values.view = view; TransitionValues values = new TransitionValues(view); if (start) { captureStartValues(values); } else { Loading @@ -1449,8 +1447,7 @@ public abstract class Transition implements Cloneable { } for (int i = 0; i < mTargets.size(); ++i) { View view = mTargets.get(i); TransitionValues values = new TransitionValues(); values.view = view; TransitionValues values = new TransitionValues(view); if (start) { captureStartValues(values); } else { Loading Loading @@ -1576,8 +1573,7 @@ public abstract class Transition implements Cloneable { } } if (view.getParent() instanceof ViewGroup) { TransitionValues values = new TransitionValues(); values.view = view; TransitionValues values = new TransitionValues(view); if (start) { captureStartValues(values); } else { Loading
core/java/android/transition/TransitionValues.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.transition; import android.annotation.NonNull; import android.util.ArrayMap; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -43,19 +44,32 @@ import java.util.Map; */ public class TransitionValues { /** @deprecated Use {@link #TransitionValues(View)} instead */ @Deprecated public TransitionValues() { } public TransitionValues(@NonNull View view) { this.view = view; } /** * The View with these values */ @SuppressWarnings("NullableProblems") // Can't make it final because of deprecated constructor. @NonNull public View view; /** * The set of values tracked by transitions for this scene */ @NonNull public final Map<String, Object> values = new ArrayMap<String, Object>(); /** * The Transitions that targeted this view. */ @NonNull final ArrayList<Transition> targetedTransitions = new ArrayList<Transition>(); @Override Loading
core/java/android/transition/Visibility.java +87 −58 Original line number Diff line number Diff line Loading @@ -360,15 +360,49 @@ public abstract class Visibility extends Transition { return null; } View startView = (startValues != null) ? startValues.view : null; View endView = (endValues != null) ? endValues.view : null; if (startValues == null) { // startValues(and startView) will never be null for disappear transition. return null; } final View startView = startValues.view; final View endView = (endValues != null) ? endValues.view : null; View overlayView = null; View viewToKeep = null; boolean reusingOverlayView = false; View savedOverlayView = (View) startView.getTag(R.id.transition_overlay_view_tag); if (savedOverlayView != null) { // we've already created overlay for the start view. // it means that we are applying two visibility // transitions for the same view overlayView = savedOverlayView; reusingOverlayView = true; } else { boolean needOverlayForStartView = false; if (endView == null || endView.getParent() == null) { if (endView != null) { // endView was removed from its parent - add it to the overlay overlayView = endView; } else if (startView != null) { } else { needOverlayForStartView = true; } } else { // visibility change if (endVisibility == View.INVISIBLE) { viewToKeep = endView; } else { // Becoming GONE if (startView == endView) { viewToKeep = endView; } else { needOverlayForStartView = true; } } } if (needOverlayForStartView) { // endView does not exist. Use startView only under certain // conditions, because placing a view in an overlay necessitates // it being removed from its current parent Loading @@ -385,38 +419,27 @@ public abstract class Visibility extends Transition { if (!parentVisibilityInfo.visibilityChange) { overlayView = TransitionUtils.copyViewImage(sceneRoot, startView, startParent); } else if (startParent.getParent() == null) { } else { int id = startParent.getId(); if (id != View.NO_ID && sceneRoot.findViewById(id) != null && mCanRemoveViews) { if (startParent.getParent() == null && id != View.NO_ID && sceneRoot.findViewById(id) != null && mCanRemoveViews) { // no parent, but its parent is unparented but the parent // hierarchy has been replaced by a new hierarchy with the same id // and it is safe to un-parent startView overlayView = startView; } else { // TODO: Handle this case as well } } } } } else { // visibility change if (endVisibility == View.INVISIBLE) { viewToKeep = endView; } else { // Becoming GONE if (startView == endView) { viewToKeep = endView; } else if (mCanRemoveViews) { overlayView = startView; } else { overlayView = TransitionUtils.copyViewImage(sceneRoot, startView, (View) startView.getParent()); } } } final int finalVisibility = endVisibility; if (overlayView != null) { // TODO: Need to do this for general case of adding to overlay final ViewGroupOverlay overlay; if (!reusingOverlayView) { overlay = sceneRoot.getOverlay(); int[] screenLoc = (int[]) startValues.values.get(PROPNAME_SCREEN_LOCATION); int screenX = screenLoc[0]; int screenY = screenLoc[1]; Loading @@ -424,12 +447,16 @@ public abstract class Visibility extends Transition { sceneRoot.getLocationOnScreen(loc); overlayView.offsetLeftAndRight((screenX - loc[0]) - overlayView.getLeft()); overlayView.offsetTopAndBottom((screenY - loc[1]) - overlayView.getTop()); final ViewGroupOverlay overlay = sceneRoot.getOverlay(); overlay.add(overlayView); } else { overlay = null; } Animator animator = onDisappear(sceneRoot, overlayView, startValues, endValues); if (!reusingOverlayView) { if (animator == null) { overlay.remove(overlayView); } else { startView.setTagInternal(R.id.transition_overlay_view_tag, overlayView); final View finalOverlayView = overlayView; addListener(new TransitionListenerAdapter() { Loading @@ -449,11 +476,13 @@ public abstract class Visibility extends Transition { @Override public void onTransitionEnd(Transition transition) { startView.setTagInternal(R.id.transition_overlay_view_tag, null); overlay.remove(finalOverlayView); transition.removeListener(this); } }); } } return animator; } Loading @@ -463,7 +492,7 @@ public abstract class Visibility extends Transition { Animator animator = onDisappear(sceneRoot, viewToKeep, startValues, endValues); if (animator != null) { DisappearListener disappearListener = new DisappearListener(viewToKeep, finalVisibility, mSuppressLayout); endVisibility, mSuppressLayout); animator.addListener(disappearListener); animator.addPauseListener(disappearListener); addListener(disappearListener); Loading
core/res/res/values/ids.xml +3 −0 Original line number Diff line number Diff line Loading @@ -175,4 +175,7 @@ <!-- Accessibility action to notify a window there is an outside touch. --> <item type="id" name="accessibilityActionOutsideTouch" /> <!-- A tag used to save the view added to a transition overlay --> <item type="id" name="transition_overlay_view_tag" /> </resources>