Contacts: Device Contacts: Simplify phone type
* Current list has Car, Telex, ISDN, etc...
* Copy from GoogleAccountType, which reduces the list heavily to
something sane
Change-Id: I0958ab8065e14c29716220afd86dcff3cd94e8f1
diff --git a/src/com/android/contacts/model/account/FallbackAccountType.java b/src/com/android/contacts/model/account/FallbackAccountType.java
index d7ea37a..59a16a7 100644
--- a/src/com/android/contacts/model/account/FallbackAccountType.java
+++ b/src/com/android/contacts/model/account/FallbackAccountType.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
@@ -27,6 +28,8 @@
import com.android.contacts.model.dataitem.DataKind;
import com.android.contactsbind.FeedbackHelper;
+import com.google.common.collect.Lists;
+
public class FallbackAccountType extends BaseAccountType {
private static final String TAG = "FallbackAccountType";
@@ -107,4 +110,27 @@
new AccountDisplayInfo(account, account.name,
getDisplayLabel(context), getDisplayIcon(context), false), this);
}
+
+ @Override
+ protected DataKind addDataKindPhone(Context context) throws DefinitionException {
+ final DataKind kind = super.addDataKindPhone(context);
+
+ kind.typeColumn = Phone.TYPE;
+ kind.typeList = Lists.newArrayList();
+ kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_WORK));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_MAIN));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER));
+ kind.typeList.add(buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true)
+ .setCustomColumn(Phone.LABEL));
+
+ kind.fieldList = Lists.newArrayList();
+ kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
+
+ return kind;
+ }
}