FileDocCategorySizeDatePackage
LayoutState.javaAPI DocAndroid 5.1 API2636Thu Mar 12 22:22:56 GMT 2015android.support.v7.widget

LayoutState

public class LayoutState extends Object
Helper class that keeps temporary state while {LayoutManager} is filling out the empty space.

Fields Summary
static final String
TAG
static final int
LAYOUT_START
static final int
LAYOUT_END
static final int
INVALID_LAYOUT
static final int
ITEM_DIRECTION_HEAD
static final int
ITEM_DIRECTION_TAIL
static final int
SCOLLING_OFFSET_NaN
int
mAvailable
Number of pixels that we should fill, in the layout direction.
int
mCurrentPosition
Current position on the adapter to get the next item.
int
mItemDirection
Defines the direction in which the data adapter is traversed. Should be {@link #ITEM_DIRECTION_HEAD} or {@link #ITEM_DIRECTION_TAIL}
int
mLayoutDirection
Defines the direction in which the layout is filled. Should be {@link #LAYOUT_START} or {@link #LAYOUT_END}
int
mExtra
Used if you want to pre-layout items that are not yet visible. The difference with {@link #mAvailable} is that, when recycling, distance rendered for {@link #mExtra} is not considered not to recycle visible children.
Constructors Summary
Methods Summary
booleanhasMore(RecyclerView.State state)

return
true if there are more items in the data adapter


                    
       
        return mCurrentPosition >= 0 && mCurrentPosition < state.getItemCount();
    
android.view.Viewnext(RecyclerView.Recycler recycler)
Gets the view for the next element that we should render. Also updates current item index to the next item, based on {@link #mItemDirection}

return
The next element that we should render.

        final View view = recycler.getViewForPosition(mCurrentPosition);
        mCurrentPosition += mItemDirection;
        return view;