Search in sources :

Example 1 with DataKind

use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.

the class AccountTypeManagerImpl method getKindOrFallback.

/**
 * Find the best {@link DataKind} matching the requested {@link AccountType#accountType}, {@link
 * AccountType#dataSet}, and {@link DataKind#mimeType}. If no direct match found, we try searching
 * {@link FallbackAccountType}.
 */
@Override
public DataKind getKindOrFallback(AccountType type, String mimeType) {
    ensureAccountsLoaded();
    DataKind kind = null;
    // Try finding account type and kind matching request
    if (type != null) {
        kind = type.getKindForMimetype(mimeType);
    }
    if (kind == null) {
        // Nothing found, so try fallback as last resort
        kind = mFallbackAccountType.getKindForMimetype(mimeType);
    }
    if (kind == null) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Unknown type=" + type + ", mime=" + mimeType);
        }
    }
    return kind;
}
Also used : DataKind(com.android.contacts.common.model.dataitem.DataKind)

Example 2 with DataKind

use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.

the class BaseAccountType method addDataKindDisplayName.

protected DataKind addDataKindDisplayName(Context context) throws DefinitionException {
    DataKind kind = addKind(new DataKind(DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME, R.string.nameLabelsGroup, Weight.NONE, true));
    kind.actionHeader = new SimpleInflater(R.string.nameLabelsGroup);
    kind.actionBody = new SimpleInflater(Nickname.NAME);
    kind.typeOverallMax = 1;
    kind.fieldList = new ArrayList<>();
    kind.fieldList.add(new EditField(StructuredName.DISPLAY_NAME, R.string.full_name, FLAGS_PERSON_NAME).setShortForm(true));
    boolean displayOrderPrimary = context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
    if (!displayOrderPrimary) {
        kind.fieldList.add(new EditField(StructuredName.PREFIX, R.string.name_prefix, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME, R.string.name_family, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME, R.string.name_given, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.SUFFIX, R.string.name_suffix, FLAGS_PERSON_NAME).setLongForm(true));
    } else {
        kind.fieldList.add(new EditField(StructuredName.PREFIX, R.string.name_prefix, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.GIVEN_NAME, R.string.name_given, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.FAMILY_NAME, R.string.name_family, FLAGS_PERSON_NAME).setLongForm(true));
        kind.fieldList.add(new EditField(StructuredName.SUFFIX, R.string.name_suffix, FLAGS_PERSON_NAME).setLongForm(true));
    }
    return kind;
}
Also used : DataKind(com.android.contacts.common.model.dataitem.DataKind)

Example 3 with DataKind

use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.

the class BaseAccountType method addDataKindStructuredPostal.

protected DataKind addDataKindStructuredPostal(Context context) throws DefinitionException {
    DataKind kind = addKind(new DataKind(StructuredPostal.CONTENT_ITEM_TYPE, R.string.postalLabelsGroup, Weight.STRUCTURED_POSTAL, true));
    kind.actionHeader = new PostalActionInflater();
    kind.actionBody = new SimpleInflater(StructuredPostal.FORMATTED_ADDRESS);
    kind.typeColumn = StructuredPostal.TYPE;
    kind.typeList = new ArrayList<>();
    kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME));
    kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK));
    kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER));
    kind.typeList.add(buildPostalType(StructuredPostal.TYPE_CUSTOM).setSecondary(true).setCustomColumn(StructuredPostal.LABEL));
    kind.fieldList = new ArrayList<>();
    kind.fieldList.add(new EditField(StructuredPostal.FORMATTED_ADDRESS, R.string.postal_address, FLAGS_POSTAL));
    kind.maxLinesForDisplay = MAX_LINES_FOR_POSTAL_ADDRESS;
    return kind;
}
Also used : DataKind(com.android.contacts.common.model.dataitem.DataKind)

Example 4 with DataKind

use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.

the class BaseAccountType method addDataKindNote.

protected DataKind addDataKindNote(Context context) throws DefinitionException {
    DataKind kind = addKind(new DataKind(Note.CONTENT_ITEM_TYPE, R.string.label_notes, Weight.NOTE, true));
    kind.typeOverallMax = 1;
    kind.actionHeader = new SimpleInflater(R.string.label_notes);
    kind.actionBody = new SimpleInflater(Note.NOTE);
    kind.fieldList = new ArrayList<>();
    kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
    kind.maxLinesForDisplay = MAX_LINES_FOR_NOTE;
    return kind;
}
Also used : DataKind(com.android.contacts.common.model.dataitem.DataKind)

Example 5 with DataKind

use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.

the class BaseAccountType method addDataKindWebsite.

protected DataKind addDataKindWebsite(Context context) throws DefinitionException {
    DataKind kind = addKind(new DataKind(Website.CONTENT_ITEM_TYPE, R.string.websiteLabelsGroup, Weight.WEBSITE, true));
    kind.actionHeader = new SimpleInflater(R.string.websiteLabelsGroup);
    kind.actionBody = new SimpleInflater(Website.URL);
    kind.defaultValues = new ContentValues();
    kind.defaultValues.put(Website.TYPE, Website.TYPE_OTHER);
    kind.fieldList = new ArrayList<>();
    kind.fieldList.add(new EditField(Website.URL, R.string.websiteLabelsGroup, FLAGS_WEBSITE));
    return kind;
}
Also used : ContentValues(android.content.ContentValues) DataKind(com.android.contacts.common.model.dataitem.DataKind)

Aggregations

DataKind (com.android.contacts.common.model.dataitem.DataKind)50 ContentValues (android.content.ContentValues)8 ValuesDelta (com.android.contacts.common.model.ValuesDelta)5 RawContactDelta (com.android.contacts.common.model.RawContactDelta)3 AccountType (com.android.contacts.common.model.account.AccountType)3 Calendar (java.util.Calendar)3 Intent (android.content.Intent)2 Resources (android.content.res.Resources)2 Drawable (android.graphics.drawable.Drawable)2 SpannableString (android.text.SpannableString)2 EmailDataItem (com.android.contacts.common.model.dataitem.EmailDataItem)2 EventDataItem (com.android.contacts.common.model.dataitem.EventDataItem)2 GroupMembershipDataItem (com.android.contacts.common.model.dataitem.GroupMembershipDataItem)2 ImDataItem (com.android.contacts.common.model.dataitem.ImDataItem)2 NicknameDataItem (com.android.contacts.common.model.dataitem.NicknameDataItem)2 NoteDataItem (com.android.contacts.common.model.dataitem.NoteDataItem)2 OrganizationDataItem (com.android.contacts.common.model.dataitem.OrganizationDataItem)2 PhoneDataItem (com.android.contacts.common.model.dataitem.PhoneDataItem)2 RelationDataItem (com.android.contacts.common.model.dataitem.RelationDataItem)2 SipAddressDataItem (com.android.contacts.common.model.dataitem.SipAddressDataItem)2