public class LinearLayoutInfo extends Object implements LayoutInfo
LayoutInfo to implement linear lists with a LinearLayoutManager.| Modifier and Type | Class and Description |
|---|---|
static class |
LinearLayoutInfo.ViewportFiller
Simple implementation of
LayoutInfo.ViewportFiller which fills the viewport by laying
out items sequentially. |
LayoutInfo.RenderInfoCollectionViewportInfo.State, ViewportInfo.ViewportChanged| Constructor and Description |
|---|
LinearLayoutInfo(ComponentContext context,
int orientation,
boolean reverseLayout) |
LinearLayoutInfo(Context context,
int orientation,
boolean reverseLayout) |
LinearLayoutInfo(LinearLayoutManager linearLayoutManager) |
| 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) |
LinearLayoutInfo.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 LinearLayoutInfo(LinearLayoutManager linearLayoutManager)
public LinearLayoutInfo(ComponentContext context, int orientation, boolean reverseLayout)
public LinearLayoutInfo(Context context,
int orientation,
boolean reverseLayout)
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 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 GridLayoutInfoRecyclerBinder.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 GridLayoutInfoRecyclerBinder.public LinearLayoutInfo.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.