public abstract class

GroupingListAdapter

extends BaseAdapter
java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ com.android.contacts.GroupingListAdapter

Class Overview

Maintains a list that groups adjacent items sharing the same value of a "group-by" field. The list has three types of elements: stand-alone, group header and group child. Groups are collapsible and collapsed by default.

Summary

Nested Classes
class GroupingListAdapter.PositionMetadata Information about a specific list item: is it a group, if so is it expanded. 
Constants
int ITEM_TYPE_GROUP_HEADER
int ITEM_TYPE_IN_GROUP
int ITEM_TYPE_STANDALONE
[Expand]
Inherited Constants
From interface android.widget.Adapter
Fields
protected ContentObserver mChangeObserver
protected DataSetObserver mDataSetObserver
Public Constructors
GroupingListAdapter(Context context)
Public Methods
void changeCursor(Cursor cursor)
int getCount()
Cursor getCursor()
int getGroupSize(int position)
Given a position of a groups header in the list, returns the size of the corresponding group.
Object getItem(int position)
long getItemId(int position)
int getItemViewType(int position)
View getView(int position, View convertView, ViewGroup parent)
int getViewTypeCount()
boolean isGroupHeader(int position)
Returns true if the specified position in the list corresponds to a group header.
void obtainPositionMetadata(GroupingListAdapter.PositionMetadata metadata, int position)
Figures out whether the item at the specified position represents a stand-alone element, a group or a group child.
void toggleGroup(int position)
Mark group as expanded if it is collapsed and vice versa.
Protected Methods
void addGroup(int cursorPosition, int size, boolean expanded)
Records information about grouping in the list.
abstract void addGroups(Cursor cursor)
Finds all groups of adjacent items in the cursor and calls addGroup(int, int, boolean) for each of them.
abstract void bindChildView(View view, Context context, Cursor cursor)
abstract void bindGroupView(View view, Context context, Cursor cursor, int groupSize, boolean expanded)
abstract void bindStandAloneView(View view, Context context, Cursor cursor)
abstract View newChildView(Context context, ViewGroup parent)
abstract View newGroupView(Context context, ViewGroup parent)
abstract View newStandAloneView(Context context, ViewGroup parent)
void onContentChanged()
[Expand]
Inherited Methods
From class android.widget.BaseAdapter
From class java.lang.Object
From interface android.widget.Adapter
From interface android.widget.ListAdapter
From interface android.widget.SpinnerAdapter

Constants

public static final int ITEM_TYPE_GROUP_HEADER

Constant Value: 1 (0x00000001)

public static final int ITEM_TYPE_IN_GROUP

Constant Value: 2 (0x00000002)

public static final int ITEM_TYPE_STANDALONE

Constant Value: 0 (0x00000000)

Fields

protected ContentObserver mChangeObserver

protected DataSetObserver mDataSetObserver

Public Constructors

public GroupingListAdapter (Context context)

Public Methods

public void changeCursor (Cursor cursor)

public int getCount ()

public Cursor getCursor ()

public int getGroupSize (int position)

Given a position of a groups header in the list, returns the size of the corresponding group.

public Object getItem (int position)

public long getItemId (int position)

public int getItemViewType (int position)

public View getView (int position, View convertView, ViewGroup parent)

public int getViewTypeCount ()

public boolean isGroupHeader (int position)

Returns true if the specified position in the list corresponds to a group header.

public void obtainPositionMetadata (GroupingListAdapter.PositionMetadata metadata, int position)

Figures out whether the item at the specified position represents a stand-alone element, a group or a group child. Also computes the corresponding cursor position.

public void toggleGroup (int position)

Mark group as expanded if it is collapsed and vice versa.

Protected Methods

protected void addGroup (int cursorPosition, int size, boolean expanded)

Records information about grouping in the list. Should be called by the overridden addGroups(Cursor) method.

protected abstract void addGroups (Cursor cursor)

Finds all groups of adjacent items in the cursor and calls addGroup(int, int, boolean) for each of them.

protected abstract void bindChildView (View view, Context context, Cursor cursor)

protected abstract void bindGroupView (View view, Context context, Cursor cursor, int groupSize, boolean expanded)

protected abstract void bindStandAloneView (View view, Context context, Cursor cursor)

protected abstract View newChildView (Context context, ViewGroup parent)

protected abstract View newGroupView (Context context, ViewGroup parent)

protected abstract View newStandAloneView (Context context, ViewGroup parent)

protected void onContentChanged ()