Improve Visibility parent value check.

Bug 17412818
Bug 16398271

The Visibility Transition must not run against children that
are already disappearing or there will be, for example, a double
fade-out effect. Before this change, if a parent matched another
view, it would prevent its child from disappearing.

This change also removes using the overlay for children that have
been removed from the view hierarchy indirectly. This prevents
ListView and RecyclerView children from being added to the overlay.

Change-Id: Iac0610f0939da8643b98812ee1ec1c8d1d70a215
This commit is contained in:
George Mount
2014-09-07 15:04:03 -07:00
parent fdd04d42d2
commit 9f1ac3976e

View File

@@ -358,12 +358,16 @@ public abstract class Visibility extends Transition {
overlayView = startView;
} else if (startView.getParent() instanceof View) {
View startParent = (View) startView.getParent();
if (!isValidTarget(startParent)) {
if (startView.isAttachedToWindow()) {
overlayView = copyViewImage(startView);
} else {
overlayView = startView;
}
VisibilityInfo parentVisibilityInfo = null;
TransitionValues endParentValues = getMatchedTransitionValues(startParent,
true);
if (endParentValues != null) {
TransitionValues startParentValues = getTransitionValues(startParent, true);
parentVisibilityInfo =
getVisibilityChangeInfo(startParentValues, endParentValues);
}
if (parentVisibilityInfo == null || !parentVisibilityInfo.visibilityChange) {
overlayView = copyViewImage(startView);
} else if (startParent.getParent() == null) {
int id = startParent.getId();
if (id != View.NO_ID && sceneRoot.findViewById(id) != null