/// <summary> /// This method should always be called following an earlier call to /// <see cref="startViewTransition(View)">startViewTransition(View)</see> /// . The given View is finally removed from its parent /// and will no longer be displayed. Note that this method does not perform the functionality /// of removing a view from its parent; it just discontinues the display of a View that /// has previously been removed. /// </summary> /// <returns> /// view The View object that has been removed but is being kept around in the visible /// hierarchy by an earlier call to /// <see cref="startViewTransition(View)">startViewTransition(View)</see> /// . /// </returns> public virtual void endViewTransition(android.view.View view) { if (mTransitioningViews != null) { mTransitioningViews.remove(view); java.util.ArrayList<android.view.View> disappearingChildren = mDisappearingChildren; if (disappearingChildren != null && disappearingChildren.contains(view)) { disappearingChildren.remove(view); if (mVisibilityChangingChildren != null && mVisibilityChangingChildren.contains(view )) { mVisibilityChangingChildren.remove(view); } else { if (view.mAttachInfo != null) { view.dispatchDetachedFromWindow(); } if (view.mParent != null) { view.mParent = null; } } mGroupFlags |= FLAG_INVALIDATE_REQUIRED; } } }
/// <summary>Finishes the removal of a detached view.</summary> /// <remarks> /// Finishes the removal of a detached view. This method will dispatch the detached from /// window event and notify the hierarchy change listener. /// </remarks> /// <param name="child">the child to be definitely removed from the view hierarchy</param> /// <param name="animate"> /// if true and the view has an animation, the view is placed in the /// disappearing views list, otherwise, it is detached from the window /// </param> /// <seealso cref="attachViewToParent(View, int, LayoutParams)">attachViewToParent(View, int, LayoutParams) /// </seealso> /// <seealso cref="detachAllViewsFromParent()">detachAllViewsFromParent()</seealso> /// <seealso cref="detachViewFromParent(View)">detachViewFromParent(View)</seealso> /// <seealso cref="detachViewFromParent(int)">detachViewFromParent(int)</seealso> protected internal virtual void removeDetachedView(android.view.View child, bool animate_1) { if (mTransition != null) { mTransition.removeChild(this, child); } if (child == mFocused) { child.clearFocus(); } if ((animate_1 && child.getAnimation() != null) || (mTransitioningViews != null && mTransitioningViews.contains(child))) { addDisappearingView(child); } else { if (child.mAttachInfo != null) { child.dispatchDetachedFromWindow(); } } onViewRemoved(child); }
/// <summary>Cleanup a view when its animation is done.</summary> /// <remarks> /// Cleanup a view when its animation is done. This may mean removing it from /// the list of disappearing views. /// </remarks> /// <param name="view">The view whose animation has finished</param> /// <param name="animation">The animation, cannot be null</param> private void finishAnimatingView(android.view.View view, android.view.animation.Animation animation) { java.util.ArrayList<android.view.View> disappearingChildren = mDisappearingChildren; if (disappearingChildren != null) { if (disappearingChildren.contains(view)) { disappearingChildren.remove(view); if (view.mAttachInfo != null) { view.dispatchDetachedFromWindow(); } view.clearAnimation(); mGroupFlags |= FLAG_INVALIDATE_REQUIRED; } } if (animation != null && !animation.getFillAfter()) { view.clearAnimation(); } if ((view.mPrivateFlags & ANIMATION_STARTED) == ANIMATION_STARTED) { view.onAnimationEnd(); // Should be performed by onAnimationEnd() but this avoid an infinite loop, // so we'd rather be safe than sorry view.mPrivateFlags &= ~ANIMATION_STARTED; // Draw one more frame after the animation is done mGroupFlags |= FLAG_INVALIDATE_REQUIRED; } }
private void removeViewInternal(int index, android.view.View view) { if (mTransition != null) { mTransition.removeChild(this, view); } bool clearChildFocus_1 = false; if (view == mFocused) { view.clearFocusForRemoval(); clearChildFocus_1 = true; } if (view.getAnimation() != null || (mTransitioningViews != null && mTransitioningViews .contains(view))) { addDisappearingView(view); } else { if (view.mAttachInfo != null) { view.dispatchDetachedFromWindow(); } } onViewRemoved(view); needGlobalAttributesUpdate(false); removeFromArray(index); if (clearChildFocus_1) { clearChildFocus(view); } }