public abstract class MultiTypeExpandableRecyclerViewAdapter<GVH extends GroupViewHolder,CVH extends ChildViewHolder> extends ExpandableRecyclerViewAdapter<GVH,CVH>
expandableList| Constructor and Description |
|---|
MultiTypeExpandableRecyclerViewAdapter(java.util.List<? extends ExpandableGroup> groups) |
| Modifier and Type | Method and Description |
|---|---|
int |
getChildViewType(int position,
ExpandableGroup group,
int childIndex)
Used to allow subclasses to have multiple view types for children
|
int |
getGroupViewType(int position,
ExpandableGroup group)
Used to allow subclasses to have multiple view types for groups
|
int |
getItemViewType(int position)
Gets the view type of the item at the given position.
|
boolean |
isChild(int viewType) |
boolean |
isGroup(int viewType) |
void |
onBindViewHolder(ViewHolder holder,
int position)
Implementation of Adapter.onBindViewHolder(RecyclerView.ViewHolder, int)
that determines if the list item is a group or a child and calls through
to the appropriate implementation of either
ExpandableRecyclerViewAdapter.onBindGroupViewHolder(GroupViewHolder,
int,
ExpandableGroup)
or ExpandableRecyclerViewAdapter.onBindChildViewHolder(ChildViewHolder, int, ExpandableGroup, int). |
ViewHolder |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType)
Implementation of RecyclerView.Adapter.onCreateViewHolder(ViewGroup, int)
that determines if the list item is a group or a child and calls through
to the appropriate implementation of either
ExpandableRecyclerViewAdapter.onCreateGroupViewHolder(ViewGroup, int)
or ExpandableRecyclerViewAdapter.onCreateChildViewHolder(ViewGroup, int)}. |
getGroups, getItemCount, isGroupExpanded, isGroupExpanded, onBindChildViewHolder, onBindGroupViewHolder, onCreateChildViewHolder, onCreateGroupViewHolder, onGroupClick, onGroupCollapsed, onGroupExpanded, onRestoreInstanceState, onSaveInstanceState, setOnGroupClickListener, setOnGroupExpandCollapseListener, toggleGroup, toggleGrouppublic MultiTypeExpandableRecyclerViewAdapter(java.util.List<? extends ExpandableGroup> groups)
public ViewHolder onCreateViewHolder(android.view.ViewGroup parent,
int viewType)
ExpandableRecyclerViewAdapter.onCreateGroupViewHolder(ViewGroup, int)
or ExpandableRecyclerViewAdapter.onCreateChildViewHolder(ViewGroup, int)}.onCreateViewHolder in class ExpandableRecyclerViewAdapter<GVH extends GroupViewHolder,CVH extends ChildViewHolder>parent - 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 android.view.View.GroupViewHolder or a new ChildViewHolder
that holds a android.view.View of the given view type.public void onBindViewHolder(ViewHolder holder,
int position)
ExpandableRecyclerViewAdapter.onBindGroupViewHolder(GroupViewHolder,
int,
ExpandableGroup)
or ExpandableRecyclerViewAdapter.onBindChildViewHolder(ChildViewHolder, int, ExpandableGroup, int).onBindViewHolder in class ExpandableRecyclerViewAdapter<GVH extends GroupViewHolder,CVH extends ChildViewHolder>holder - Either the GroupViewHolder or the ChildViewHolder to bind data toposition - The flat position (or index in the list of ExpandableList.getVisibleItemCount() in the list at which to bindpublic int getItemViewType(int position)
getItemViewType in class ExpandableRecyclerViewAdapter<GVH extends GroupViewHolder,CVH extends ChildViewHolder>position - The flat position in the list to get the view type ofgetChildViewType. if the flat position refers to a group item this will return the
value returned by getGroupViewTypepublic int getChildViewType(int position,
ExpandableGroup group,
int childIndex)
position - the flat position in the listgroup - the group that this child belongs tochildIndex - the index of the child within the groupgroup *EXCEPT*
for ExpandableListPosition.CHILD and ExpandableListPosition.GROUP.
If you do *not* override this method, the default viewType for a group is ExpandableListPosition.CHILD
A subclass may use any number *EXCEPT* for ExpandableListPosition.CHILD and ExpandableListPosition.GROUP as those are already being used by the adapter
public int getGroupViewType(int position,
ExpandableGroup group)
position - the flat position in the listgroup - the group at this positiongroup *EXCEPT*
for ExpandableListPosition.CHILD and ExpandableListPosition.GROUP.
If you do not override this method, the default viewType for a group is ExpandableListPosition.GROUP
A subclass may use any number *EXCEPT* for ExpandableListPosition.CHILD and ExpandableListPosition.GROUP as those are already being used by the adapter
public boolean isGroup(int viewType)
viewType - the int corresponding to the viewType of a ExpandableGroupgetGroupViewType than the viewType for
the group is defaulted to ExpandableListPosition.GROUPpublic boolean isChild(int viewType)
viewType - the int corresponding to the viewType of a child of a ExpandableGroupgetChildViewType than the viewType for
the child is defaulted to ExpandableListPosition.CHILD