searchfragment/ contains all code relevant to loading, rendering and filtering search results in both dialpad search and regular search.
On device contacts loading happens in SearchContactsCursorLoader. It is used in conjunction with NewSearchFragment and Loader Callbacks to return a cursor from cp2 containing all of the relevant info needed to rendering.
// TODO(calderwoodra)
// TODO(calderwoodra)
NewSearchFragment, SearchAdapter, SearchContactViewHolder and SearchCursorManager are used to render contact information. The fragment's recyclerview, adapter and viewholder work as expected like a normal recyclerview paradigm.
The are three things to note about rendering:
On device contacts are filtered using SearchContactCursor. We wrap the cursor returned from SearchContactsCursorLoader in NewSearchFragment#onLoadFinished in order to abstract away the filtering logic from the recyclerview adapter and viewholders.
SearchContactCursor applies filtering in SearchContactCursor#filter to remove duplicate phone numbers returned from cp2 and phone numbers that do not match the given search query.
Filtering methods used are: