Search in sources :

Example 1 with RawContact

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

the class AggregationSuggestionView method handleItemClickEvent.

public boolean handleItemClickEvent() {
    if (mListener != null && isEnabled()) {
        if (canEditSuggestedContact()) {
            if (TextUtils.isEmpty(mLookupKey)) {
                return false;
            }
            mListener.onEditAction(Contacts.getLookupUri(mContactId, mLookupKey));
        } else {
            ArrayList<Long> rawContactIds = Lists.newArrayList();
            for (RawContact rawContact : mRawContacts) {
                rawContactIds.add(rawContact.rawContactId);
            }
            mListener.onJoinAction(mContactId, rawContactIds);
        }
        return true;
    }
    return false;
}
Also used : RawContact(com.android.contacts.editor.AggregationSuggestionEngine.RawContact)

Example 2 with RawContact

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

the class AggregationSuggestionView method canEditSuggestedContact.

/**
 * Returns true if the suggested contact can be edited.
 */
private boolean canEditSuggestedContact() {
    if (!mNewContact) {
        return false;
    }
    AccountTypeManager accountTypes = AccountTypeManager.getInstance(getContext());
    for (RawContact rawContact : mRawContacts) {
        String accountType = rawContact.accountType;
        String dataSet = rawContact.dataSet;
        if (accountType == null) {
            return true;
        }
        AccountType type = accountTypes.getAccountType(accountType, dataSet);
        if (type.areContactsWritable()) {
            return true;
        }
    }
    return false;
}
Also used : RawContact(com.android.contacts.editor.AggregationSuggestionEngine.RawContact) AccountTypeManager(com.android.contacts.common.model.AccountTypeManager) AccountType(com.android.contacts.common.model.account.AccountType)

Aggregations

RawContact (com.android.contacts.editor.AggregationSuggestionEngine.RawContact)2 AccountTypeManager (com.android.contacts.common.model.AccountTypeManager)1 AccountType (com.android.contacts.common.model.account.AccountType)1