Search and select a contact

相关类
packages/apps/Contacts/src/com/android/contacts/activities/ActionBarAdapter.java
packages/apps/Contacts/src/com/android/contacts/list/ContactEntryListFragment.java
packages/providers/ContactsProvider/src/com/android/providers/contacts/NameNormalizer.java

Search and select a contact mode switching process
to search for contacts and select the contacts are initiated ActionBarAdapter class

ActionBarAdapter.Listener defined onAction () and onUpButtonPressed () method listens search for and select a contact

ActionBarAdapter.Listener.Action defined a series of operational modes of contact list

. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
10
. 11
12 is
13 is
14
15
16
. 17
18 is
. 19
20 is
public interface The Listener {
public abstract class the Action {
// when the search text search text box is changed, the Action triggered, for a contact in accordance with the input character query filter
public static int CHANGE_SEARCH_QUERY Final = 0;
// open search for a contact mode, adjust the screen, display a search box and search interface, search mode
public static int START_SEARCH_MODE Final = 1;
// turn select a contact mode, adjust the interface, display selection frame assembly, selection mode
public static int START_SELECTION_MODE Final = 2;
// Close search or selection mode, the interface to restore the contact list
public static int STOP_SEARCH_AND_SELECTION_MODE = Final. 3;
// Close search or selection mode, the button animation operation tab
Final static int = BEGIN_STOPPING_SEARCH_AND_SELECTION_MODE public. 4;
}
// send the Action startup mode, startup mode selection search or
void the onAction (int Action);
// return button listener, or to cancel selection mode searching
void onUpButtonPressed ();
}
search contacts mainly CHANGE_SEARCH_QUERY action initiated by the code with calls to ContactEntryListFragment class setQueryString () method, set the global query keywords in here and call the reloadData () method for data search

. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
10
. 11
12 is
// the TODO: The paramter delaySelection IS Not in use, and the let apos Remove IT.
Public void setQueryString (String the queryString, Boolean delaySelection) {
IF (TextUtils.equals (mQueryString, the queryString! )) {
......
IF (mAdapter = null) {!
// set the search keyword
mAdapter.setQueryString (the queryString);
// boot loader starts loading data contacts
the reloadData ();
}
}
}
search contacts ContactsProvider call flow
loader calls ContactsProvider search for contacts using the call ContactsProvider2.query () method, Uri using Contacts.ENTERPRISE_CONTENT_FILTER_URI

Create a contact when stored normallized_name listed in contacts2.db name_lookup table in the database, the data source of this column is NameNormalize.normalize () conversion of displayname

Mainly by normallized_name fuzzy matching data row search for contacts, and a conversion algorithm matching the algorithm in this method self-study

1
2
3
4
5
6
7
8
/**
* Converts the supplied name to a string that can be used to perform approximate matching
* of names. It ignores non-letter, non-digit characters, and removes accents.
*/
public static String normalize(String name) {
CollationKey key = getCompressingCollator().getCollationKey(lettersAndDigitsOnly(name));
return Hex.encodeHex(key.toByteArray(http://www.amjmh.com), true);
}
SIM卡联系人操作
相关类
frameworks/opt/telephony/src/java/com/android/internal/telephony/IccProvider.java
frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/UiccController.java
————————————————

Guess you like

Origin www.cnblogs.com/ly570/p/11414324.html