java.lang.Object | ||
↳ | android.support.v7.widget.RecyclerView.Adapter<VH extends android.support.v7.widget.RecyclerView.ViewHolder> | |
↳ | com.h6ah4i.android.widget.advrecyclerview.adapter.SimpleWrapperAdapter<VH extends android.support.v7.widget.RecyclerView.ViewHolder> |
Known Direct Subclasses
BaseWrapperAdapter<VH extends RecyclerView.ViewHolder>,
DebugWrapperAdapter
|
A simple wrapper class. It just bypasses all methods and events to the wrapped adapter.
Use this class as a default implementation of WrapperAdapter
, so extend it
and override each methods to build your own specialized adapter!
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected static final List<Object> | FULL_UPDATE_PAYLOADS |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SimpleWrapperAdapter(Adapter<VH> adapter)
Constructor
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int |
getItemCount()
| ||||||||||
long |
getItemId(int position)
| ||||||||||
int |
getItemViewType(int position)
| ||||||||||
Adapter<VH> |
getWrappedAdapter()
Returns underlying adapter.
| ||||||||||
void |
getWrappedAdapters(List<Adapter> adapters)
Gets wrapped children adapters.
| ||||||||||
boolean |
isWrappedAdapterAlive()
Returns whether the wrapped adapter exists.
| ||||||||||
void |
onAttachedToRecyclerView(RecyclerView recyclerView)
| ||||||||||
void |
onBindViewHolder(VH holder, int position)
| ||||||||||
void |
onBindViewHolder(VH holder, int position, List<Object> payloads)
| ||||||||||
final void |
onBridgedAdapterChanged(Adapter source, Object tag)
Routed
onChanged() event. | ||||||||||
final void |
onBridgedAdapterItemRangeChanged(Adapter sourceAdapter, Object tag, int positionStart, int itemCount, Object payload)
Routed
onItemRangeChanged(int, int, Object) event. | ||||||||||
final void |
onBridgedAdapterItemRangeChanged(Adapter source, Object tag, int positionStart, int itemCount)
Routed
onItemRangeChanged(int, int) event. | ||||||||||
final void |
onBridgedAdapterItemRangeInserted(Adapter sourceAdapter, Object tag, int positionStart, int itemCount)
Routed
onItemRangeInserted(int, int) event. | ||||||||||
final void |
onBridgedAdapterItemRangeRemoved(Adapter sourceAdapter, Object tag, int positionStart, int itemCount)
Routed
onItemRangeRemoved(int, int) event. | ||||||||||
final void |
onBridgedAdapterRangeMoved(Adapter sourceAdapter, Object tag, int fromPosition, int toPosition, int itemCount)
Routed
onItemRangeChanged(int, int, Object) event. | ||||||||||
VH |
onCreateViewHolder(ViewGroup parent, int viewType)
| ||||||||||
void |
onDetachedFromRecyclerView(RecyclerView recyclerView)
| ||||||||||
boolean |
onFailedToRecycleView(VH holder)
| ||||||||||
boolean |
onFailedToRecycleView(VH holder, int viewType)
onFailedToRecycleView() with unwrapped item view type parameter.
| ||||||||||
void |
onViewAttachedToWindow(VH holder)
| ||||||||||
void |
onViewAttachedToWindow(VH holder, int viewType)
onViewAttachedToWindow() with unwrapped item view type parameter.
| ||||||||||
void |
onViewDetachedFromWindow(VH holder)
| ||||||||||
void |
onViewDetachedFromWindow(VH holder, int viewType)
onViewDetachedFromWindow() with unwrapped item view type parameter.
| ||||||||||
void |
onViewRecycled(VH holder, int viewType)
onViewRecycled() with unwrapped item view type parameter.
| ||||||||||
void |
onViewRecycled(VH holder)
| ||||||||||
void |
release()
Releases bounded resources.
| ||||||||||
void |
setHasStableIds(boolean hasStableIds)
| ||||||||||
void |
unwrapPosition(UnwrapPositionResult dest, int position)
Unwraps position.
| ||||||||||
int |
wrapPosition(AdapterPathSegment pathSegment, int position)
Wraps position.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | onHandleWrappedAdapterChanged() | ||||||||||
void | onHandleWrappedAdapterItemRangeChanged(int positionStart, int itemCount) | ||||||||||
void | onHandleWrappedAdapterItemRangeChanged(int positionStart, int itemCount, Object payload) | ||||||||||
void | onHandleWrappedAdapterItemRangeInserted(int positionStart, int itemCount) | ||||||||||
void | onHandleWrappedAdapterItemRangeRemoved(int positionStart, int itemCount) | ||||||||||
void | onHandleWrappedAdapterRangeMoved(int fromPosition, int toPosition, int itemCount) | ||||||||||
void | onRelease() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.v7.widget.RecyclerView.Adapter
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.h6ah4i.android.widget.advrecyclerview.adapter.BridgeAdapterDataObserver.Subscriber
| |||||||||||
From interface
com.h6ah4i.android.widget.advrecyclerview.adapter.WrappedAdapter
| |||||||||||
From interface
com.h6ah4i.android.widget.advrecyclerview.adapter.WrapperAdapter
|
Constructor
adapter | The adapter which to be wrapped |
---|
Returns underlying adapter.
Gets wrapped children adapters.
adapters | The destination |
---|
Returns whether the wrapped adapter exists.
Routed onChanged()
event.
source | The source adapter |
---|---|
tag | The tag object |
Routed onItemRangeChanged(int, int, Object)
event.
sourceAdapter | The source adapter |
---|---|
tag | The tag object |
positionStart | Position of the first item that has changed |
itemCount | Number of items that have changed |
payload | Optional parameter, use null to identify a "full" update |
Routed onItemRangeChanged(int, int)
event.
source | The source adapter |
---|---|
tag | The tag object |
positionStart | Position of the first item that has changed |
itemCount | Number of items that have changed |
Routed onItemRangeInserted(int, int)
event.
sourceAdapter | The source adapter |
---|---|
tag | The tag object |
positionStart | Position of the first item that was inserted |
itemCount | Number of items inserted |
Routed onItemRangeRemoved(int, int)
event.
sourceAdapter | The source adapter |
---|---|
tag | The tag object |
positionStart | Previous position of the first item that was removed |
itemCount | Number of items removed from the data set |
Routed onItemRangeChanged(int, int, Object)
event.
sourceAdapter | The source adapter |
---|---|
tag | The tag object |
fromPosition | Previous position of the item. |
toPosition | New position of the item. |
itemCount | Number of items moved (NOTE: this parameter is not actually used, always 1.) |
onFailedToRecycleView() with unwrapped item view type parameter.
holder | The ViewHolder containing the View that could not be recycled due to its transient state. |
---|---|
viewType | Unwrapped view type. Use this instead of #{getItemViewType() }. |
true
, RecyclerView will ignore the transient state of
the View and recycle it regardless. If this method returns false
,
RecyclerView will check the View's transient state again before giving a final decision.
Default implementation returns false.
onViewAttachedToWindow() with unwrapped item view type parameter.
holder | Holder of the view being attached |
---|---|
viewType | Unwrapped view type. Use this instead of #{getItemViewType() }. |
onViewDetachedFromWindow() with unwrapped item view type parameter.
holder | Holder of the view being detached |
---|---|
viewType | Unwrapped view type. Use this instead of #{getItemViewType() }. |
onViewRecycled() with unwrapped item view type parameter.
holder | The ViewHolder for the view being recycled |
---|---|
viewType | Unwrapped view type. Use this instead of #{getItemViewType() }. |
Releases bounded resources.
Unwraps position. This method converts the passed wrapped position to child adapter's position.
dest | The destination |
---|---|
position | The wrapped position to be unwrapped |
Wraps position. This method converts the passed child adapter's position to wrapped position.
pathSegment | The path segment of the child adapter |
---|---|
position | The child adapter's position to be wrapped |