public static class RecyclerBinder.Builder extends Object
Modifier and Type | Field and Description |
---|---|
static float |
DEFAULT_RANGE_RATIO |
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
RecyclerBinder.Builder |
acquireStateHandlerOnRelease(boolean acquireStateHandlerOnRelease)
Defaults to true.
|
RecyclerBinder.Builder |
asyncInsertLayoutHandler(LithoHandler handler) |
RecyclerBinder |
build(ComponentContext c) |
RecyclerBinder.Builder |
canInterruptAndMoveLayoutsBetweenThreads(boolean isEnabled)
Experimental, do not use! If enabled, a layout computation can be interrupted on a bg thread
and resumed on the UI thread if it's needed immediately.
|
RecyclerBinder.Builder |
canMeasure(boolean canMeasure)
Only for horizontally scrolling layouts! If true, the height of the RecyclerView is not known
when it's measured; the first item is measured and its height will determine the height of
the RecyclerView.
|
RecyclerBinder.Builder |
componentTreeHolderFactory(com.facebook.litho.widget.RecyclerBinder.ComponentTreeHolderFactory componentTreeHolderFactory) |
RecyclerBinder.Builder |
componentWarmer(ComponentWarmer componentWarmer) |
RecyclerBinder.Builder |
enableCustomViewType(int componentViewType)
Enable setting custom viewTypes on
ViewRenderInfo s. |
RecyclerBinder.Builder |
enableDetach(boolean enableDetach)
If true, detach components under the hood when RecyclerBinder#detach() is called.
|
RecyclerBinder.Builder |
enableStableIds(boolean enableStableIds)
If set, the RecyclerView adapter will have stableId support turned on.
|
RecyclerBinder.Builder |
estimatedViewportCount(int estimatedViewportCount)
Deprecated.
|
RecyclerBinder.Builder |
hasDynamicItemHeight(boolean hasDynamicItemHeight)
Do not enable this.
|
RecyclerBinder.Builder |
hscrollAsyncMode(boolean hscrollAsyncMode)
Experimental.
|
RecyclerBinder.Builder |
incrementalMount(boolean incrementalMount)
Don't use this.
|
RecyclerBinder.Builder |
incrementalVisibilityHandling(boolean isEnabled) |
RecyclerBinder.Builder |
invalidStateLogParamsList(List<ComponentLogParams> logParamsList)
Provide a list of
ComponentLogParams that will be used to log invalid states in the
LithoView, such as height being 0 while non-0 value was expected. |
RecyclerBinder.Builder |
isCircular(boolean isCircular)
Whether the underlying RecyclerBinder will have a circular behaviour.
|
RecyclerBinder.Builder |
isLayoutDiffingEnabled(boolean isEnabled) |
RecyclerBinder.Builder |
isReconciliationEnabled(boolean isEnabled) |
RecyclerBinder.Builder |
isSubAdapter(boolean isSubAdapter)
Note: this is an advanced usage of RecyclerBinder that requires much more manual hand-holding
of the RecyclerBinder than normal usage.
|
RecyclerBinder.Builder |
layoutHandlerFactory(LayoutHandlerFactory layoutHandlerFactory) |
RecyclerBinder.Builder |
layoutInfo(LayoutInfo layoutInfo) |
RecyclerBinder.Builder |
lithoViewFactory(LithoViewFactory lithoViewFactory) |
RecyclerBinder.Builder |
preallocateMountContentHandler(LithoHandler preallocateMountContentHandler) |
RecyclerBinder.Builder |
rangeRatio(float rangeRatio) |
RecyclerBinder.Builder |
recyclerRangeTraverser(RecyclerRangeTraverser traverser)
Set a custom range traverser
|
RecyclerBinder.Builder |
recyclingMode(int recyclingMode) |
RecyclerBinder.Builder |
shouldPreallocatePerMountSpec(boolean shouldPreallocatePerMountSpec) |
RecyclerBinder.Builder |
startupLogger(LithoStartupLogger logger) |
RecyclerBinder.Builder |
stickyHeaderControllerFactory(StickyHeaderControllerFactory stickyHeaderControllerFactory)
Sets a factory to be used to create a custom controller for sticky section headers
|
RecyclerBinder.Builder |
threadPoolConfig(LayoutThreadPoolConfiguration config) |
RecyclerBinder.Builder |
useCancelableLayoutFutures(boolean isEnabled)
Experimental, do not use! If enabled, cancel a layout calculation before it finishes if
there's another layout pending with a newer state of the ComponentTree.
|
RecyclerBinder.Builder |
wrapContent(boolean wrapContent)
If true, the underlying RecyclerBinder will measure the parent height by the height of
children if the orientation is vertical, or measure the parent width by the width of children
if the orientation is horizontal.
|
public static final float DEFAULT_RANGE_RATIO
public RecyclerBinder.Builder rangeRatio(float rangeRatio)
rangeRatio
- specifies how big a range this binder should try to compute. The range is
computed as number of items in the viewport (when the binder is measured) multiplied by
the range ratio. The ratio is to be intended in both directions. For example a ratio of 1
means that if there are currently N components on screen, the binder should try to
compute the layout for the N components before the first component on screen and for the
N components after the last component on screen. If not set, defaults to 4f.public RecyclerBinder.Builder acquireStateHandlerOnRelease(boolean acquireStateHandlerOnRelease)
public RecyclerBinder.Builder layoutInfo(LayoutInfo layoutInfo)
layoutInfo
- an implementation of LayoutInfo
that will expose information about
the LayoutManager
this RecyclerBinder will use. If not set, it will default to a
vertical list.public RecyclerBinder.Builder layoutHandlerFactory(LayoutHandlerFactory layoutHandlerFactory)
layoutHandlerFactory
- the RecyclerBinder will use this layoutHandlerFactory when
creating ComponentTree
s in order to specify on which thread layout calculation
should happen.public RecyclerBinder.Builder lithoViewFactory(LithoViewFactory lithoViewFactory)
public RecyclerBinder.Builder isCircular(boolean isCircular)
public RecyclerBinder.Builder wrapContent(boolean wrapContent)
public RecyclerBinder.Builder componentTreeHolderFactory(com.facebook.litho.widget.RecyclerBinder.ComponentTreeHolderFactory componentTreeHolderFactory)
componentTreeHolderFactory
- Factory to acquire a new ComponentTreeHolder. Defaults to
RecyclerBinder.DEFAULT_COMPONENT_TREE_HOLDER_FACTORY
.public RecyclerBinder.Builder preallocateMountContentHandler(LithoHandler preallocateMountContentHandler)
public RecyclerBinder.Builder shouldPreallocatePerMountSpec(boolean shouldPreallocatePerMountSpec)
public RecyclerBinder.Builder hasDynamicItemHeight(boolean hasDynamicItemHeight)
Whether the items of this RecyclerBinder can change height after the initial measure. Only applicable to horizontally scrolling RecyclerBinders. If true, the children of this h-scroll are all measured with unspecified height. When the ComponentTree of a child is remeasured, this will cause the RecyclerBinder to remeasure in case the height of the child changed and the RecyclerView needs to have a different height to account for it. This only supports changing the height of the item that triggered the remeasuring, not the height of all items in the h-scroll.
public RecyclerBinder.Builder enableCustomViewType(int componentViewType)
ViewRenderInfo
s.
After this is set, all ViewRenderInfo
s must be built with a custom viewType
through ViewRenderInfo.Builder.customViewType(int)
, otherwise exception will be
thrown.
componentViewType
- the viewType to be used for Component types, provided through ComponentRenderInfo
. Set this to a value that won't conflict with your custom viewTypes.public RecyclerBinder.Builder enableStableIds(boolean enableStableIds)
public RecyclerBinder.Builder invalidStateLogParamsList(List<ComponentLogParams> logParamsList)
ComponentLogParams
that will be used to log invalid states in the
LithoView, such as height being 0 while non-0 value was expected.public RecyclerBinder.Builder threadPoolConfig(LayoutThreadPoolConfiguration config)
config
- RecyclerBinder will use this LayoutThreadPoolConfiguration
to create
ThreadPoolLayoutHandler
which will be used to calculate layout in pool of
threads. However, this will create a new separate thread pool which might negatively
affect the app's performance.
Note: if layoutHandlerFactory(LayoutHandlerFactory)
is provided, the handler
created by the factory will be used instead of the one that would have been created by
this config.
public RecyclerBinder.Builder recyclerRangeTraverser(RecyclerRangeTraverser traverser)
@Deprecated public RecyclerBinder.Builder estimatedViewportCount(int estimatedViewportCount)
public RecyclerBinder.Builder incrementalVisibilityHandling(boolean isEnabled)
public RecyclerBinder.Builder canMeasure(boolean canMeasure)
public RecyclerBinder.Builder hscrollAsyncMode(boolean hscrollAsyncMode)
public RecyclerBinder.Builder incrementalMount(boolean incrementalMount)
public RecyclerBinder.Builder stickyHeaderControllerFactory(StickyHeaderControllerFactory stickyHeaderControllerFactory)
public RecyclerBinder.Builder enableDetach(boolean enableDetach)
public RecyclerBinder.Builder useCancelableLayoutFutures(boolean isEnabled)
public RecyclerBinder.Builder canInterruptAndMoveLayoutsBetweenThreads(boolean isEnabled)
public RecyclerBinder.Builder isSubAdapter(boolean isSubAdapter)
In sub adapter mode, the RecyclerBinder doesn't control the entire RecyclerView, but instead just a part of it. This means that the RecyclerBinder can't mount to a RecyclerView and set its adapter, and it won't set a scroll listener on the RecyclerView.
Instead, the internal adapter will need to be used/observed and plugged into some sort of multi-adapter that can multiplex the RecyclerView's requests between the different sub adapters.
Additionally, since the RecyclerBinder will never mount to a RecyclerView, the owner of
this RecyclerBinder must manually dispatch RecyclerBinder.updateSubAdapterVisibleRange(int, int)
and RecyclerBinder.updateSubAdapterWorkingRange(int, int, int, int)
events if this RecyclerBinder can contains more than a screens
worth of content.
public RecyclerBinder.Builder isReconciliationEnabled(boolean isEnabled)
public RecyclerBinder.Builder recyclingMode(int recyclingMode)
public RecyclerBinder.Builder isLayoutDiffingEnabled(boolean isEnabled)
public RecyclerBinder.Builder componentWarmer(ComponentWarmer componentWarmer)
public RecyclerBinder.Builder startupLogger(LithoStartupLogger logger)
public RecyclerBinder.Builder asyncInsertLayoutHandler(LithoHandler handler)
public RecyclerBinder build(ComponentContext c)
c
- The ComponentContext
the RecyclerBinder will use.