public class

ExploreAdapter

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.ui_components.explore.ExploreAdapter

Summary

Nested Classes
class ExploreAdapter.BuildingInfoData  
class ExploreAdapter.ChildViewHolder  
class ExploreAdapter.EmptyGroupViewHolder  
class ExploreAdapter.ExpandableGroupData  
interface ExploreAdapter.ExploreAdapterListener  
class ExploreAdapter.GroupWithChildrenViewHolder  
Public Constructors
ExploreAdapter(List<ExploreAdapter.ExpandableGroupData> dataItems)
Public Methods
static List<ExploreAdapter.ExpandableGroupData> createDataItems(List<? extends ISearchable> exploreList, CoreApi coreApi)
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
void hideNearestButton()
boolean isChild(int viewType)
boolean isGroup(int viewType)
void onBindChildViewHolder(ExploreAdapter.ChildViewHolder 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.

ExploreAdapter.ChildViewHolder 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(ExploreAdapter.ExploreAdapterListener 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 ExploreAdapter (List<ExploreAdapter.ExpandableGroupData> dataItems)

Public Methods

public static List<ExploreAdapter.ExpandableGroupData> createDataItems (List<? extends ISearchable> exploreList, CoreApi coreApi)

public int getChildViewType (int position, ExpandableGroup group, int childIndex)

Used to allow subclasses to have multiple view types for children

Parameters
position the flat position in the list
group the group that this child belongs to
childIndex the index of the child within the group
Returns
  • any int representing the viewType for a child within the group *EXCEPT* for CHILD and GROUP. If you do *not* override this method, the default viewType for a group is CHILD

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

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 void hideNearestButton ()

public boolean isChild (int viewType)

Parameters
viewType the int corresponding to the viewType of a child of a ExpandableGroup
Returns
  • if a subclasses has *NOT* overridden getChildViewType than the viewType for the child is defaulted to CHILD

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 (ExploreAdapter.ChildViewHolder 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 ExploreAdapter.ChildViewHolder 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 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 getItemViewType(int)
Returns
  • A GVH corresponding to the group list item with the ViewGroup parent

public void setListener (ExploreAdapter.ExploreAdapterListener listener)