public abstract class

AbstractExpandableItemAdapter

extends RecyclerView.Adapter<VH extends RecyclerView.ViewHolder>
implements ExpandableItemAdapter<GVH extends RecyclerView.ViewHolder, CVH extends RecyclerView.ViewHolder>
java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.Adapter<VH extends android.support.v7.widget.RecyclerView.ViewHolder>
     ↳ com.h6ah4i.android.widget.advrecyclerview.utils.AbstractExpandableItemAdapter<GVH extends android.support.v7.widget.RecyclerView.ViewHolder, CVH extends android.support.v7.widget.RecyclerView.ViewHolder>

Summary

Public Constructors
AbstractExpandableItemAdapter()
Public Methods
int getChildItemViewType(int groupPosition, int childPosition)
Gets the view type of the specified child.
int getGroupItemViewType(int groupPosition)
Gets the view type of the specified group.
boolean getInitialGroupExpandedState(int groupPosition)
Gets initial expanded state of the group item.
final int getItemCount()
This method will not be called.
final long getItemId(int position)
This method will not be called.
final int getItemViewType(int position)
This method will not be called.
void onBindChildViewHolder(CVH holder, int groupPosition, int childPosition, int viewType, List<Object> payloads)
Called by RecyclerView to display the child data at the specified position.
void onBindGroupViewHolder(GVH holder, int groupPosition, int viewType, List<Object> payloads)
Called by RecyclerView to display the group data at the specified position.
final void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
This method will not be called.
final RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
This method will not be called.
boolean onHookGroupCollapse(int groupPosition, boolean fromUser, Object payload)
Override this method if need to customize the behavior.
boolean onHookGroupCollapse(int groupPosition, boolean fromUser)
Override this method if need to customize the behavior.
boolean onHookGroupExpand(int groupPosition, boolean fromUser)
Override this method if need to customize the behavior.
boolean onHookGroupExpand(int groupPosition, boolean fromUser, Object payload)
Override this method if need to customize the behavior.
[Expand]
Inherited Methods
From class android.support.v7.widget.RecyclerView.Adapter
From class java.lang.Object
From interface com.h6ah4i.android.widget.advrecyclerview.expandable.ExpandableItemAdapter

Public Constructors

public AbstractExpandableItemAdapter ()

Public Methods

public int getChildItemViewType (int groupPosition, int childPosition)

Gets the view type of the specified child.

Parameters
groupPosition the position of the group that contains the child
childPosition the position of the child within the group for which the view type is wanted
Returns
  • integer value identifying the type of the view needed to represent the group item at position. Type codes need positive number but not be contiguous.

public int getGroupItemViewType (int groupPosition)

Gets the view type of the specified group.

Parameters
groupPosition the position of the group for which the view type is wanted
Returns
  • integer value identifying the type of the view needed to represent the group item at position. Type codes need positive number but not be contiguous.

public boolean getInitialGroupExpandedState (int groupPosition)

Gets initial expanded state of the group item. This method is called when initially creating a wrapper adapter and also when the data set is changed.

Parameters
groupPosition The position of the group
Returns
  • True for expanded, otherwise false.

public final int getItemCount ()

This method will not be called. Override getGroupCount() and getChildCount(int) instead.

Returns
  • 0

public final long getItemId (int position)

This method will not be called. Override getGroupId(int) and getChildId(int, int) instead.

Parameters
position not used
Returns

public final int getItemViewType (int position)

This method will not be called. Override getGroupItemViewType(int) and getChildItemViewType(int, int) instead.

Parameters
position not used
Returns
  • 0

public void onBindChildViewHolder (CVH holder, int groupPosition, int childPosition, int viewType, List<Object> payloads)

Called by RecyclerView to display the child data at the specified position. This method should update the contents of the itemView to reflect the item at the given position.

Parameters
holder The ViewHolder which should be updated to represent the contents of the item at the given position in the data set
groupPosition The position of the group item within the adapter's data set
childPosition The position of the child item within the group
viewType The view type code
payloads A non-null list of merged payloads. Can be empty list if requires full update.

public void onBindGroupViewHolder (GVH holder, int groupPosition, int viewType, List<Object> payloads)

Called by RecyclerView to display the group data at the specified position. This method should update the contents of the itemView to reflect the item at the given position.

Parameters
holder The ViewHolder which should be updated to represent the contents of the item at the given position in the data set
groupPosition The position of the group item within the adapter's data set
viewType The view type code
payloads A non-null list of merged payloads. Can be empty list if requires full update.

public final void onBindViewHolder (RecyclerView.ViewHolder holder, int position)

Parameters
holder not used
position not used

public final RecyclerView.ViewHolder onCreateViewHolder (ViewGroup parent, int viewType)

Parameters
parent not used
viewType not used
Returns
  • null

public boolean onHookGroupCollapse (int groupPosition, boolean fromUser, Object payload)

Override this method if need to customize the behavior. Called when a group attempt to expand by user operation or by collapseGroup(int) method.

Parameters
groupPosition The position of the group item within the adapter's data set
fromUser Whether the collapse request is issued by a user operation
payload Optional parameter, use null to identify a "full" update the group item
Returns
  • Whether the group can be collapsed. If returns false, the group keeps expanded.

public boolean onHookGroupCollapse (int groupPosition, boolean fromUser)

Override this method if need to customize the behavior. Called when a group attempt to expand by user operation or by collapseGroup(int) method.

Parameters
groupPosition The position of the group item within the adapter's data set
fromUser Whether the collapse request is issued by a user operation
Returns
  • Whether the group can be collapsed. If returns false, the group keeps expanded.

public boolean onHookGroupExpand (int groupPosition, boolean fromUser)

Override this method if need to customize the behavior. Called when a group attempt to expand by user operation or by expandGroup(int) method.

Parameters
groupPosition The position of the group item within the adapter's data set
fromUser Whether the expand request is issued by a user operation
Returns
  • Whether the group can be expanded. If returns false, the group keeps collapsed.

public boolean onHookGroupExpand (int groupPosition, boolean fromUser, Object payload)

Override this method if need to customize the behavior. Called when a group attempt to expand by user operation or by expandGroup(int) method.

Parameters
groupPosition The position of the group item within the adapter's data set
fromUser Whether the expand request is issued by a user operation
payload Optional parameter, use null to identify a "full" update the group item
Returns
  • Whether the group can be expanded. If returns false, the group keeps collapsed.