コード例 #1
0
            public ChildHelper(FlexibleView owner)
            {
                flexibleView = owner;

                tapGestureDetector           = new TapGestureDetector();
                tapGestureDetector.Detected += OnTapGestureDetected;
            }
コード例 #2
0
        internal bool GetRectOfVisibleChild(FlexibleView parent, FlexibleViewViewHolder child, FlexibleViewRecycler recycler, bool immediate)
        {
            Vector2 amounts = GetRectOfVisibleChildScrollAmount(parent, child);
            float   dx      = amounts[0];
            float   dy      = amounts[1];

            if (dx != 0 || dy != 0)
            {
                if (dx != 0 && CanScrollHorizontally())
                {
                    ScrollHorizontallyBy(dx, recycler, immediate);
                }
                else if (dy != 0 && CanScrollVertically())
                {
                    ScrollVerticallyBy(dy, recycler, immediate);
                }
                return(true);
            }
            return(false);
        }
コード例 #3
0
        /**
         * Requests that the given child of the FlexibleViewRecyclerView be positioned onto the screen. This
         * method can be called for both unfocusable and focusable child views. For unfocusable
         * child views, focusedChildVisible is typically true in which case, layout manager
         * makes the child view visible only if the currently focused child stays in-bounds of RV.
         * @param parent The parent FlexibleViewRecyclerView.
         * @param child The direct child making the request.
         * @param rect The rectangle in the child's coordinates the child
         *              wishes to be on the screen.
         * @param immediate True to forbid animated or delayed scrolling,
         *                  false otherwise
         * @param focusedChildVisible Whether the currently focused view must stay visible.
         * @return Whether the group scrolled to handle the operation
         */
        internal bool RequestChildRectangleOnScreen(FlexibleView parent, FlexibleViewViewHolder child, FlexibleViewRecycler recycler, bool immediate)
        {
            Vector2 scrollAmount = GetChildRectangleOnScreenScrollAmount(parent, child);
            float   dx           = scrollAmount[0];
            float   dy           = scrollAmount[1];

            if (dx != 0 || dy != 0)
            {
                if (dx != 0 && CanScrollHorizontally())
                {
                    ScrollHorizontallyBy(dx, recycler, immediate);
                }
                else if (dy != 0 && CanScrollVertically())
                {
                    ScrollVerticallyBy(dy, recycler, immediate);
                }
                return(true);
            }
            return(false);
        }
コード例 #4
0
        /**
         * Returns the scroll amount that brings the given rect in child's coordinate system within
         * the padded area of FlexibleViewRecyclerView.
         * @param parent The parent FlexibleViewRecyclerView.
         * @param child The direct child making the request.
         * @param rect The rectangle in the child's coordinates the child
         *             wishes to be on the screen.
         * @param immediate True to forbid animated or delayed scrolling,
         *                  false otherwise
         * @return The array containing the scroll amount in x and y directions that brings the
         * given rect into RV's padded area.
         */
        private Vector2 GetRectOfVisibleChildScrollAmount(FlexibleView parent, FlexibleViewViewHolder child)
        {
            int parentLeft   = PaddingLeft;
            int parentTop    = PaddingTop;
            int parentRight  = (int)Width - PaddingRight;
            int parentBottom = (int)Height - PaddingBottom;
            int childLeft    = (int)child.Left;
            int childTop     = (int)child.Top;
            int childRight   = (int)child.Right;
            int childBottom  = (int)child.Bottom;

            var offsetStart  = Math.Min(0, childLeft - parentLeft);
            var offsetEnd    = Math.Max(0, childRight - parentRight);
            var offsetTop    = Math.Min(0, childTop - parentTop);
            var offsetBottom = Math.Max(0, childBottom - parentBottom);

            int dx = offsetStart != 0 ? offsetStart : Math.Min(childLeft - parentLeft, offsetEnd);
            int dy = offsetTop != 0 ? offsetTop : Math.Min(childTop - parentTop, offsetBottom);

            return(new Vector2(-dx, -dy));
        }
コード例 #5
0
 internal void ClearRecyclerView()
 {
     mFlexibleView = null;
     mChildHelper  = null;
 }
コード例 #6
0
 internal void SetRecyclerView(FlexibleView recyclerView)
 {
     mFlexibleView = recyclerView;
     mChildHelper  = recyclerView.GetChildHelper();
 }
コード例 #7
0
 public FlexibleViewRecycler(FlexibleView recyclerView)
 {
     mFlexibleView = recyclerView;
 }
コード例 #8
0
 public AdapterHelper(FlexibleView flexibleView)
 {
     mFlexibleView = flexibleView;
 }
コード例 #9
0
 public RecycledViewPool(FlexibleView flexibleView)
 {
     mFlexibleView = flexibleView;
     mScrap        = new List <FlexibleViewViewHolder> [mMaxTypeCount];
 }
コード例 #10
0
 public virtual void OnDetachedFromRecyclerView(FlexibleView flexibleView)
 {
 }
コード例 #11
0
 public virtual void OnAttachedToRecyclerView(FlexibleView flexibleView)
 {
 }
コード例 #12
0
 public virtual void OnFocusChange(FlexibleView flexibleView, int previousFocus, int currentFocus)
 {
 }
コード例 #13
0
 public RecycledViewPool(FlexibleView flexibleView)
 {
     this.flexibleView = flexibleView;
     scrap             = new List <FlexibleViewViewHolder> [maxTypeCount];
 }
コード例 #14
0
 internal void ClearRecyclerView()
 {
     flexibleView = null;
     childHelper  = null;
 }