diff options
Diffstat (limited to 'core/java/android/view')
| -rw-r--r-- | core/java/android/view/GhostView.java | 10 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 14 |
2 files changed, 17 insertions, 7 deletions
diff --git a/core/java/android/view/GhostView.java b/core/java/android/view/GhostView.java index 41502b6..d1b96ba 100644 --- a/core/java/android/view/GhostView.java +++ b/core/java/android/view/GhostView.java @@ -39,7 +39,7 @@ public class GhostView extends View { mView = view; mView.mGhostView = this; final ViewGroup parent = (ViewGroup) mView.getParent(); - setGhostedVisibility(View.INVISIBLE); + mView.setTransitionVisibility(View.INVISIBLE); parent.invalidate(); } @@ -66,19 +66,15 @@ public class GhostView extends View { super.setVisibility(visibility); if (mView.mGhostView == this) { int inverseVisibility = (visibility == View.VISIBLE) ? View.INVISIBLE : View.VISIBLE; - setGhostedVisibility(inverseVisibility); + mView.setTransitionVisibility(inverseVisibility); } } - private void setGhostedVisibility(int visibility) { - mView.mViewFlags = (mView.mViewFlags & ~View.VISIBILITY_MASK) | visibility; - } - @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (!mBeingMoved) { - setGhostedVisibility(View.VISIBLE); + mView.setTransitionVisibility(View.VISIBLE); mView.mGhostView = null; final ViewGroup parent = (ViewGroup) mView.getParent(); if (parent != null) { diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 9269fd2..b038581 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8786,6 +8786,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * Change the visibility of the View without triggering any other changes. This is + * important for transitions, where visibility changes should not adjust focus or + * trigger a new layout. This is only used when the visibility has already been changed + * and we need a transient value during an animation. When the animation completes, + * the original visibility value is always restored. + * + * @param visibility One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}. + * @hide + */ + public void setTransitionVisibility(@Visibility int visibility) { + mViewFlags = (mViewFlags & ~View.VISIBILITY_MASK) | visibility; + } + + /** * Reset the flag indicating the accessibility state of the subtree rooted * at this view changed. */ |
