From a47e7493a03b8845682df546840a7731ab977ce9 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 13 Jun 2012 11:49:49 -0700 Subject: [PATCH] Don't show contact picker if no contact picker activity is available --- .../com/todoroo/astrid/actfm/EditPeopleControlSet.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java index 5ac1aff78..7ada1b882 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java @@ -394,7 +394,7 @@ public class EditPeopleControlSet extends PopupControlSet { new JSONObject().put("default_picture", R.drawable.icn_friends) .put(CONTACT_CHOOSER_USER, true)); 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) 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 @Override