Search in sources :

Example 1 with ContactEditorUtils

use of com.android.contacts.editor.ContactEditorUtils in project packages_apps_Contacts by AOKP.

the class AttachPhotoActivity method selectAccountAndCreateContact.

private void selectAccountAndCreateContact() {
    // If there is no default account or the accounts have changed such that we need to
    // prompt the user again, then launch the account prompt.
    final ContactEditorUtils editorUtils = ContactEditorUtils.getInstance(this);
    if (editorUtils.shouldShowAccountChangedNotification()) {
        Intent intent = new Intent(this, ContactEditorAccountsChangedActivity.class);
        startActivityForResult(intent, REQUEST_PICK_DEFAULT_ACCOUNT_FOR_NEW_CONTACT);
    } else {
        // Otherwise, there should be a default account. Then either create a local contact
        // (if default account is null) or create a contact with the specified account.
        AccountWithDataSet defaultAccount = editorUtils.getDefaultAccount();
        createNewRawContact(defaultAccount);
    }
}
Also used : ContactEditorUtils(com.android.contacts.editor.ContactEditorUtils) AccountWithDataSet(com.android.contacts.common.model.account.AccountWithDataSet) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 AccountWithDataSet (com.android.contacts.common.model.account.AccountWithDataSet)1 ContactEditorUtils (com.android.contacts.editor.ContactEditorUtils)1