public ChildHelper(FlexibleView owner) { flexibleView = owner; tapGestureDetector = new TapGestureDetector(); tapGestureDetector.Detected += OnTapGestureDetected; }
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); }
/** * 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); }
/** * 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)); }
internal void ClearRecyclerView() { mFlexibleView = null; mChildHelper = null; }
internal void SetRecyclerView(FlexibleView recyclerView) { mFlexibleView = recyclerView; mChildHelper = recyclerView.GetChildHelper(); }
public FlexibleViewRecycler(FlexibleView recyclerView) { mFlexibleView = recyclerView; }
public AdapterHelper(FlexibleView flexibleView) { mFlexibleView = flexibleView; }
public RecycledViewPool(FlexibleView flexibleView) { mFlexibleView = flexibleView; mScrap = new List <FlexibleViewViewHolder> [mMaxTypeCount]; }
public virtual void OnDetachedFromRecyclerView(FlexibleView flexibleView) { }
public virtual void OnAttachedToRecyclerView(FlexibleView flexibleView) { }
public virtual void OnFocusChange(FlexibleView flexibleView, int previousFocus, int currentFocus) { }
public RecycledViewPool(FlexibleView flexibleView) { this.flexibleView = flexibleView; scrap = new List <FlexibleViewViewHolder> [maxTypeCount]; }
internal void ClearRecyclerView() { flexibleView = null; childHelper = null; }