android.support.v7.widget.RecyclerView.Recycler Java Examples

The following examples show how to use android.support.v7.widget.RecyclerView.Recycler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 6 votes vote down vote up
private void recycleViewsFromEnd(Recycler recycler, int dt) {
    int childCount = getChildCount();
    if (dt >= 0) {
        int limit = this.mOrientationHelper.getEnd() - dt;
        int i;
        if (this.mShouldReverseLayout) {
            for (i = 0; i < childCount; i++) {
                if (this.mOrientationHelper.getDecoratedStart(getChildAt(i)) < limit) {
                    recycleChildren(recycler, 0, i);
                    return;
                }
            }
            return;
        }
        for (i = childCount - 1; i >= 0; i--) {
            if (this.mOrientationHelper.getDecoratedStart(getChildAt(i)) < limit) {
                recycleChildren(recycler, childCount - 1, i);
                return;
            }
        }
    }
}
 
Example #2
Source File: FocusableLinearLayoutManager.java    From ticdesign with Apache License 2.0 6 votes vote down vote up
@Override
public void onLayoutChildren(Recycler recycler, State state) {
    super.onLayoutChildren(recycler, state);

    if (mFocusStateRequest.notifyOnNextLayout) {
        mFocusStateRequest.notifyOnNextLayout = false;
        // If the notify has a animation, we should make sure the notify is later than
        // RecyclerView's animation. So they will not conflict.
        if (mFocusStateRequest.animate) {
            postOnAnimation(new Runnable() {
                @Override
                public void run() {
                    // We wait for animation time begin and notify on next main loop,
                    // So we can sure the notify is follow the state change animation.
                    notifyAfterLayoutOnNextMainLoop();
                }
            });
        } else {
            requestNotifyChildrenStateChanged(mFocusStateRequest);
        }
    }
}
 
Example #3
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 6 votes vote down vote up
int scrollBy(int dy, Recycler recycler, State state) {
    int i = 0;
    if (!(getChildCount() == 0 || dy == 0)) {
        this.mLayoutState.mRecycle = true;
        ensureLayoutState();
        int layoutDirection = dy > 0 ? 1 : -1;
        int absDy = Math.abs(dy);
        updateLayoutState(layoutDirection, absDy, true, state);
        int consumed = this.mLayoutState.mScrollingOffset + fill(recycler, this.mLayoutState, state, false);
        if (consumed >= 0) {
            if (absDy > consumed) {
                i = layoutDirection * consumed;
            } else {
                i = dy;
            }
            this.mOrientationHelper.offsetChildren(-i);
            this.mLayoutState.mLastScrollDelta = i;
        }
    }
    return i;
}
 
Example #4
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 6 votes vote down vote up
private int fixLayoutStartGap(int startOffset, Recycler recycler, State state, boolean canOffsetChildren) {
    int gap = startOffset - this.mOrientationHelper.getStartAfterPadding();
    if (gap <= 0) {
        return 0;
    }
    int fixOffset = -scrollBy(gap, recycler, state);
    startOffset += fixOffset;
    if (canOffsetChildren) {
        gap = startOffset - this.mOrientationHelper.getStartAfterPadding();
        if (gap > 0) {
            this.mOrientationHelper.offsetChildren(-gap);
            return fixOffset - gap;
        }
    }
    return fixOffset;
}
 
Example #5
Source File: GridLayoutManager.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onInitializeAccessibilityNodeInfoForItem(Recycler recycler, State state, View host, AccessibilityNodeInfoCompat info) {
    android.view.ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (lp instanceof LayoutParams) {
        LayoutParams glp = (LayoutParams) lp;
        int spanGroupIndex = getSpanGroupIndex(recycler, state, glp.getViewLayoutPosition());
        if (this.mOrientation == 0) {
            int spanIndex = glp.getSpanIndex();
            int spanSize = glp.getSpanSize();
            boolean z = this.mSpanCount > 1 && glp.getSpanSize() == this.mSpanCount;
            info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(spanIndex, spanSize, spanGroupIndex, 1, z, false));
            return;
        }
        int spanIndex2 = glp.getSpanIndex();
        int spanSize2 = glp.getSpanSize();
        boolean z2 = this.mSpanCount > 1 && glp.getSpanSize() == this.mSpanCount;
        info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(spanGroupIndex, 1, spanIndex2, spanSize2, z2, false));
        return;
    }
    super.onInitializeAccessibilityNodeInfoForItem(host, info);
}
 
