public abstract class ExpandableAdapter<VH extends ExpandableAdapter.ViewHolder>
extends <any>
| Modifier and Type | Class and Description |
|---|---|
static class |
ExpandableAdapter.ViewHolder |
| Constructor and Description |
|---|
ExpandableAdapter() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
bindChildHolder(VH holder,
int parentPosition,
int position)
Called by
RecyclerView to display the data at the specified position. |
void |
bindChildHolder(VH holder,
int parentPosition,
int position,
java.util.List<java.lang.Object> payloads) |
abstract void |
bindParentHolder(VH holder,
int position)
Called by
RecyclerView to display the data at the specified position. |
void |
bindParentHolder(VH holder,
int position,
java.util.List<java.lang.Object> payloads) |
abstract int |
childItemCount(int parentPosition)
Get the total number of child items under parent.
|
int |
childItemPosition(int childAdapterPosition)
Get the position of the child item from the adapter position.
|
int |
childItemViewType(int parentPosition,
int childPosition)
Get the view type of the child item.
|
void |
collapseParent(int parentPosition)
Collapse parent.
|
abstract VH |
createChildHolder(android.view.ViewGroup root,
int viewType)
Called when RecyclerView needs a new
ExpandableAdapter.ViewHolder of the given type to represent an child item. |
abstract VH |
createParentHolder(android.view.ViewGroup root,
int viewType)
Called when RecyclerView needs a new
ExpandableAdapter.ViewHolder of the given type to represent an parent item. |
void |
expandParent(int parentPosition)
Expand parent.
|
int |
getItemCount() |
int |
getItemViewType(int position) |
boolean |
isExpanded(int parentPosition)
Parent item is expanded.
|
boolean |
isParentItem(int adapterPosition)
Item is a parent item.
|
void |
notifyChildChanged(int parentPosition,
int childPosition)
Notify any registered observers that the item at
parentPosition, childPosition has changed. |
void |
notifyChildInserted(int parentPosition,
int childPosition)
Notify any registered observers that the item reflected at
parentPosition, childPosition has been
newly inserted. |
void |
notifyChildRemoved(int parentPosition,
int childPosition)
Notify any registered observers that the item previously located at
parentPosition, childPosition
has been removed from the data set. |
void |
notifyParentChanged(int parentPosition)
Notify any registered observers that the item at
parentPosition has changed. |
void |
notifyParentInserted(int parentPosition)
Notify any registered observers that the item reflected at
parentPosition has been newly inserted. |
void |
notifyParentRemoved(int parentPosition)
Notify any registered observers that the item previously located at
parentPosition has been removed
from the data set. |
void |
onAttachedToRecyclerView(RecyclerView recyclerView) |
void |
onBindViewHolder(VH holder,
int position)
Deprecated.
|
void |
onBindViewHolder(VH holder,
int position,
java.util.List<java.lang.Object> payloads) |
VH |
onCreateViewHolder(android.view.ViewGroup root,
int viewType) |
void |
onViewAttachedToWindow(VH holder) |
abstract int |
parentItemCount()
Get the total number of items in the parent.
|
int |
parentItemPosition(int adapterPosition)
Get the position of the parent item from the adapter position.
|
int |
parentItemViewType(int parentPosition)
Get the view type of the parent item.
|
public final boolean isExpanded(int parentPosition)
parentPosition - position of parent item.public final void expandParent(int parentPosition)
parentPosition - position of parent item.public final void collapseParent(int parentPosition)
parentPosition - position of parent item.public final void notifyParentChanged(int parentPosition)
parentPosition has changed.parentPosition - position of parent item.public final void notifyParentInserted(int parentPosition)
parentPosition has been newly inserted.parentPosition - position of parent item.public final void notifyParentRemoved(int parentPosition)
parentPosition has been removed
from the data set.parentPosition - position of parent item.public final void notifyChildChanged(int parentPosition,
int childPosition)
parentPosition, childPosition has changed.parentPosition - position of parent item.childPosition - positoin of child item.public final void notifyChildInserted(int parentPosition,
int childPosition)
parentPosition, childPosition has been
newly inserted.parentPosition - position of parent item.childPosition - positoin of child item.public final void notifyChildRemoved(int parentPosition,
int childPosition)
parentPosition, childPosition
has been removed from the data set.parentPosition - position of parent item.childPosition - positoin of child item.public final int getItemCount()
public abstract int parentItemCount()
public abstract int childItemCount(int parentPosition)
parentPosition - position of parent item.public final int getItemViewType(int position)
public int parentItemViewType(int parentPosition)
parentPosition - position of parent item.public int childItemViewType(int parentPosition,
int childPosition)
parentPosition - position of parent item.childPosition - position of child item.public final boolean isParentItem(int adapterPosition)
adapterPosition - adapter position.public final int parentItemPosition(int adapterPosition)
adapterPosition - adapter position of item.public final int childItemPosition(int childAdapterPosition)
childAdapterPosition - adapter position of child item.public final VH onCreateViewHolder(android.view.ViewGroup root, int viewType)
public abstract VH createParentHolder(android.view.ViewGroup root, int viewType)
ExpandableAdapter.ViewHolder of the given type to represent an parent item.root - the ViewGroup into which the new View will be added after it is bound to an adapter position.viewType - The view type of the new View.ExpandableAdapter.ViewHolder that holds a View of the given view type.public abstract VH createChildHolder(android.view.ViewGroup root, int viewType)
ExpandableAdapter.ViewHolder of the given type to represent an child item.root - the ViewGroup into which the new View will be added after it is bound to an adapter position.viewType - The view type of the new View.ExpandableAdapter.ViewHolder that holds a View of the given view type.public final void onBindViewHolder(VH holder, int position, java.util.List<java.lang.Object> payloads)
public void bindParentHolder(VH holder, int position, java.util.List<java.lang.Object> payloads)
public void bindChildHolder(VH holder, int parentPosition, int position, java.util.List<java.lang.Object> payloads)
public abstract void bindParentHolder(VH holder, int position)
RecyclerView to display the data at the specified position. This method should update the
contents of the ViewHolder#itemView to reflect the item at the given position.holder - parent holder.position - position of parent item.public abstract void bindChildHolder(VH holder, int parentPosition, int position)
RecyclerView to display the data at the specified position. This method should update the *
contents of the ViewHolder#itemView to reflect the item at the given position.holder - child holder.parentPosition - position of parent item.position - position of child position.@Deprecated public final void onBindViewHolder(VH holder, int position)
public void onAttachedToRecyclerView(RecyclerView recyclerView)
public void onViewAttachedToWindow(VH holder)