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

Commit f8f6f951 authored by John Shao's avatar John Shao
Browse files

Editor Insert or Edit intent helper

Add helper to start the insert or edit flow
from other places in the app.

Test: manual

Bug: 32081723
Change-Id: I3d8c2c4d4c6d25f3beae045941c10f6ba2b5f411
parent bb7cfa31
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.text.TextUtils;

import com.android.contacts.activities.ContactEditorActivity;
import com.android.contacts.activities.ContactEditorSpringBoardActivity;
import com.android.contacts.activities.ContactSelectionActivity;
import com.android.contacts.common.model.RawContactDeltaList;
import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;

@@ -75,9 +76,7 @@ public class EditorIntents {
                context, ContactEditorActivity.class);
        intent.putExtra(
                ContactEditorFragment.INTENT_EXTRA_NEW_LOCAL_PROFILE, isNewLocalProfile);
        if (rawContactDeltaList != null || displayName != null || phoneticName != null) {
        putRawContactDeltaValues(intent, rawContactDeltaList, displayName, phoneticName);
        }
        return intent;
    }

@@ -100,6 +99,18 @@ public class EditorIntents {
        return intent;
    }

    /**
     * Returns an Intent to start the {@link ContactSelectionActivity} for a
     * new or existing contact.
     */
    public static Intent createInsertOrEditContactIntent(Context context,
            RawContactDeltaList rawContactDeltaList, String displayName, String phoneticName) {
        final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Contacts.CONTENT_URI,
                context, ContactSelectionActivity.class);
        putRawContactDeltaValues(intent, rawContactDeltaList, displayName, phoneticName);
        return intent;
    }

    private static void putMaterialPalette(Intent intent, MaterialPalette materialPalette) {
        if (materialPalette != null) {
            intent.putExtra(