Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        // Creates an OrientationHelper for the given LayoutManager and orientation.
        //
        // @param layoutManager LayoutManager to attach to
        // @param orientation   Desired orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}
        // @return A new OrientationHelper
        public static OrientationHelper CreateOrientationHelper(
            FlexibleViewLayoutManager layoutManager, int orientation)
        {
            if (orientation == HORIZONTAL)
            {
                return(CreateHorizontalHelper(layoutManager));
            }
            else if (orientation == VERTICAL)
            {
                return(CreateVerticalHelper(layoutManager));
            }

            throw new ArgumentException("invalid orientation");
        }
Exemplo n.º 4
0
        public void SetLayoutManager(FlexibleViewLayoutManager layoutManager)
        {
            if (null == layoutManager)
            {
                return;
            }
            mLayout = layoutManager;

            mLayout.SetRecyclerView(this);

            if (mLayout.CanScrollHorizontally())
            {
                mPanGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
            }
            else if (mLayout.CanScrollVertically())
            {
                mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
            }
        }
Exemplo n.º 5
0
 public OrientationHelper(FlexibleViewLayoutManager layoutManager)
 {
     this.layoutManager = layoutManager;
 }
Exemplo n.º 6
0
 public VerticalHelper(FlexibleViewLayoutManager layoutManager) : base(layoutManager)
 {
 }
Exemplo n.º 7
0
 public HorizontalHelper(FlexibleViewLayoutManager layoutManager) : base(layoutManager)
 {
 }
Exemplo n.º 8
0
 // Creates a vertical OrientationHelper for the given LayoutManager.
 //
 // @param layoutManager The LayoutManager to attach to.
 // @return A new OrientationHelper
 public static OrientationHelper CreateVerticalHelper(FlexibleViewLayoutManager layoutManager)
 {
     return(new VerticalHelper(layoutManager));
 }
Exemplo n.º 9
0
 // Creates a horizontal OrientationHelper for the given LayoutManager.
 //
 // @param layoutManager The LayoutManager to attach to.
 // @return A new OrientationHelper
 public static OrientationHelper CreateHorizontalHelper(FlexibleViewLayoutManager layoutManager)
 {
     return(new HorizontalHelper(layoutManager));
 }