Class BaseExpandableListAdapter
- All Implemented Interfaces:
ExpandableListAdapter,HeterogeneousExpandableList
ExpandableListAdapter used to provide data and Views
from some data to an expandable list view.
Adapters inheriting this class should verify that the base implementations of
getCombinedChildId(long, long) and getCombinedGroupId(long)
are correct in generating unique IDs from the group/children IDs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetChildType(int groupPosition, int childPosition) Get the type of child View that will be created byExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)for the specified child item.intReturns the number of types of child Views that will be created byExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup).longgetCombinedChildId(long groupId, long childId) Override this method if you foresee a clash in IDs based on this scheme:longgetCombinedGroupId(long groupId) Override this method if you foresee a clash in IDs based on this scheme:intgetGroupType(int groupPosition) Get the type of group View that will be created byExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup).intReturns the number of types of group Views that will be created byExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup).booleanisEmpty()voidvoidvoidonGroupCollapsed(int groupPosition) Called when a group is collapsed.voidonGroupExpanded(int groupPosition) Called when a group is expanded.voidregisterDataSetObserver(DataSetObserver observer) voidunregisterDataSetObserver(DataSetObserver observer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface icyllis.modernui.widget.ExpandableListAdapter
getChild, getChildId, getChildrenCount, getChildView, getGroup, getGroupCount, getGroupId, getGroupView, hasStableIds, isChildSelectable
-
Constructor Details
-
BaseExpandableListAdapter
public BaseExpandableListAdapter()
-
-
Method Details
-
registerDataSetObserver
- Specified by:
registerDataSetObserverin interfaceExpandableListAdapter- See Also:
-
unregisterDataSetObserver
- Specified by:
unregisterDataSetObserverin interfaceExpandableListAdapter- See Also:
-
notifyDataSetInvalidated
public void notifyDataSetInvalidated()- See Also:
-
notifyDataSetChanged
public void notifyDataSetChanged()- See Also:
-
areAllItemsEnabled
public boolean areAllItemsEnabled()- Specified by:
areAllItemsEnabledin interfaceExpandableListAdapter- See Also:
-
onGroupCollapsed
public void onGroupCollapsed(int groupPosition) Description copied from interface:ExpandableListAdapterCalled when a group is collapsed.- Specified by:
onGroupCollapsedin interfaceExpandableListAdapter- Parameters:
groupPosition- The group being collapsed.
-
onGroupExpanded
public void onGroupExpanded(int groupPosition) Description copied from interface:ExpandableListAdapterCalled when a group is expanded.- Specified by:
onGroupExpandedin interfaceExpandableListAdapter- Parameters:
groupPosition- The group being expanded.
-
getCombinedChildId
public long getCombinedChildId(long groupId, long childId) Override this method if you foresee a clash in IDs based on this scheme:Base implementation returns a long:
- bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 1.
- bit 1-31: Lower 31 bits of the groupId
- bit 32-63: Lower 32 bits of the childId.
Gets an ID for a child that is unique across any item (either group or child) that is in this list. Expandable lists require each item (group or child) to have a unique ID among all children and groups in the list. This method is responsible for returning that unique ID given a child's ID and its group's ID. Furthermore, if
ExpandableListAdapter.hasStableIds()is true, the returned ID must be stable as well.- Specified by:
getCombinedChildIdin interfaceExpandableListAdapter- Parameters:
groupId- The ID of the group that contains this child.childId- The ID of the child.- Returns:
- The unique (and possibly stable) ID of the child across all groups and children in this list.
-
getCombinedGroupId
public long getCombinedGroupId(long groupId) Override this method if you foresee a clash in IDs based on this scheme:Base implementation returns a long:
- bit 0: Whether this ID points to a child (unset) or group (set), so for this method this bit will be 0.
- bit 1-31: Lower 31 bits of the groupId
- bit 32-63: Lower 32 bits of the childId.
Gets an ID for a group that is unique across any item (either group or child) that is in this list. Expandable lists require each item (group or child) to have a unique ID among all children and groups in the list. This method is responsible for returning that unique ID given a group's ID. Furthermore, if
ExpandableListAdapter.hasStableIds()is true, the returned ID must be stable as well.- Specified by:
getCombinedGroupIdin interfaceExpandableListAdapter- Parameters:
groupId- The ID of the group- Returns:
- The unique (and possibly stable) ID of the group across all groups and children in this list.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceExpandableListAdapter- See Also:
-
getChildType
public int getChildType(int groupPosition, int childPosition) Get the type of child View that will be created byExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)for the specified child item.- Specified by:
getChildTypein interfaceHeterogeneousExpandableList- Parameters:
groupPosition- the position of the group that the child resides inchildPosition- the position of the child with respect to other children in the group- Returns:
- 0 for any group or child position, since only one child type count is declared.
- See Also:
-
getChildTypeCount
public int getChildTypeCount()Returns the number of types of child Views that will be created by
This method will only be called when the adapter is set on theExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup). Each type represents a set of views that can be converted inExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup), for any group. If the adapter always returns the same type of View for all child items, this method should return 1.AdapterView.- Specified by:
getChildTypeCountin interfaceHeterogeneousExpandableList- Returns:
- 1 as a default value in BaseExpandableListAdapter.
- See Also:
-
getGroupType
public int getGroupType(int groupPosition) Get the type of group View that will be created byExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup). for the specified group item.- Specified by:
getGroupTypein interfaceHeterogeneousExpandableList- Parameters:
groupPosition- the position of the group for which the type should be returned.- Returns:
- 0 for any groupPosition, since only one group type count is declared.
- See Also:
-
getGroupTypeCount
public int getGroupTypeCount()Returns the number of types of group Views that will be created by
This method will only be called when the adapter is set on theExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup). Each type represents a set of views that can be converted inExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup). If the adapter always returns the same type of View for all group items, this method should return 1.AdapterView.- Specified by:
getGroupTypeCountin interfaceHeterogeneousExpandableList- Returns:
- 1 as a default value in BaseExpandableListAdapter.
- See Also:
-