Example #6
Source File: GridLayoutManager.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
void moveLayoutToPosition(int position, int offset, Recycler recycler, State state) {
    final Lanes lanes = getLanes();
    lanes.reset(offset);

    getLaneForPosition(mTempLaneInfo, position, Direction.END);
    final int lane = mTempLaneInfo.startLane;
    if (lane == 0) {
        return;
    }

    final View child = recycler.getViewForPosition(position);
    measureChild(child, Direction.END);

    final int dimension =
            (isVertical() ? getDecoratedMeasuredHeight(child) : getDecoratedMeasuredWidth(child));

    for (int i = lane - 1; i >= 0; i--) {
        lanes.offset(i, dimension);
    }
}
 
Example #7
Source File: GridLayoutManager.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
public int scrollVerticallyBy(int dy, Recycler recycler, RecyclerView.State state) {
    if (DEBUG) Log.v(getTag(), "scrollVerticallyBy " + dy);
    if (!mLayoutEnabled || !hasDoneFirstLayout()) {
        return 0;
    }
    saveContext(recycler, state);
    int result;
    if (mOrientation == VERTICAL) {
        result = scrollDirectionPrimary(dy);
    } else {
        result = scrollDirectionSecondary(dy);
    }
    leaveContext();
    return result;
}
 
Example #8
Source File: StaggeredGridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
private void recycleFromStart(Recycler recycler, int line) {
    while (getChildCount() > 0) {
        View child = getChildAt(0);
        if (this.mPrimaryOrientation.getDecoratedEnd(child) <= line) {
            LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (lp.mFullSpan) {
                int j = 0;
                while (j < this.mSpanCount) {
                    if (this.mSpans[j].mViews.size() != 1) {
                        j++;
                    } else {
                        return;
                    }
                }
                for (j = 0; j < this.mSpanCount; j++) {
                    this.mSpans[j].popStart();
                }
            } else if (lp.mSpan.mViews.size() != 1) {
                lp.mSpan.popStart();
            } else {
                return;
            }
            removeAndRecycleView(child, recycler);
        } else {
            return;
        }
    }
}
 
Example #9
Source File: StaggeredGridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
int scrollBy(int dt, Recycler recycler, State state) {
    int layoutDir;
    int referenceChildPosition;
    int totalScroll;
    ensureOrientationHelper();
    if (dt > 0) {
        layoutDir = 1;
        referenceChildPosition = getLastChildPosition();
    } else {
        layoutDir = -1;
        referenceChildPosition = getFirstChildPosition();
    }
    this.mLayoutState.mRecycle = true;
    updateLayoutState(referenceChildPosition, state);
    setLayoutStateDirection(layoutDir);
    this.mLayoutState.mCurrentPosition = this.mLayoutState.mItemDirection + referenceChildPosition;
    int absDt = Math.abs(dt);
    this.mLayoutState.mAvailable = absDt;
    int consumed = fill(recycler, this.mLayoutState, state);
    if (absDt < consumed) {
        totalScroll = dt;
    } else if (dt < 0) {
        totalScroll = -consumed;
    } else {
        totalScroll = consumed;
    }
    this.mPrimaryOrientation.offsetChildren(-totalScroll);
    this.mLastLayoutFromEnd = this.mShouldReverseLayout;
    return totalScroll;
}
 
Example #10
Source File: StaggeredGridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
private void recycle(Recycler recycler, LayoutState layoutState) {
    if (layoutState.mRecycle && !layoutState.mInfinite) {
        if (layoutState.mAvailable == 0) {
            if (layoutState.mLayoutDirection == -1) {
                recycleFromEnd(recycler, layoutState.mEndLine);
            } else {
                recycleFromStart(recycler, layoutState.mStartLine);
            }
        } else if (layoutState.mLayoutDirection == -1) {
            scrolled = layoutState.mStartLine - getMaxStart(layoutState.mStartLine);
            if (scrolled < 0) {
                line = layoutState.mEndLine;
            } else {
                line = layoutState.mEndLine - Math.min(scrolled, layoutState.mAvailable);
            }
            recycleFromEnd(recycler, line);
        } else {
            scrolled = getMinEnd(layoutState.mEndLine) - layoutState.mEndLine;
            if (scrolled < 0) {
                line = layoutState.mStartLine;
            } else {
                line = layoutState.mStartLine + Math.min(scrolled, layoutState.mAvailable);
            }
            recycleFromStart(recycler, line);
        }
    }
}
 
