public class GridLayoutInfo extends Object implements LayoutInfo
LayoutInfo.RenderInfoCollectionViewportInfo.State, ViewportInfo.ViewportChanged| Modifier and Type | Field and Description |
|---|---|
static String |
OVERRIDE_SIZE |
| Constructor and Description |
|---|
GridLayoutInfo(Context context,
int spanCount) |
GridLayoutInfo(Context context,
int spanCount,
int orientation,
boolean reverseLayout) |
GridLayoutInfo(Context context,
int spanCount,
int orientation,
boolean reverseLayout,
boolean allowGridMeasuresOverride) |
GridLayoutInfo(GridLayoutManager gridLayoutManager) |
| Modifier and Type | Method and Description |
|---|---|
int |
approximateRangeSize(int firstMeasuredItemWidth,
int firstMeasuredItemHeight,
int recyclerMeasuredWidth,
int recyclerMeasuredHeight)
This is called when the
RecyclerBinder needs to calculate a range size. |
int |
computeWrappedHeight(int maxHeight,
List<ComponentTreeHolder> componentTreeHolders) |
com.facebook.litho.widget.GridLayoutInfo.ViewportFiller |
createViewportFiller(int measuredWidth,
int measuredHeight) |
int |
findFirstFullyVisibleItemPosition() |
int |
findFirstVisibleItemPosition() |
int |
findLastFullyVisibleItemPosition() |
int |
findLastVisibleItemPosition() |
int |
getChildHeightSpec(int heightSpec,
RenderInfo renderInfo) |
int |
getChildWidthSpec(int widthSpec,
RenderInfo renderInfo) |
int |
getItemCount() |
RecyclerView.LayoutManager |
getLayoutManager() |
int |
getScrollDirection()
This is the main scrolling direction that the
LayoutManager passed to this binder will
use. |
void |
scrollToPositionWithOffset(int position,
int offset)
RecyclerBinder delegates scrolling responsibilities to the LayoutInfo, as the varied
LayoutManagers wrapped by a LayoutInfo lack a common scrolling interface.
|
void |
setRenderInfoCollection(LayoutInfo.RenderInfoCollection renderInfoCollection) |
public static final String OVERRIDE_SIZE
public GridLayoutInfo(GridLayoutManager gridLayoutManager)
public GridLayoutInfo(Context context,
int spanCount,
int orientation,
boolean reverseLayout,
boolean allowGridMeasuresOverride)
public GridLayoutInfo(Context context,
int spanCount,
int orientation,
boolean reverseLayout)
public GridLayoutInfo(Context context,
int spanCount)
public int getScrollDirection()
LayoutInfoLayoutManager passed to this binder will
use.getScrollDirection in interface LayoutInfoOrientationHelper#HORIZONTAL or OrientationHelper#VERTICAL.public int findFirstVisibleItemPosition()
findFirstVisibleItemPosition in interface ViewportInfopublic int findLastVisibleItemPosition()
findLastVisibleItemPosition in interface ViewportInfopublic int findFirstFullyVisibleItemPosition()
findFirstFullyVisibleItemPosition in interface ViewportInfopublic int findLastFullyVisibleItemPosition()
findLastFullyVisibleItemPosition in interface ViewportInfopublic int getItemCount()
getItemCount in interface ViewportInfopublic RecyclerView.LayoutManager getLayoutManager()
getLayoutManager in interface LayoutInfoLayoutManager to be used with the RecyclerView.public void setRenderInfoCollection(LayoutInfo.RenderInfoCollection renderInfoCollection)
setRenderInfoCollection in interface LayoutInfopublic void scrollToPositionWithOffset(int position,
int offset)
LayoutInfoscrollToPositionWithOffset in interface LayoutInfoposition - Index of the item in the adapteroffset - Additional adjustment to control the precise position the scroll moves to.public int approximateRangeSize(int firstMeasuredItemWidth,
int firstMeasuredItemHeight,
int recyclerMeasuredWidth,
int recyclerMeasuredHeight)
LayoutInfoRecyclerBinder needs to calculate a range size. The returned
value should be an approximate range size based on the size of the first measured item.approximateRangeSize in interface LayoutInfofirstMeasuredItemWidth - The width of the first item measured while computing the range.firstMeasuredItemHeight - The height of the first item measured while computing the range.recyclerMeasuredWidth - The measured width of the RecyclerView. If the RecyclerView
scrolls vertically this might be not significant.recyclerMeasuredHeight - The measured height of the RecyclerView. If the RecyclerView
scrolls horizontally this might be not significant.public int getChildWidthSpec(int widthSpec,
RenderInfo renderInfo)
getChildWidthSpec in interface LayoutInfowidthSpec - the widthSpec used to measure the parent RecyclerSpec.renderInfo - retrieve SpanSize of the component if it is a GridLayoutInfopublic int getChildHeightSpec(int heightSpec,
RenderInfo renderInfo)
getChildHeightSpec in interface LayoutInfoheightSpec - the heightSpec used to measure the parent RecyclerSpec.renderInfo - retrieve SpanSize of the component if it is a GridLayoutInfopublic com.facebook.litho.widget.GridLayoutInfo.ViewportFiller createViewportFiller(int measuredWidth,
int measuredHeight)
createViewportFiller in interface LayoutInfomeasuredWidth - the width of the RecyclerViewmeasuredHeight - the height of the RecyclerViewLayoutInfo.ViewportFiller to fill the RecyclerView viewport with views, or null to not
pre-fill the RecyclerView.public int computeWrappedHeight(int maxHeight,
List<ComponentTreeHolder> componentTreeHolders)
computeWrappedHeight in interface LayoutInfomaxHeight - the max height of the parent RecyclerSpec.componentTreeHolders - the list of ComponentTreeHolder in this RecyclerBinder.RecyclerBinder.