use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.
the class BaseAccountType method parseEditSchema.
/**
* Parses the content of the EditSchema tag in contacts.xml.
*/
protected final void parseEditSchema(Context context, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException, DefinitionException {
final int outerDepth = parser.getDepth();
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
final int depth = parser.getDepth();
if (type != XmlPullParser.START_TAG || depth != outerDepth + 1) {
// Not direct child tag
continue;
}
final String tag = parser.getName();
if (Tag.DATA_KIND.equals(tag)) {
for (DataKind kind : KindParser.INSTANCE.parseDataKindTag(context, parser, attrs)) {
addKind(kind);
}
} else {
LogUtil.i("BaseAccountType.parseEditSchema", "Skipping unknown tag " + tag);
}
}
}
use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.
the class BaseAccountType method addDataKindIm.
protected DataKind addDataKindIm(Context context) throws DefinitionException {
DataKind kind = addKind(new DataKind(Im.CONTENT_ITEM_TYPE, R.string.imLabelsGroup, Weight.IM, true));
kind.actionHeader = new ImActionInflater();
kind.actionBody = new SimpleInflater(Im.DATA);
// NOTE: even though a traditional "type" exists, for editing
// purposes we're using the protocol to pick labels
kind.defaultValues = new ContentValues();
kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);
kind.typeColumn = Im.PROTOCOL;
kind.typeList = new ArrayList<>();
kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
kind.typeList.add(buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(Im.CUSTOM_PROTOCOL));
kind.fieldList = new ArrayList<>();
kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
return kind;
}
use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.
the class BaseAccountType method addDataKindOrganization.
protected DataKind addDataKindOrganization(Context context) throws DefinitionException {
DataKind kind = addKind(new DataKind(Organization.CONTENT_ITEM_TYPE, R.string.organizationLabelsGroup, Weight.ORGANIZATION, true));
kind.actionHeader = new SimpleInflater(R.string.organizationLabelsGroup);
kind.actionBody = ORGANIZATION_BODY_INFLATER;
kind.typeOverallMax = 1;
kind.fieldList = new ArrayList<>();
kind.fieldList.add(new EditField(Organization.COMPANY, R.string.ghostData_company, FLAGS_GENERIC_NAME));
kind.fieldList.add(new EditField(Organization.TITLE, R.string.ghostData_title, FLAGS_GENERIC_NAME));
return kind;
}
use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.
the class ExchangeAccountType method addDataKindNickname.
@Override
protected DataKind addDataKindNickname(Context context) throws DefinitionException {
final DataKind kind = super.addDataKindNickname(context);
kind.typeOverallMax = 1;
kind.fieldList = new ArrayList<>();
kind.fieldList.add(new EditField(Nickname.NAME, R.string.nicknameLabelsGroup, FLAGS_PERSON_NAME));
return kind;
}
use of com.android.contacts.common.model.dataitem.DataKind in project android_packages_apps_Dialer by LineageOS.
the class ExchangeAccountType method addDataKindStructuredPostal.
@Override
protected DataKind addDataKindStructuredPostal(Context context) throws DefinitionException {
final DataKind kind = super.addDataKindStructuredPostal(context);
final boolean useJapaneseOrder = Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
kind.typeColumn = StructuredPostal.TYPE;
kind.typeList = new ArrayList<>();
kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK).setSpecificMax(1));
kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME).setSpecificMax(1));
kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER).setSpecificMax(1));
kind.fieldList = new ArrayList<>();
if (useJapaneseOrder) {
kind.fieldList.add(new EditField(StructuredPostal.COUNTRY, R.string.postal_country, FLAGS_POSTAL).setOptional(true));
kind.fieldList.add(new EditField(StructuredPostal.POSTCODE, R.string.postal_postcode, FLAGS_POSTAL));
kind.fieldList.add(new EditField(StructuredPostal.REGION, R.string.postal_region, FLAGS_POSTAL));
kind.fieldList.add(new EditField(StructuredPostal.CITY, R.string.postal_city, FLAGS_POSTAL));
kind.fieldList.add(new EditField(StructuredPostal.STREET, R.string.postal_street, FLAGS_POSTAL));
} else {
kind.fieldList.add(new EditField(StructuredPostal.STREET, R.string.postal_street, FLAGS_POSTAL));
kind.fieldList.add(new EditField(StructuredPostal.CITY, R.string.postal_city, FLAGS_POSTAL));
kind.fieldList.add(new EditField(StructuredPostal.REGION, R.string.postal_region, FLAGS_POSTAL));
kind.fieldList.add(new EditField(StructuredPostal.POSTCODE, R.string.postal_postcode, FLAGS_POSTAL));
kind.fieldList.add(new EditField(StructuredPostal.COUNTRY, R.string.postal_country, FLAGS_POSTAL).setOptional(true));
}
return kind;
}
Aggregations