public class

ExpandableCategoryAdapter

extends MultiTypeExpandableRecyclerViewAdapter<GVH extends GroupViewHolder, CVH extends ChildViewHolder>
java.lang.Object
   ↳ RecyclerView.Adapter
     ↳ com.mapsted.ui.views.widgets.expandablerecyclerview.ExpandableRecyclerViewAdapter<GVH extends com.mapsted.ui.views.widgets.expandablerecyclerview.viewholders.GroupViewHolder, CVH extends com.mapsted.ui.views.widgets.expandablerecyclerview.viewholders.ChildViewHolder>
       ↳ com.mapsted.ui.views.widgets.expandablerecyclerview.MultiTypeExpandableRecyclerViewAdapter<GVH extends com.mapsted.ui.views.widgets.expandablerecyclerview.viewholders.GroupViewHolder, CVH extends com.mapsted.ui.views.widgets.expandablerecyclerview.viewholders.ChildViewHolder>
         ↳ com.mapsted.template_core.ui.category.adapter.ExpandableCategoryAdapter

Summary

Nested Classes
class ExpandableCategoryAdapter.EmptyChildrenParentCategoryViewHolder Category view holder for parent categories without children  
interface ExpandableCategoryAdapter.ExpandableCategoryAdapterListener  
class ExpandableCategoryAdapter.ParentCategoryViewHolder Category view holder for parent categories with children  
Public Constructors
ExpandableCategoryAdapter(List<ExpandableCategoryGroup> expandableCategoryGroups, Context context, List<Integer> propertyIds, String fallbackIconUrl)
Public Methods
int getGroupViewType(int position, ExpandableGroup group)
Used to allow subclasses to have multiple view types for groups
boolean isGroup(int viewType)
void onBindChildViewHolder(ExpandableCategoryAdapter.ChildCategoryViewHolder holder, int flatPosition, ExpandableGroup group, int childIndex)
Called from onBindViewHolder(RecyclerView.ViewHolder, int) when the list item bound to is a child.
void onBindGroupViewHolder(GroupViewHolder holder, int flatPosition, ExpandableGroup group)
Called from onBindViewHolder(RecyclerView.ViewHolder, int) when the list item bound to is a group

Bind data to the GVH here.

ExpandableCategoryAdapter.ChildCategoryViewHolder onCreateChildViewHolder(ViewGroup parent, int viewType)
Called from onCreateViewHolder(ViewGroup, int) when the list item created is a child
GroupViewHolder onCreateGroupViewHolder(ViewGroup parent, int viewType)
Called from onCreateViewHolder(ViewGroup, int) when the list item created is a group
void setListener(ExpandableCategoryAdapter.ExpandableCategoryAdapterListener listener)
[Expand]
Inherited Methods
From class com.mapsted.ui.views.widgets.expandablerecyclerview.MultiTypeExpandableRecyclerViewAdapter
From class com.mapsted.ui.views.widgets.expandablerecyclerview.ExpandableRecyclerViewAdapter
From class java.lang.Object
From interface com.mapsted.ui.views.widgets.expandablerecyclerview.listeners.ExpandCollapseListener
From interface com.mapsted.ui.views.widgets.expandablerecyclerview.listeners.OnGroupClickListener

Public Constructors

public ExpandableCategoryAdapter (List<ExpandableCategoryGroup> expandableCategoryGroups, Context context, List<Integer> propertyIds, String fallbackIconUrl)

Public Methods

public int getGroupViewType (int position, ExpandableGroup group)

Used to allow subclasses to have multiple view types for groups

Parameters
position the flat position in the list
group the group at this position
Returns
  • any int representing the viewType for this group *EXCEPT* for CHILD and GROUP. If you do not override this method, the default viewType for a group is GROUP

    A subclass may use any number *EXCEPT* for CHILD and GROUP as those are already being used by the adapter

public boolean isGroup (int viewType)

Parameters
viewType the int corresponding to the viewType of a ExpandableGroup
Returns
  • if a subclasses has *NOT* overridden getGroupViewType than the viewType for the group is defaulted to GROUP

public void onBindChildViewHolder (ExpandableCategoryAdapter.ChildCategoryViewHolder holder, int flatPosition, ExpandableGroup group, int childIndex)

Called from onBindViewHolder(RecyclerView.ViewHolder, int) when the list item bound to is a child.

Bind data to the CVH here.

Parameters
holder The CVH to bind data to
flatPosition the flat position (raw index) in the list at which to bind the child
group The ExpandableGroup that the the child list item belongs to
childIndex the index of this child within it's ExpandableGroup

public void onBindGroupViewHolder (GroupViewHolder holder, int flatPosition, ExpandableGroup group)

Called from onBindViewHolder(RecyclerView.ViewHolder, int) when the list item bound to is a group

Bind data to the GVH here.

Parameters
holder The GVH to bind data to
flatPosition the flat position (raw index) in the list at which to bind the group
group The ExpandableGroup to be used to bind data to this GVH

public ExpandableCategoryAdapter.ChildCategoryViewHolder onCreateChildViewHolder (ViewGroup parent, int viewType)

Called from onCreateViewHolder(ViewGroup, int) when the list item created is a child

Parameters
parent the ViewGroup in the list for which a CVH is being created
viewType an int returned by ExpandableRecyclerViewAdapter#getItemViewType(int)
Returns
  • A CVH corresponding to child list item with the ViewGroup parent

public GroupViewHolder onCreateGroupViewHolder (ViewGroup parent, int viewType)

Called from onCreateViewHolder(ViewGroup, int) when the list item created is a group

Parameters
parent the ViewGroup in the list for which a GVH is being created
viewType an int returned by ExpandableRecyclerViewAdapter#getItemViewType(int)
Returns
  • A GVH corresponding to the group list item with the ViewGroup parent