Methods Summary |
---|
public void | doFilter(android.net.Uri uri, java.lang.String filterString)
if (!uri.equals(mUri)) {
mUri = uri;
Cursor contactCursor = runQuery(filterString);
if (mContactAdapter == null) {
mContactAdapter = new ContactAdapter(mContext, contactCursor);
mFilter = mContactAdapter.getFilter();
mContactListView.setAdapter(mContactAdapter);
} else {
mContactAdapter.changeCursor(contactCursor);
}
} else {
mFilter.filter(filterString);
}
|
public android.database.Cursor | getContactAtPosition(int position)
return (Cursor) mContactAdapter.getItem(position);
|
public android.widget.ListView | getListView()
return mContactListView;
|
protected void | onFinishInflate()
mContactListView = (ListView) findViewById(R.id.filteredList);
mContactListView.setTextFilterEnabled(true);
mContactListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View view, int position,
long id) {
if (mContext instanceof ContactListActivity) {
ContactListActivity list = (ContactListActivity) mContext;
mContactListView.setSelection(position);
Cursor c = (Cursor) mContactListView.getSelectedItem();
list.mContactListView.startChat(c);
list.showContactListView();
}
}
});
|
android.database.Cursor | runQuery(java.lang.CharSequence constraint)
StringBuilder buf = new StringBuilder();
// exclude chatting contact
buf.append(Im.Chats.LAST_MESSAGE_DATE);
buf.append(" IS NULL");
if (constraint != null) {
buf.append(" AND ");
buf.append(Im.Contacts.NICKNAME);
buf.append(" LIKE ");
DatabaseUtils.appendValueToSql(buf, "%" + constraint + "%");
}
return mContext.getContentResolver().query(mUri, ContactView.CONTACT_PROJECTION,
buf == null ? null : buf.toString(), null, Im.Contacts.DEFAULT_SORT_ORDER);
|