public abstract class BaseEmailAddressAdapter extends CompositeCursorAdapter implements Filterable
ContactsContract.CommonDataKinds.Email.CONTENT_FILTER_URI
to search for data rows by email address
and/or contact name. It also searches registered Directory
's.Modifier and Type | Class and Description |
---|---|
static class |
BaseEmailAddressAdapter.DirectoryPartition
Model object for a
Directory row. |
CompositeCursorAdapter.Partition
Modifier and Type | Field and Description |
---|---|
protected ContentResolver |
mContentResolver |
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
Constructor and Description |
---|
BaseEmailAddressAdapter(Context context) |
BaseEmailAddressAdapter(Context context,
int preferredMaxResultCount) |
Modifier and Type | Method and Description |
---|---|
boolean |
areAllItemsEnabled()
Returns false if any partition has a header.
|
protected void |
bindView(View v,
int partition,
Cursor cursor,
int position)
Binds an item view for the specified partition and position.
|
protected abstract void |
bindView(View view,
String directoryType,
String directoryName,
String displayName,
String emailAddress)
Override to populate the autocomplete suggestion line item UI with data.
|
protected abstract void |
bindViewLoading(View view,
String directoryType,
String directoryName)
Override to populate the "Searching directory" line item UI with data.
|
Filter |
getFilter()
Returns a filter that can be used to constrain data with a filtering
pattern.
|
protected int |
getItemViewType(int partitionIndex,
int position)
Returns the view type for the list item at the specified position in the
specified partition.
|
protected abstract View |
inflateItemView(ViewGroup parent)
Override to create a view for line item in the autocomplete suggestion list UI.
|
protected abstract View |
inflateItemViewLoading(ViewGroup parent)
Override to create a view for a "Searching directory" line item, which is
displayed temporarily while the corresponding filter is running.
|
protected boolean |
isEnabled(int partitionIndex,
int position)
Returns true if the item at the specified offset of the specified
partition is selectable and clickable.
|
protected View |
newView(Context context,
int partitionIndex,
Cursor cursor,
int position,
ViewGroup parent)
Creates an item view for the specified partition and position.
|
protected void |
onDirectoryLoadFinished(CharSequence constraint,
Cursor directoryCursor,
Cursor defaultPartitionCursor)
Handles the result of the initial call, which brings back the list of
directories as well as the search results for the local directories.
|
void |
onPartitionLoadFinished(CharSequence constraint,
int partitionIndex,
Cursor cursor) |
void |
setAccount(Account account)
Set the account when known.
|
addPartition, addPartition, addPartition, bindHeaderView, changeCursor, clearPartitions, close, ensureCacheValid, getContext, getCount, getCursor, getHeaderView, getItem, getItemId, getItemViewType, getItemViewTypeCount, getOffsetInPartition, getPartition, getPartitionCount, getPartitionForPosition, getPositionForPartition, getView, getView, getViewTypeCount, hasHeader, invalidate, isEnabled, isPartitionEmpty, newHeaderView, notifyDataSetChanged, removePartition, setHasHeader, setNotificationsEnabled, setShowIfEmpty
getDropDownView, hasStableIds, isEmpty, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
protected final ContentResolver mContentResolver
public BaseEmailAddressAdapter(Context context)
public BaseEmailAddressAdapter(Context context, int preferredMaxResultCount)
public void setAccount(Account account)
protected abstract View inflateItemView(ViewGroup parent)
protected abstract void bindView(View view, String directoryType, String directoryName, String displayName, String emailAddress)
protected abstract View inflateItemViewLoading(ViewGroup parent)
protected abstract void bindViewLoading(View view, String directoryType, String directoryName)
protected int getItemViewType(int partitionIndex, int position)
CompositeCursorAdapter
getItemViewType
in class CompositeCursorAdapter
protected View newView(Context context, int partitionIndex, Cursor cursor, int position, ViewGroup parent)
CompositeCursorAdapter
newView
in class CompositeCursorAdapter
protected void bindView(View v, int partition, Cursor cursor, int position)
CompositeCursorAdapter
bindView
in class CompositeCursorAdapter
public boolean areAllItemsEnabled()
CompositeCursorAdapter
areAllItemsEnabled
in interface ListAdapter
areAllItemsEnabled
in class CompositeCursorAdapter
ListAdapter.isEnabled(int)
protected boolean isEnabled(int partitionIndex, int position)
CompositeCursorAdapter
isEnabled
in class CompositeCursorAdapter
public Filter getFilter()
Filterable
Returns a filter that can be used to constrain data with a filtering pattern.
This method is usually implemented by Adapter
classes.
getFilter
in interface Filterable
protected void onDirectoryLoadFinished(CharSequence constraint, Cursor directoryCursor, Cursor defaultPartitionCursor)
public void onPartitionLoadFinished(CharSequence constraint, int partitionIndex, Cursor cursor)