Don't show contact picker if no contact picker activity is available

pull/14/head
Sam Bosley 13 years ago
parent 3efa3c0756
commit a47e7493a0

@ -394,7 +394,7 @@ public class EditPeopleControlSet extends PopupControlSet {
new JSONObject().put("default_picture", R.drawable.icn_friends) new JSONObject().put("default_picture", R.drawable.icn_friends)
.put(CONTACT_CHOOSER_USER, true)); .put(CONTACT_CHOOSER_USER, true));
int contactsIndex = addUnassigned ? 2 : 1; int contactsIndex = addUnassigned ? 2 : 1;
boolean addContactPicker = Preferences.getBoolean(R.string.p_use_contact_picker, true); boolean addContactPicker = Preferences.getBoolean(R.string.p_use_contact_picker, true) && contactPickerAvailable();
if (addContactPicker) if (addContactPicker)
coreUsers.add(contactsIndex, contactPickerUser); coreUsers.add(contactsIndex, contactPickerUser);
@ -646,6 +646,11 @@ public class EditPeopleControlSet extends PopupControlSet {
}); });
} }
private boolean contactPickerAvailable() {
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
return activity.getPackageManager().queryIntentActivities(intent, 0).size() > 0;
}
// --- events // --- events
@Override @Override

Loading…
Cancel
Save