/// <summary> /// Merges all the listeners registered on the specified observer with the listeners /// registered on this object. /// </summary> /// <remarks> /// Merges all the listeners registered on the specified observer with the listeners /// registered on this object. After this method is invoked, the specified observer /// will return false in /// <see cref="isAlive()">isAlive()</see> /// and should not be used anymore. /// </remarks> /// <param name="observer">The ViewTreeObserver whose listeners must be added to this observer /// </param> internal void merge(android.view.ViewTreeObserver observer) { if (observer.mOnGlobalFocusListeners != null) { if (mOnGlobalFocusListeners != null) { mOnGlobalFocusListeners.addAll(observer.mOnGlobalFocusListeners); } else { mOnGlobalFocusListeners = observer.mOnGlobalFocusListeners; } } if (observer.mOnGlobalLayoutListeners != null) { if (mOnGlobalLayoutListeners != null) { mOnGlobalLayoutListeners.addAll(observer.mOnGlobalLayoutListeners); } else { mOnGlobalLayoutListeners = observer.mOnGlobalLayoutListeners; } } if (observer.mOnPreDrawListeners != null) { if (mOnPreDrawListeners != null) { mOnPreDrawListeners.addAll(observer.mOnPreDrawListeners); } else { mOnPreDrawListeners = observer.mOnPreDrawListeners; } } if (observer.mOnTouchModeChangeListeners != null) { if (mOnTouchModeChangeListeners != null) { mOnTouchModeChangeListeners.addAll(observer.mOnTouchModeChangeListeners); } else { mOnTouchModeChangeListeners = observer.mOnTouchModeChangeListeners; } } if (observer.mOnComputeInternalInsetsListeners != null) { if (mOnComputeInternalInsetsListeners != null) { mOnComputeInternalInsetsListeners.addAll(observer.mOnComputeInternalInsetsListeners ); } else { mOnComputeInternalInsetsListeners = observer.mOnComputeInternalInsetsListeners; } } observer.kill(); }