public void OnGlobalLayout() { _bottomBar.ShyHeightAlreadyCalculated = true; int newHeight = _outerContainer.Height + _navBarHeightCopy; _outerContainer.LayoutParameters.Height = newHeight; if (_bottomBar.IsShy) { int defaultOffset = _bottomBar.UseExtraOffset ? _navBarHeightCopy : 0; _bottomBar.TranslationY = defaultOffset; ((CoordinatorLayout.LayoutParams)_bottomBar.LayoutParameters).Behavior = new BottomNavigationBehavior <View>(newHeight, defaultOffset, _isShy, _isTabletMode); } ViewTreeObserver obs = _outerContainer.ViewTreeObserver; if (obs.IsAlive) { if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean) { obs.RemoveOnGlobalLayoutListener(this); } else { obs.RemoveGlobalOnLayoutListener(this); } } }
public void Cleanup() { if (null == mImageView) { return; // cleanup already done } ImageView imageView = (ImageView)(((Reference)mImageView).Get()); if (null != imageView) { // Remove this as a global layout listener ViewTreeObserver observer = imageView.ViewTreeObserver; if (null != observer && observer.IsAlive) { observer.RemoveGlobalOnLayoutListener(this); } // Remove the ImageView's reference to this imageView.SetOnTouchListener(null); // make sure a pending fling runnable won't be run CancelFling(); } if (null != mGestureDetector) { mGestureDetector.SetOnDoubleTapListener(null); } // Clear listeners too mMatrixChangeListener = null; mPhotoTapListener = null; mViewTapListener = null; // Finally, clear ImageView mImageView = null; }
public void RemoveFromWindow() { if (Parent is ViewGroup parent) { parent.RemoveView(this); } if (_bitmap != null) { _bitmap.Recycle(); _bitmap = null; } _eraser = null; _animationFactory = null; _canvas = null; _handler = null; if ((int)Build.VERSION.SdkInt < 16) { ViewTreeObserver.RemoveGlobalOnLayoutListener(this); } else { ViewTreeObserver.RemoveOnGlobalLayoutListener(this); } //mLayoutListener = null; _prefsManager?.Close(); _prefsManager = null; }
public void OnGlobalLayout() { var view = tabsContainer.GetChildAt(0); if ((int)Build.VERSION.SdkInt < 16) { ViewTreeObserver.RemoveGlobalOnLayoutListener(this); } else { ViewTreeObserver.RemoveOnGlobalLayoutListener(this); } if (isPaddingMiddle) { int halfWidthFirstTab = view.Width / 2; padding = Width / 2 - halfWidthFirstTab; } SetPadding(padding, PaddingTop, padding, PaddingBottom); if (scrollOffset == 0) { scrollOffset = Width / 2 - padding; } }
public void OnGlobalLayout() { var view = tabsContainer.GetChildAt(0); if ((int)Build.VERSION.SdkInt < 16) { ViewTreeObserver.RemoveGlobalOnLayoutListener(this); } else { ViewTreeObserver.RemoveOnGlobalLayoutListener(this); } if (isPaddingMiddle) { int halfWidthFirstTab = view.Width / 2; paddingLeft = paddingRight = Width / 2 - halfWidthFirstTab; } SetPadding(paddingLeft, PaddingTop, paddingRight, PaddingBottom); if (scrollOffset == 0) { scrollOffset = Width / 2 - paddingLeft; } currentPosition = pager.CurrentItem; currentPositionOffset = 0f; ScrollToChild(currentPosition, 0); UpdateSelection(currentPosition); }
private void DetachLayoutListener() { if (layoutListener != null) { ViewTreeObserver.RemoveGlobalOnLayoutListener(layoutListener); layoutListener = null; } }
private void RemoveGlobals() { if ((int)Build.VERSION.SdkInt < 16) { ViewTreeObserver.RemoveGlobalOnLayoutListener(MyOnGlobalLayoutListner); } else { ViewTreeObserver.RemoveOnGlobalLayoutListener(MyOnGlobalLayoutListner); } }
public static void AddOnGlobalLayoutSingleFire(this ViewTreeObserver observer, Action callback) { GlobalLayoutSingleFireListener listener = null; listener = new GlobalLayoutSingleFireListener(() => { if (observer.IsAlive) { observer.RemoveGlobalOnLayoutListener(listener); callback(); } }); observer.AddOnGlobalLayoutListener(listener); }
public void OnGlobalLayout() { int newHeight = _outerContainer.Height + _navBarHeightCopy; _outerContainer.LayoutParameters.Height = newHeight; ViewTreeObserver obs = _outerContainer.ViewTreeObserver; if (obs.IsAlive) { if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean) { obs.RemoveOnGlobalLayoutListener(this); } else { obs.RemoveGlobalOnLayoutListener(this); } } }