public interface IFlexible<VH extends RecyclerView.ViewHolder>
Implements this interface or use AbstractFlexibleItem.
shouldNotifyChange
createViewHolder params
getBubbleText method
getItemViewType methodIExpandable,
IFilterable,
IHeader,
IHolder,
ISectionable| Modifier and Type | Method and Description |
|---|---|
void |
bindViewHolder(FlexibleAdapter<IFlexible> adapter,
VH holder,
int position,
java.util.List<java.lang.Object> payloads)
Delegates the binding of this item's data to the given Layout.
|
VH |
createViewHolder(android.view.View view,
FlexibleAdapter<IFlexible> adapter)
Delegates the creation of the ViewHolder to the user (AutoMap).
|
java.lang.String |
getBubbleText(int position)
Custom bubble text for FastScroller.
|
int |
getItemViewType()
Identifies a specific view type for this item, used by FlexibleAdapter to auto-map
the ViewTypes.
|
int |
getLayoutRes()
Returns the layout resource ID to auto-inflate the View for this item.
|
int |
getSpanSize(int spanCount,
int position)
Individual item's span size to use only with
GridLayoutManager. |
boolean |
isDraggable() |
boolean |
isEnabled()
Returns if the Item is enabled.
|
boolean |
isHidden()
(Internal usage).
|
boolean |
isSelectable()
Checks if the item can be selected.
|
boolean |
isSwipeable() |
void |
onViewAttached(FlexibleAdapter<IFlexible> adapter,
VH holder,
int position)
Called when a view created by this adapter has been attached to a window.
|
void |
onViewDetached(FlexibleAdapter<IFlexible> adapter,
VH holder,
int position)
Called when a view created by this adapter has been detached from its window.
|
void |
setDraggable(boolean draggable) |
void |
setEnabled(boolean enabled)
Setter to change enabled behaviour.
|
void |
setHidden(boolean hidden)
Setter to change hidden behaviour.
|
void |
setSelectable(boolean selectable)
Setter to change selectable behaviour.
|
void |
setSwipeable(boolean swipeable) |
boolean |
shouldNotifyChange(IFlexible newItem)
Called by the FlexibleAdapter when it wants to check if this item should be bound
again with new content.
|
void |
unbindViewHolder(FlexibleAdapter<IFlexible> adapter,
VH holder,
int position)
Called when a view created by this adapter has been recycled.
|
boolean isEnabled()
void setEnabled(boolean enabled)
enabled - false to disable all operations on this itemboolean isHidden()
void setHidden(boolean hidden)
hidden - true if this item should remain hidden, false otherwiseint getSpanSize(int spanCount,
int position)
GridLayoutManager.
Note:
AbstractFlexibleItem already returns 1.StaggeredGridLayoutManager is set. With such layout use
FlexibleViewHolder.setFullSpan(boolean).spanCount - current column countposition - the adapter position of the itemboolean shouldNotifyChange(IFlexible newItem)
You should return true whether you want this item will be updated because
its visual representations will change.
FlexibleAdapter.setNotifyChangeOfUnfilteredItems(boolean) is disabled.
Default value is true.
newItem - The new item object with the new contentboolean isSelectable()
void setSelectable(boolean selectable)
selectable - false to disable selection on this itemjava.lang.String getBubbleText(int position)
To be called from the implementation of onCreateBubbleText(). Example:
public String onCreateBubbleText(int position) {
return getItem(position).getBubbleText(position);
}position - the current mapped positionboolean isDraggable()
void setDraggable(boolean draggable)
boolean isSwipeable()
void setSwipeable(boolean swipeable)
int getItemViewType()
HELP: To know how to implement AutoMap for ViewTypes please refer to the FlexibleAdapter Wiki Page on GitHub.
int getLayoutRes()
getItemViewType() must
return unique values!
NOTE: Should identify a resource Layout reference R.layout.
VH createViewHolder(android.view.View view, FlexibleAdapter<IFlexible> adapter)
HELP: To know how to implement AutoMap for ViewTypes please refer to the FlexibleAdapter Wiki Page on GitHub.
view - the already inflated viewadapter - the Adapter instance extending FlexibleAdaptervoid bindViewHolder(FlexibleAdapter<IFlexible> adapter, VH holder, int position, java.util.List<java.lang.Object> payloads)
HELP: To know how to implement AutoMap for ViewTypes please refer to the FlexibleAdapter Wiki Page on GitHub.
How to use Payload, please refer toRecyclerView.Adapter#onBindViewHolder(RecyclerView.ViewHolder, int, List).adapter - the FlexibleAdapter instanceholder - the ViewHolder instanceposition - the current positionpayloads - a non-null list of merged payloads. Can be empty list if requires full updatevoid unbindViewHolder(FlexibleAdapter<IFlexible> adapter, VH holder, int position)
A view is recycled when a RecyclerView.LayoutManager decides that it no longer
needs to be attached to its parent RecyclerView. This can be because it has fallen out
of visibility or a set of cached views represented by views still attached to the parent
RecyclerView.
adapter - the FlexibleAdapter instanceholder - the ViewHolder instance being recycledposition - the current positionvoid onViewAttached(FlexibleAdapter<IFlexible> adapter, VH holder, int position)
This can be used as a reasonable signal that the view is about to be seen by the user.
adapter - the FlexibleAdapter instanceholder - the ViewHolder instance being recycledposition - the current positionvoid onViewDetached(FlexibleAdapter<IFlexible> adapter, VH holder, int position)
Becoming detached from the window is not necessarily a permanent condition; the consumer of an Adapter's views may choose to cache views offscreen while they are not visible, attaching and detaching them as appropriate.
adapter - the FlexibleAdapter instanceholder - the ViewHolder instance being recycledposition - the current position