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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations