示例#1
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                if (mLayout != null)
                {
                    mLayout.StopScroll(false);
                    mLayout.ClearRecyclerView();
                    mLayout = null;
                }

                if (mAdapter != null)
                {
                    mAdapter.ItemEvent -= OnItemEvent;
                }

                if (mPanGestureDetector != null)
                {
                    mPanGestureDetector.Detected -= OnPanGestureDetected;
                    mPanGestureDetector.Dispose();
                    mPanGestureDetector = null;
                }

                if (mScrollBarShowTimer != null)
                {
                    mScrollBarShowTimer.Tick -= OnShowTimerTick;
                    mScrollBarShowTimer.Stop();
                    mScrollBarShowTimer.Dispose();
                    mScrollBarShowTimer = null;
                }

                if (mRecyclerPool != null)
                {
                    mRecyclerPool.Clear();
                    mRecyclerPool = null;
                }

                if (mChildHelper != null)
                {
                    mChildHelper.Clear();
                    mChildHelper.Dispose();
                    mChildHelper = null;
                }
            }
            base.Dispose(type);
        }
示例#2
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                if (layout != null)
                {
                    layout.StopScroll(false);
                    layout.ClearRecyclerView();
                    layout = null;
                }

                if (adapter != null)
                {
                    adapter.ItemEvent -= OnItemEvent;
                }

                if (panGestureDetector != null)
                {
                    panGestureDetector.Detected -= OnPanGestureDetected;
                    panGestureDetector.Dispose();
                    panGestureDetector = null;
                }

                if (scrollBarShowTimer != null)
                {
                    scrollBarShowTimer.Tick -= OnShowTimerTick;
                    scrollBarShowTimer.Stop();
                    scrollBarShowTimer.Dispose();
                    scrollBarShowTimer = null;
                }

                if (recyclerPool != null)
                {
                    recyclerPool.Clear();
                    recyclerPool = null;
                }

                if (childHelper != null)
                {
                    childHelper.Clear();
                    childHelper.Dispose();
                    childHelper = null;
                }
            }
            base.Dispose(type);
        }