Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 1607f6df authored by Michael W's avatar Michael W Committed by Michael Bestas
Browse files

Contacts: Device Contacts: Simplify Email

* Current: Home, Work, Other, Mobile, Custom
* New: Home, Work, Other, Custom
* Taken from GoogleAccountType

Change-Id: Ibba78781d45be29c37c64af8b93533af3c6c8924
parent a9efaa60
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.accounts.AuthenticatorDescription;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
@@ -133,4 +134,22 @@ public class FallbackAccountType extends BaseAccountType {

        return kind;
    }

    @Override
    protected DataKind addDataKindEmail(Context context) throws DefinitionException {
        final DataKind kind = super.addDataKindEmail(context);

        kind.typeColumn = Email.TYPE;
        kind.typeList = Lists.newArrayList();
        kind.typeList.add(buildEmailType(Email.TYPE_HOME));
        kind.typeList.add(buildEmailType(Email.TYPE_WORK));
        kind.typeList.add(buildEmailType(Email.TYPE_OTHER));
        kind.typeList.add(buildEmailType(Email.TYPE_CUSTOM).setSecondary(true).setCustomColumn(
                Email.LABEL));

        kind.fieldList = Lists.newArrayList();
        kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));

        return kind;
    }
}