Example #11
Source File: StaggeredGridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
private void fixStartGap(Recycler recycler, State state, boolean canOffsetChildren) {
    int minStartLine = getMinStart(Integer.MAX_VALUE);
    if (minStartLine != Integer.MAX_VALUE) {
        int gap = minStartLine - this.mPrimaryOrientation.getStartAfterPadding();
        if (gap > 0) {
            gap -= scrollBy(gap, recycler, state);
            if (canOffsetChildren && gap > 0) {
                this.mPrimaryOrientation.offsetChildren(-gap);
            }
        }
    }
}
 
Example #12
Source File: GridLayoutManager.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * Save Recycler and State for convenience.  Must be paired with leaveContext().
 */
private void saveContext(Recycler recycler, State state) {
    if (mRecycler != null || mState != null) {
        Log.e(TAG, "Recycler information was not released, bug!");
    }
    mRecycler = recycler;
    mState = state;
}
 
Example #13
Source File: TwoWayLayoutManager.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void recycleChildrenOutOfBounds(Direction direction, Recycler recycler) {
    if (direction == Direction.END) {
        recycleChildrenFromStart(direction, recycler);
    } else {
        recycleChildrenFromEnd(direction, recycler);
    }
}
 
Example #14
Source File: GridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public int getColumnCountForAccessibility(Recycler recycler, State state) {
    if (this.mOrientation == 1) {
        return this.mSpanCount;
    }
    if (state.getItemCount() < 1) {
        return 0;
    }
    return getSpanGroupIndex(recycler, state, state.getItemCount() - 1) + 1;
}
 
Example #15
Source File: TwoWayLayoutManager.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void fillAfter(int position, Recycler recycler, State state, int extraSpace) {
    final int limit = getEndWithPadding() + extraSpace;

    final int itemCount = state.getItemCount();
    while (canAddMoreViews(Direction.END, limit) && position < itemCount) {
        makeAndAddView(position, Direction.END, recycler);
        position++;
    }
}
 
Example #16
Source File: TwoWayLayoutManager.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public int scrollHorizontallyBy(int dx, Recycler recycler, State state) {
    if (mIsVertical) {
        return 0;
    }

    return scrollBy(dx, recycler, state);
}
 
Example #17
Source File: GridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public int getRowCountForAccessibility(Recycler recycler, State state) {
    if (this.mOrientation == 0) {
        return this.mSpanCount;
    }
    if (state.getItemCount() < 1) {
        return 0;
    }
    return getSpanGroupIndex(recycler, state, state.getItemCount() - 1) + 1;
}
 
Example #18
Source File: AbstractFullFillLayoutHelper.java    From vlayout with MIT License 5 votes vote down vote up
@Override
public void layoutViews(RecyclerView.Recycler recycler, RecyclerView.State state,
                        LayoutStateWrapper layoutState, LayoutChunkResult result, LayoutManagerHelper helper) {
    mTempLayoutHelper = helper;

    doLayoutView(recycler, state, layoutState, result, helper);

    mTempLayoutHelper = null;
}
 
Example #19
Source File: StaggeredGridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
private void recycleFromEnd(Recycler recycler, int line) {
    int i = getChildCount() - 1;
    while (i >= 0) {
        View child = getChildAt(i);
        if (this.mPrimaryOrientation.getDecoratedStart(child) >= line) {
            LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (lp.mFullSpan) {
                int j = 0;
                while (j < this.mSpanCount) {
                    if (this.mSpans[j].mViews.size() != 1) {
                        j++;
                    } else {
                        return;
                    }
                }
                for (j = 0; j < this.mSpanCount; j++) {
                    this.mSpans[j].popEnd();
                }
            } else if (lp.mSpan.mViews.size() != 1) {
                lp.mSpan.popEnd();
            } else {
                return;
            }
            removeAndRecycleView(child, recycler);
            i--;
        } else {
            return;
        }
    }
}
 
Example #20
Source File: FocusableLinearLayoutManager.java    From ticdesign with Apache License 2.0 5 votes vote down vote up
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
    int scrolled = super.scrollVerticallyBy(dy, recycler, state);

    if (scrolled == dy) {
        onScrollVerticalBy(dy);
    }

    return scrolled;
}
 
Example #21
Source File: StaggeredGridLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onInitializeAccessibilityNodeInfoForItem(Recycler recycler, State state, View host, AccessibilityNodeInfoCompat info) {
    android.view.ViewGroup.LayoutParams lp = host.getLayoutParams();
    if (lp instanceof LayoutParams) {
        LayoutParams sglp = (LayoutParams) lp;
        if (this.mOrientation == 0) {
            info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(sglp.getSpanIndex(), sglp.mFullSpan ? this.mSpanCount : 1, -1, -1, sglp.mFullSpan, false));
            return;
        } else {
            info.setCollectionItemInfo(CollectionItemInfoCompat.obtain(-1, -1, sglp.getSpanIndex(), sglp.mFullSpan ? this.mSpanCount : 1, sglp.mFullSpan, false));
            return;
        }
    }
    super.onInitializeAccessibilityNodeInfoForItem(host, info);
}
 
