Merge "Fixed error in invalidation/LayoutTransition logic"
This commit is contained in:
@@ -6434,8 +6434,10 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
|
|||||||
if ((changed & VISIBILITY_MASK) != 0) {
|
if ((changed & VISIBILITY_MASK) != 0) {
|
||||||
/*
|
/*
|
||||||
* If this view is becoming visible, invalidate it in case it changed while
|
* If this view is becoming visible, invalidate it in case it changed while
|
||||||
* it was not visible.
|
* it was not visible. Marking it drawn ensures that the invalidation will
|
||||||
|
* go through.
|
||||||
*/
|
*/
|
||||||
|
mPrivateFlags |= DRAWN;
|
||||||
invalidate(true);
|
invalidate(true);
|
||||||
|
|
||||||
needGlobalAttributesUpdate(true);
|
needGlobalAttributesUpdate(true);
|
||||||
@@ -6454,11 +6456,17 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
|
|||||||
if ((changed & GONE) != 0) {
|
if ((changed & GONE) != 0) {
|
||||||
needGlobalAttributesUpdate(false);
|
needGlobalAttributesUpdate(false);
|
||||||
requestLayout();
|
requestLayout();
|
||||||
invalidate(true);
|
|
||||||
|
|
||||||
if (((mViewFlags & VISIBILITY_MASK) == GONE)) {
|
if (((mViewFlags & VISIBILITY_MASK) == GONE)) {
|
||||||
if (hasFocus()) clearFocus();
|
if (hasFocus()) clearFocus();
|
||||||
destroyDrawingCache();
|
destroyDrawingCache();
|
||||||
|
if (mParent instanceof View) {
|
||||||
|
// GONE views noop invalidation, so invalidate the parent
|
||||||
|
((View) mParent).invalidate(true);
|
||||||
|
}
|
||||||
|
// Mark the view drawn to ensure that it gets invalidated properly the next
|
||||||
|
// time it is visible and gets invalidated
|
||||||
|
mPrivateFlags |= DRAWN;
|
||||||
}
|
}
|
||||||
if (mAttachInfo != null) {
|
if (mAttachInfo != null) {
|
||||||
mAttachInfo.mViewVisibilityChanged = true;
|
mAttachInfo.mViewVisibilityChanged = true;
|
||||||
@@ -8073,6 +8081,15 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not invalidate views which are not visible and which are not running an animation. They
|
||||||
|
* will not get drawn and they should not set dirty flags as if they will be drawn
|
||||||
|
*/
|
||||||
|
private boolean skipInvalidate() {
|
||||||
|
return (mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null &&
|
||||||
|
(!(mParent instanceof ViewGroup) ||
|
||||||
|
!((ViewGroup) mParent).isViewTransitioning(this));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Mark the the area defined by dirty as needing to be drawn. If the view is
|
* Mark the the area defined by dirty as needing to be drawn. If the view is
|
||||||
* visible, {@link #onDraw(android.graphics.Canvas)} will be called at some point
|
* visible, {@link #onDraw(android.graphics.Canvas)} will be called at some point
|
||||||
@@ -8087,9 +8104,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
|
|||||||
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
|
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
|
if (skipInvalidate()) {
|
||||||
// Noop for views which are not visible and which are not running an animation. They
|
|
||||||
// will not get drawn and they should not set dirty flags as if they will be drawn
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
||||||
@@ -8135,9 +8150,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
|
|||||||
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
|
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
|
if (skipInvalidate()) {
|
||||||
// Noop for views which are not visible and which are not running an animation. They
|
|
||||||
// will not get drawn and they should not set dirty flags as if they will be drawn
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
||||||
@@ -8192,9 +8205,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
|
|||||||
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
|
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
|
if (skipInvalidate()) {
|
||||||
// Noop for views which are not visible and which are not running an animation. They
|
|
||||||
// will not get drawn and they should not set dirty flags as if they will be drawn
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
||||||
@@ -8232,9 +8243,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void fastInvalidate() {
|
public void fastInvalidate() {
|
||||||
if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
|
if (skipInvalidate()) {
|
||||||
// Noop for views which are not visible and which are not running an animation. They
|
|
||||||
// will not get drawn and they should not set dirty flags as if they will be drawn
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
|
||||||
|
|||||||
@@ -4748,6 +4748,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility function called by View during invalidation to determine whether a view that
|
||||||
|
* is invisible or gone should still be invalidated because it is being transitioned (and
|
||||||
|
* therefore still needs to be drawn).
|
||||||
|
*/
|
||||||
|
boolean isViewTransitioning(View view) {
|
||||||
|
return (mTransitioningViews != null && mTransitioningViews.contains(view));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method tells the ViewGroup that the given View object, which should have this
|
* This method tells the ViewGroup that the given View object, which should have this
|
||||||
* ViewGroup as its parent,
|
* ViewGroup as its parent,
|
||||||
|
|||||||
Reference in New Issue
Block a user