How does Android Mix the SDN number and other regular numbers in the phone book?

Source: Internet
Author: User

The original default design will separate SDN separately, with a small title of "Sdn",
The following changes can be achieved by the same arrangement of SDN and regular numbers, in alphabetical order.


Defaultcontactlistadapter.java in the Configureselection () method
Comment out the following statement for selection Is_sdn_contact + "< 1" (Total five):
/**
* M:new Feature SDN <br>
* Origin Code: <br>
* private void Configureselection (<br>
* @{
*/
protected void Configureselection (
Cursorloader Loader, long Directoryid, Contactlistfilter filter) {
if (filter = = NULL) {
Return
}
if (Directoryid! = Directory.default) {
Return
}
StringBuilder selection = new StringBuilder ();
list<string> Selectionargs = new arraylist<string> ();
Switch (filter.filtertype) {
Case Contactlistfilter.filter_type_all_accounts: {
We have already added directory=0 to the URI, which takes care of this
Filter
/** m:new Feature SDN @{*/
1 selection.append (Rawcontacts.is_sdn_contact + "< 1");
Selection.append (Rawcontacts.is_sdn_contact + "< 2");
/** @} */
Break
}
Case Contactlistfilter.filter_type_single_contact: {
We have already added the "lookup key to the" URI, which takes care of this
Filter
Break
}
Case contactlistfilter.filter_type_starred: {
Selection.append (contacts.starred + "!=0");
Break
}
Case Contactlistfilter.filter_type_with_phone_numbers_only: {
Selection.append (contacts.has_phone_number + "= 1");
/** m:new Feature SDN @{*/
2 Selection.append ("and" + Rawcontacts.is_sdn_contact + "< 1");
/** @} */
Break
}
Case Contactlistfilter.filter_type_custom: {
Selection.append (contacts.in_visible_group + "= 1");
if (Iscustomfilterforphonenumbersonly ()) {
Selection.append ("and" + contacts.has_phone_number + "= 1");
}
/** m:new Feature SDN @{*/
3 Selection.append ("and" + Rawcontacts.is_sdn_contact + "< 1");
/** @} */
Break
}
Case Contactlistfilter.filter_type_account: {
We use the query parameters for account filter, so no selection to add here.
/** m:change feature:as Local Phone account contains null account and phone
* Account, the account of Query Parameter could not meet this requirement. So,
* We should keep to query contacts with selection. @{ */
if (AccountType.ACCOUNT_TYPE_LOCAL_PHONE.equals (Filter.accounttype)) {
Selection.append ("EXISTS ("
+ "Select DISTINCT" + rawcontacts.contact_id
+ "from View_raw_contacts"
+ "WHERE (");
4 Selection.append (Rawcontacts.is_sdn_contact + "< 1 and");
Selection.append (rawcontacts.contact_id + "=" + "view_contacts.")
+ contacts._id
+ "and (" + Rawcontacts.account_type + "is NULL"
+ "and" + Rawcontacts.account_name + "is NULL"
+ "and" + Rawcontacts.data_set + "is NULL"
+ "OR" + rawcontacts.account_type + "=?"
+ "+" + rawcontacts.account_name + "=?");
} else {
Selection.append ("EXISTS ("
+ "Select DISTINCT" + rawcontacts.contact_id
+ "from View_raw_contacts"
+ "WHERE (");
5 Selection.append (Rawcontacts.is_sdn_contact + "< 1 and");
Selection.append (rawcontacts.contact_id + "=" + "view_contacts.")
+ contacts._id
+ "and (" + rawcontacts.account_type + "=?"
+ "+" + rawcontacts.account_name + "=?");
}
Selectionargs.add (Filter.accounttype);
Selectionargs.add (Filter.accountname);
if (filter.dataset! = null) {
Selection.append ("and" + rawcontacts.data_set + "=?)");
Selectionargs.add (Filter.dataset);
} else {
Selection.append ("and" + Rawcontacts.data_set + "is NULL)");
}
Selection.append ("))");
/** @} */
Break
}
}
M:log the selection string.
LOG.D (TAG, "[Configureselection] Selection:" + selection.tostring ());
Loader.setselection (Selection.tostring ());
Loader.setselectionargs (Selectionargs.toarray (new string[0]));
}

How does Android Mix the SDN number and other regular numbers in the phone book?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.