Example #22
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
View next(Recycler recycler) {
    if (this.mScrapList != null) {
        return nextViewFromScrapList();
    }
    View view = recycler.getViewForPosition(this.mCurrentPosition);
    this.mCurrentPosition += this.mItemDirection;
    return view;
}
 
Example #23
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public void onDetachedFromWindow(RecyclerView view, Recycler recycler) {
    super.onDetachedFromWindow(view, recycler);
    if (this.mRecycleChildrenOnDetach) {
        removeAndRecycleAllViews(recycler);
        recycler.clear();
    }
}
 
Example #24
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public View onFocusSearchFailed(View focused, int focusDirection, Recycler recycler, State state) {
    resolveShouldLayoutReverse();
    if (getChildCount() == 0) {
        return null;
    }
    int layoutDir = convertFocusDirectionToLayoutDirection(focusDirection);
    if (layoutDir == Integer.MIN_VALUE) {
        return null;
    }
    View referenceChild;
    ensureLayoutState();
    if (layoutDir == -1) {
        referenceChild = findReferenceChildClosestToStart(recycler, state);
    } else {
        referenceChild = findReferenceChildClosestToEnd(recycler, state);
    }
    if (referenceChild == null) {
        return null;
    }
    View nextFocus;
    ensureLayoutState();
    updateLayoutState(layoutDir, (int) (MAX_SCROLL_FACTOR * ((float) this.mOrientationHelper.getTotalSpace())), false, state);
    this.mLayoutState.mScrollingOffset = Integer.MIN_VALUE;
    this.mLayoutState.mRecycle = false;
    fill(recycler, this.mLayoutState, state, true);
    if (layoutDir == -1) {
        nextFocus = getChildClosestToStart();
    } else {
        nextFocus = getChildClosestToEnd();
    }
    if (nextFocus == referenceChild || !nextFocus.isFocusable()) {
        return null;
    }
    return nextFocus;
}
 
Example #25
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
View findReferenceChild(Recycler recycler, State state, int start, int end, int itemCount) {
    ensureLayoutState();
    View invalidMatch = null;
    View outOfBoundsMatch = null;
    int boundsStart = this.mOrientationHelper.getStartAfterPadding();
    int boundsEnd = this.mOrientationHelper.getEndAfterPadding();
    int diff = end > start ? 1 : -1;
    for (int i = start; i != end; i += diff) {
        View childAt = getChildAt(i);
        int position = getPosition(childAt);
        if (position >= 0 && position < itemCount) {
            if (((LayoutParams) childAt.getLayoutParams()).isItemRemoved()) {
                if (invalidMatch == null) {
                    invalidMatch = childAt;
                }
            } else if (this.mOrientationHelper.getDecoratedStart(childAt) < boundsEnd && this.mOrientationHelper.getDecoratedEnd(childAt) >= boundsStart) {
                return childAt;
            } else {
                if (outOfBoundsMatch == null) {
                    outOfBoundsMatch = childAt;
                }
            }
        }
    }
    if (outOfBoundsMatch == null) {
        outOfBoundsMatch = invalidMatch;
    }
    return outOfBoundsMatch;
}
 
Example #26
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
private boolean updateAnchorFromChildren(Recycler recycler, State state, AnchorInfo anchorInfo) {
    if (getChildCount() == 0) {
        return false;
    }
    View focused = getFocusedChild();
    if (focused != null && anchorInfo.isViewValidAsAnchor(focused, state)) {
        anchorInfo.assignFromViewAndKeepVisibleRect(focused);
        return true;
    } else if (this.mLastStackFromEnd != this.mStackFromEnd) {
        return false;
    } else {
        View referenceChild = anchorInfo.mLayoutFromEnd ? findReferenceChildClosestToEnd(recycler, state) : findReferenceChildClosestToStart(recycler, state);
        if (referenceChild == null) {
            return false;
        }
        anchorInfo.assignFromView(referenceChild);
        if (!state.isPreLayout() && supportsPredictiveItemAnimations()) {
            boolean notVisible;
            if (this.mOrientationHelper.getDecoratedStart(referenceChild) >= this.mOrientationHelper.getEndAfterPadding() || this.mOrientationHelper.getDecoratedEnd(referenceChild) < this.mOrientationHelper.getStartAfterPadding()) {
                notVisible = true;
            } else {
                notVisible = false;
            }
            if (notVisible) {
                anchorInfo.mCoordinate = anchorInfo.mLayoutFromEnd ? this.mOrientationHelper.getEndAfterPadding() : this.mOrientationHelper.getStartAfterPadding();
            }
        }
        return true;
    }
}
 
Example #27
Source File: SpannableGridLayoutManager.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void moveLayoutToPosition(int position, int offset, Recycler recycler, State state) {
    final boolean isVertical = isVertical();
    final Lanes lanes = getLanes();

    lanes.reset(0);

    for (int i = 0; i <= position; i++) {
        SpannableItemEntry entry = (SpannableItemEntry) getItemEntryForPosition(i);
        if (entry == null) {
            final View child = recycler.getViewForPosition(i);
            entry = (SpannableItemEntry) cacheChildLaneAndSpan(child, Direction.END);
        }

        mTempLaneInfo.set(entry.startLane, entry.anchorLane);

        // The lanes might have been invalidated because an added or
        // removed item. See BaseLayoutManager.invalidateItemLanes().
        if (mTempLaneInfo.isUndefined()) {
            lanes.findLane(mTempLaneInfo, getLaneSpanForPosition(i), Direction.END);
            entry.setLane(mTempLaneInfo);
        }

        lanes.getChildFrame(mTempRect, getChildWidth(entry.colSpan),
                getChildHeight(entry.rowSpan), mTempLaneInfo, Direction.END);

        if (i != position) {
            pushChildFrame(entry, mTempRect, entry.startLane, getLaneSpan(entry, isVertical),
                    Direction.END);
        }
    }

    lanes.getLane(mTempLaneInfo.startLane, mTempRect);
    lanes.reset(Direction.END);
    lanes.offset(offset - (isVertical ? mTempRect.bottom : mTempRect.right));
}
 
Example #28
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
private void recycleChildren(Recycler recycler, int startIndex, int endIndex) {
    if (startIndex != endIndex) {
        int i;
        if (endIndex > startIndex) {
            for (i = endIndex - 1; i >= startIndex; i--) {
                removeAndRecycleViewAt(i, recycler);
            }
            return;
        }
        for (i = startIndex; i > endIndex; i--) {
            removeAndRecycleViewAt(i, recycler);
        }
    }
}
 
Example #29
Source File: TwoWayLayoutManager.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
protected void onLayoutScrapList(Recycler recycler, State state) {
    final int childCount = getChildCount();
    if (childCount == 0 || state.isPreLayout() || !supportsPredictiveItemAnimations()) {
        return;
    }

    final List<ViewHolder> scrapList = recycler.getScrapList();
    fillFromScrapList(scrapList, Direction.START);
    fillFromScrapList(scrapList, Direction.END);
}
 
Example #30
Source File: LinearLayoutManager.java    From letv with Apache License 2.0 5 votes vote down vote up
int fill(Recycler recycler, LayoutState layoutState, State state, boolean stopOnFocusable) {
    int start = layoutState.mAvailable;
    if (layoutState.mScrollingOffset != Integer.MIN_VALUE) {
        if (layoutState.mAvailable < 0) {
            layoutState.mScrollingOffset += layoutState.mAvailable;
        }
        recycleByLayoutState(recycler, layoutState);
    }
    int remainingSpace = layoutState.mAvailable + layoutState.mExtra;
    LayoutChunkResult layoutChunkResult = new LayoutChunkResult();
    while (true) {
        if ((!layoutState.mInfinite && remainingSpace <= 0) || !layoutState.hasMore(state)) {
            break;
        }
        layoutChunkResult.resetInternal();
        layoutChunk(recycler, state, layoutState, layoutChunkResult);
        if (!layoutChunkResult.mFinished) {
            layoutState.mOffset += layoutChunkResult.mConsumed * layoutState.mLayoutDirection;
            if (!(layoutChunkResult.mIgnoreConsumed && this.mLayoutState.mScrapList == null && state.isPreLayout())) {
                layoutState.mAvailable -= layoutChunkResult.mConsumed;
                remainingSpace -= layoutChunkResult.mConsumed;
            }
            if (layoutState.mScrollingOffset != Integer.MIN_VALUE) {
                layoutState.mScrollingOffset += layoutChunkResult.mConsumed;
                if (layoutState.mAvailable < 0) {
                    layoutState.mScrollingOffset += layoutState.mAvailable;
                }
                recycleByLayoutState(recycler, layoutState);
            }
            if (stopOnFocusable && layoutChunkResult.mFocusable) {
                break;
            }
        } else {
            break;
        }
    }
    return start - layoutState.mAvailable;
}