Return to the compact contact editor on back from the fully expanded one
Bug 19624360
Change-Id: I249f1e456a2d85c5ecd831358692d56b09ee5a5b
diff --git a/src/com/android/contacts/activities/CompactContactEditorActivity.java b/src/com/android/contacts/activities/CompactContactEditorActivity.java
index 8755863..c1c6c40 100644
--- a/src/com/android/contacts/activities/CompactContactEditorActivity.java
+++ b/src/com/android/contacts/activities/CompactContactEditorActivity.java
@@ -42,4 +42,11 @@
final Uri uri = Intent.ACTION_EDIT.equals(action) ? getIntent().getData() : null;
mFragment.load(action, uri, getIntent().getExtras());
}
+
+ @Override
+ public void onBackPressed() {
+ if (mFragment != null) {
+ mFragment.save(ContactEditor.SaveMode.CLOSE);
+ }
+ }
}
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index 16dd9a1..a0732aa 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -45,4 +45,11 @@
|| Intent.ACTION_EDIT.equals(action) ? getIntent().getData() : null;
mFragment.load(action, uri, getIntent().getExtras());
}
+
+ @Override
+ public void onBackPressed() {
+ if (mFragment != null) {
+ mFragment.save(ContactEditor.SaveMode.COMPACT);
+ }
+ }
}
diff --git a/src/com/android/contacts/activities/ContactEditorBaseActivity.java b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
index 0e46a81..3e05513 100644
--- a/src/com/android/contacts/activities/ContactEditorBaseActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
@@ -25,6 +25,7 @@
import com.android.contacts.common.util.ImplicitIntentsUtil;
import com.android.contacts.editor.ContactEditorBaseFragment;
import com.android.contacts.editor.ContactEditorFragment;
+import com.android.contacts.editor.EditorIntents;
import com.android.contacts.interactions.ContactDeletionInteraction;
import com.android.contacts.util.DialogManager;
@@ -95,9 +96,9 @@
public static final int JOIN = 3;
/**
- * Navigate to Contacts Home activity after saving.
+ * Navigate to the compact editor view after saving.
*/
- public static final int HOME = 4;
+ public static final int COMPACT = 4;
}
/**
@@ -258,13 +259,6 @@
return null;
}
- @Override
- public void onBackPressed() {
- if (mFragment != null) {
- mFragment.save(ContactEditor.SaveMode.CLOSE);
- }
- }
-
protected final ContactEditorBaseFragment.Listener mFragmentListener =
new ContactEditorBaseFragment.Listener() {
@@ -302,16 +296,8 @@
@Override
public void onEditOtherContactRequested(
Uri contactLookupUri, ArrayList<ContentValues> values) {
- Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
- intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
- intent.putExtra(ContactEditorFragment.INTENT_EXTRA_ADD_TO_DEFAULT_DIRECTORY, "");
-
- // Pass on all the data that has been entered so far
- if (values != null && values.size() != 0) {
- intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, values);
- }
-
+ final Intent intent = EditorIntents.createEditOtherContactIntent(
+ contactLookupUri, values);
ImplicitIntentsUtil.startActivityInApp(ContactEditorBaseActivity.this, intent);
finish();
}
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 4770909..64d7843 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -56,6 +56,7 @@
import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.dialog.ClearFrequentsDialog;
import com.android.contacts.common.util.ImplicitIntentsUtil;
+import com.android.contacts.editor.EditorIntents;
import com.android.contacts.interactions.ContactDeletionInteraction;
import com.android.contacts.common.interactions.ImportExportDialogFragment;
import com.android.contacts.common.list.ContactEntryListFragment;
@@ -959,7 +960,7 @@
@Override
public void onCreateNewContactAction() {
ImplicitIntentsUtil.startActivityInApp(PeopleActivity.this,
- new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI));
+ EditorIntents.createCompactInsertContactIntent());
}
@Override
diff --git a/src/com/android/contacts/editor/CompactContactEditorFragment.java b/src/com/android/contacts/editor/CompactContactEditorFragment.java
index 8af3d13..108cab6 100644
--- a/src/com/android/contacts/editor/CompactContactEditorFragment.java
+++ b/src/com/android/contacts/editor/CompactContactEditorFragment.java
@@ -31,14 +31,11 @@
import com.android.contacts.util.ContactPhotoUtils;
import android.app.Activity;
-import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
-import android.provider.ContactsContract;
-import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -48,7 +45,6 @@
import android.widget.LinearLayout;
import java.io.FileNotFoundException;
-import java.util.ArrayList;
/**
* Contact editor with only the most important fields displayed initially.
@@ -185,6 +181,16 @@
}
@Override
+ public void onStop() {
+ super.onStop();
+
+ // If anything was left unsaved, save it now
+ if (!getActivity().isChangingConfigurations() && mStatus == Status.EDITING) {
+ save(SaveMode.RELOAD);
+ }
+ }
+
+ @Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.findItem(R.id.menu_change_photo).setVisible(true);
@@ -339,38 +345,11 @@
@Override
public void onExpandEditor() {
// Determine if this is an insert (new contact) or edit
- final String action = getActivity().getIntent().getAction();
- final boolean isInsert = Intent.ACTION_INSERT.equals(action)
- || ContactEditorBaseActivity.ACTION_INSERT.equals(action);
-
- // Prepare an Intent to start the expanded editor
- final Intent intent = isInsert
- ? new Intent(ContactEditorBaseActivity.ACTION_INSERT,
- ContactsContract.Contacts.CONTENT_URI)
- : new Intent(ContactEditorBaseActivity.ACTION_EDIT, mLookupUri);
- intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ final boolean isInsert = isInsert(getActivity().getIntent());
if (isInsert) {
// For inserts, prevent any changes from being saved when the base fragment is destroyed
mStatus = Status.CLOSING;
-
- // Pass on all the data that has been entered so far
- ArrayList<ContentValues> contentValues = mState.get(0).getContentValues();
- if (contentValues != null && contentValues.size() != 0) {
- intent.putParcelableArrayListExtra(
- ContactsContract.Intents.Insert.DATA, contentValues);
- }
- // Name must be passed separately since it is skipped in RawContactModifier.parseValues
- final StructuredNameEditorView structuredNameEditorView =
- getContent().getStructuredNameEditorView();
- if (structuredNameEditorView != null) {
- final String displayName = structuredNameEditorView.getDisplayName();
- if (!TextUtils.isEmpty(displayName)) {
- intent.putExtra(ContactsContract.Intents.Insert.NAME, displayName);
- }
- }
- getActivity().finish();
} else {
// Prevent a Toast from being displayed as we transition to the full editor
mShowToastAfterSave = false;
@@ -379,7 +358,16 @@
save(SaveMode.RELOAD);
}
+ // Prepare an Intent to start the expanded editor
+ final Intent intent = isInsert
+ ? EditorIntents.createInsertContactIntent(mState, getDisplayName())
+ : EditorIntents.createEditContactIntent(mLookupUri);
ImplicitIntentsUtil.startActivityInApp(getActivity(), intent);
+
+ final Activity activity = getActivity();
+ if (activity != null) {
+ activity.finish();
+ }
}
@Override
@@ -393,6 +381,19 @@
}
}
+ @Override
+ public MaterialColorMapUtils.MaterialPalette getMaterialPalette() {
+ return mMaterialPalette;
+ }
+
+ @Override
+ public String getDisplayName() {
+ final StructuredNameEditorView structuredNameEditorView =
+ getContent().getStructuredNameEditorView();
+ return structuredNameEditorView == null
+ ? null : structuredNameEditorView.getDisplayName();
+ }
+
private CompactRawContactsEditorView getContent() {
return (CompactRawContactsEditorView) mContent;
}
diff --git a/src/com/android/contacts/editor/ContactEditorBaseFragment.java b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
index 09408ec..584ef6f 100644
--- a/src/com/android/contacts/editor/ContactEditorBaseFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
@@ -36,6 +36,7 @@
import com.android.contacts.common.model.account.AccountType;
import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.common.util.ImplicitIntentsUtil;
+import com.android.contacts.common.util.MaterialColorMapUtils;
import com.android.contacts.editor.AggregationSuggestionEngine.Suggestion;
import com.android.contacts.list.UiIntentActions;
import com.android.contacts.quickcontact.QuickContactActivity;
@@ -588,11 +589,6 @@
super.onStop();
UiClosables.closeQuietly(mAggregationSuggestionPopup);
-
- // If anything was left unsaved, save it now but keep the editor open.
- if (!getActivity().isChangingConfigurations() && mStatus == Status.EDITING) {
- save(SaveMode.RELOAD);
- }
}
@Override
@@ -863,7 +859,8 @@
}
// If we are about to close the editor - there is no need to refresh the data
- if (saveMode == SaveMode.CLOSE || saveMode == SaveMode.SPLIT) {
+ if (saveMode == SaveMode.CLOSE || saveMode == SaveMode.COMPACT
+ || saveMode == SaveMode.SPLIT) {
getLoaderManager().destroyLoader(LOADER_DATA);
}
@@ -885,6 +882,16 @@
// Store account as default account, only if this is a new contact
saveDefaultAccountIfNecessary();
+ if (isInsert(getActivity().getIntent())
+ && saveMode == SaveMode.COMPACT && mListener != null) {
+ // If we're coming back from the fully expanded editor and this is an insert, just
+ // pass any values entered by the user back to the compact editor without doing a save
+ final Intent resultIntent = EditorIntents.createCompactInsertContactIntent(
+ getMaterialPalette(), mState, getDisplayName());
+ mListener.onSaveFinished(resultIntent);
+ return true;
+ }
+ // Otherwise this is an edit or a back press on the compact editor so do an actual save
return doSaveAction(saveMode);
}
@@ -925,6 +932,16 @@
return mEnabled;
}
+ /**
+ * Returns the palette extra that was passed in.
+ */
+ abstract protected MaterialColorMapUtils.MaterialPalette getMaterialPalette();
+
+ /**
+ * Returns the currently displayed displayName;
+ */
+ abstract protected String getDisplayName();
+
//
// Account creation
//
@@ -1077,6 +1094,10 @@
RawContactDelta oldState, AccountType oldAccountType) {
mStatus = Status.EDITING;
mState.add(createNewRawContactDelta(account, accountType, oldState, oldAccountType));
+ // We bind field values that may be present on inserts (as well as edits) since
+ // the caller may want certain fields pre-populated or we may be returning to
+ // the compact editor from the fully expanded one.
+ setIntentExtras(mIntentExtras);
mRequestFocus = true;
mNewContactDataReady = true;
bindEditors();
@@ -1278,13 +1299,25 @@
}
switch (saveMode) {
case SaveMode.CLOSE:
- case SaveMode.HOME:
+ case SaveMode.COMPACT:
final Intent resultIntent;
if (saveSucceeded && contactLookupUri != null) {
final Uri lookupUri = maybeConvertToLegacyLookupUri(
mContext, contactLookupUri, mLookupUri);
- resultIntent = ImplicitIntentsUtil.composeQuickContactIntent(lookupUri,
- QuickContactActivity.MODE_FULLY_EXPANDED);
+ if (saveMode == SaveMode.CLOSE) {
+ resultIntent = ImplicitIntentsUtil.composeQuickContactIntent(lookupUri,
+ QuickContactActivity.MODE_FULLY_EXPANDED);
+ } else if (saveMode == SaveMode.COMPACT) {
+ if (isInsert(getActivity().getIntent())) {
+ resultIntent = EditorIntents.createCompactInsertContactIntent(
+ getMaterialPalette(), mState, getDisplayName());
+ } else {
+ resultIntent = EditorIntents.createCompactEditContactIntent(
+ lookupUri, getMaterialPalette());
+ }
+ } else {
+ resultIntent = null;
+ }
} else {
resultIntent = null;
}
@@ -1538,4 +1571,14 @@
// Otherwise pass back a lookup-style Uri
return contactLookupUri;
}
+
+ /**
+ * Whether the argument Intent requested a contact insert action or not.
+ */
+ protected static boolean isInsert(Intent intent) {
+ if (intent == null) return false;
+ final String action = intent.getAction();
+ return Intent.ACTION_INSERT.equals(action)
+ || ContactEditorBaseActivity.ACTION_INSERT.equals(action);
+ }
}
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 9e5148d..89b4bf8 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -28,6 +28,7 @@
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -45,6 +46,7 @@
import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.common.util.AccountsListAdapter;
import com.android.contacts.common.util.AccountsListAdapter.AccountListFilter;
+import com.android.contacts.common.util.MaterialColorMapUtils;
import com.android.contacts.detail.PhotoSelectionHandler;
import com.android.contacts.editor.Editor.EditorListener;
import com.android.contacts.util.ContactPhotoUtils;
@@ -117,11 +119,30 @@
}
@Override
+ public void onStop() {
+ super.onStop();
+
+ // If anything was left unsaved, save it now and return to the compact editor.
+ if (!getActivity().isChangingConfigurations() && mStatus == Status.EDITING) {
+ save(SaveMode.COMPACT);
+ }
+ }
+
+ @Override
public void onExternalEditorRequest(AccountWithDataSet account, Uri uri) {
mListener.onCustomEditContactActivityRequested(account, uri, null, false);
}
@Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Override the home/done options to return to the compact editor
+ if (item.getItemId() == android.R.id.home || item.getItemId() == R.id.menu_done) {
+ return save(SaveMode.COMPACT);
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
public void onEditorExpansionChanged() {
updatedExpandedEditorsMap();
}
@@ -355,6 +376,53 @@
}
}
+ @Override
+ public String getDisplayName() {
+ // Return the super primary name if it is non-empty
+ for (int i = 0; i < mContent.getChildCount(); i++) {
+ final View view = mContent.getChildAt(i);
+ if (view instanceof RawContactEditorView) {
+ final RawContactEditorView rawContactEditorView = (RawContactEditorView) view;
+ final StructuredNameEditorView nameEditorView =
+ rawContactEditorView.getNameEditor();
+ if (nameEditorView != null) {
+ final ValuesDelta valuesDelta = nameEditorView.getValues();
+ if (valuesDelta != null && valuesDelta.isSuperPrimary()) {
+ final String displayName = valuesDelta.getDisplayName();
+ if (!TextUtils.isEmpty(displayName)) {
+ return displayName;
+ }
+ }
+ }
+ }
+ }
+ // Return the first non-empty name
+ for (int i = 0; i < mContent.getChildCount(); i++) {
+ final View view = mContent.getChildAt(i);
+ if (view instanceof RawContactEditorView) {
+ final RawContactEditorView rawContactEditorView = (RawContactEditorView) view;
+ final StructuredNameEditorView nameEditorView =
+ rawContactEditorView.getNameEditor();
+ if (nameEditorView != null) {
+ final ValuesDelta valuesDelta = nameEditorView.getValues();
+ if (valuesDelta != null) {
+ final String displayName = valuesDelta.getDisplayName();
+ if (!TextUtils.isEmpty(displayName)) {
+ return displayName;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public MaterialColorMapUtils.MaterialPalette getMaterialPalette() {
+ // There is no color for default photos on the fully expanded editor
+ return null;
+ }
+
/**
* Adjust how dark the hint text should be on all the names' text fields.
*
diff --git a/src/com/android/contacts/editor/EditorIntents.java b/src/com/android/contacts/editor/EditorIntents.java
new file mode 100644
index 0000000..121b8c8
--- /dev/null
+++ b/src/com/android/contacts/editor/EditorIntents.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.contacts.editor;
+
+import com.android.contacts.activities.CompactContactEditorActivity;
+import com.android.contacts.activities.ContactEditorActivity;
+import com.android.contacts.activities.ContactEditorBaseActivity;
+import com.android.contacts.common.model.RawContactDeltaList;
+import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;
+
+import android.content.ContentValues;
+import android.content.Intent;
+import android.net.Uri;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
+import android.text.TextUtils;
+
+import java.util.ArrayList;
+
+/**
+ * Creates Intents to edit contacts.
+ */
+public class EditorIntents {
+
+ private EditorIntents() {
+ }
+
+ /**
+ * Returns an Intent to start the {@link CompactContactEditorActivity} for an
+ * existing contact.
+ */
+ public static Intent createCompactEditContactIntent(Uri contactLookupUri,
+ MaterialPalette materialPalette) {
+ final Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+ if (materialPalette != null) {
+ intent.putExtra(ContactEditorBaseActivity.INTENT_KEY_MATERIAL_PALETTE,
+ materialPalette);
+ }
+ return intent;
+ }
+
+ /**
+ * Returns an Intent to start the {@link CompactContactEditorActivity} for a new contact.
+ */
+ public static Intent createCompactInsertContactIntent() {
+ return createCompactInsertContactIntent(/* materialPalette =*/ null,
+ /* rawContactDeltaList =*/ null, /* displayName =*/ null);
+ }
+
+ /**
+ * Returns an Intent to start the {@link CompactContactEditorActivity} for a new contact with
+ * the field values specified by rawContactDeltaList pre-populate in the form.
+ */
+ public static Intent createCompactInsertContactIntent(MaterialPalette materialPalette,
+ RawContactDeltaList rawContactDeltaList, String displayName) {
+ final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+ if (materialPalette != null) {
+ intent.putExtra(ContactEditorBaseActivity.INTENT_KEY_MATERIAL_PALETTE,
+ materialPalette);
+ }
+ if (rawContactDeltaList != null || displayName != null) {
+ putRawContactDeltaValues(intent, rawContactDeltaList, displayName);
+ }
+ return intent;
+ }
+
+ /**
+ * Returns an Intent to edit a different contact (in the fully expaned editor) with whatever
+ * values were already entered on the currently displayed contact editor.
+ */
+ public static Intent createEditOtherContactIntent(Uri contactLookupUri,
+ ArrayList<ContentValues> contentValues) {
+ final Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+ intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+ | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ intent.putExtra(ContactEditorFragment.INTENT_EXTRA_ADD_TO_DEFAULT_DIRECTORY, "");
+
+ // Pass on all the data that has been entered so far
+ if (contentValues != null && contentValues.size() != 0) {
+ intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, contentValues);
+ }
+ return intent;
+ }
+
+ /**
+ * Returns an Intent to start the fully expanded {@link ContactEditorActivity} for a
+ * new contact.
+ */
+ public static Intent createEditContactIntent(Uri contactLookupUri) {
+ final Intent intent = new Intent(ContactEditorBaseActivity.ACTION_EDIT, contactLookupUri);
+ addContactIntentFlags(intent);
+ return intent;
+ }
+
+ /**
+ * Returns an Intent to start the fully expanded {@link ContactEditorActivity} for an
+ * existing contact.
+ */
+ public static Intent createInsertContactIntent(RawContactDeltaList rawContactDeltaList,
+ String displayName) {
+ final Intent intent = new Intent(ContactEditorBaseActivity.ACTION_INSERT,
+ ContactsContract.Contacts.CONTENT_URI);
+ addContactIntentFlags(intent);
+ putRawContactDeltaValues(intent, rawContactDeltaList, displayName);
+ return intent;
+ }
+
+
+ private static void addContactIntentFlags(Intent intent) {
+ intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+ | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+ }
+
+ private static void putRawContactDeltaValues(Intent intent,
+ RawContactDeltaList rawContactDeltaList, String displayName) {
+ // Pass on all the data that has been entered so far
+ ArrayList<ContentValues> contentValues = rawContactDeltaList.get(0).getContentValues();
+ if (contentValues != null && contentValues.size() != 0) {
+ intent.putParcelableArrayListExtra(
+ ContactsContract.Intents.Insert.DATA, contentValues);
+ }
+ // Name must be passed separately since it is skipped in RawContactModifier.parseValues
+ if (!TextUtils.isEmpty(displayName)) {
+ intent.putExtra(ContactsContract.Intents.Insert.NAME, displayName);
+ }
+ }
+}
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index da954c9..3584fa8 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -92,7 +92,6 @@
import com.android.contacts.ContactsActivity;
import com.android.contacts.NfcHandler;
import com.android.contacts.R;
-import com.android.contacts.activities.ContactEditorBaseActivity;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.ClipboardUtils;
import com.android.contacts.common.Collapser;
@@ -129,6 +128,7 @@
import com.android.contacts.common.util.ViewUtil;
import com.android.contacts.detail.ContactDisplayUtils;
import com.android.contacts.editor.ContactEditorFragment;
+import com.android.contacts.editor.EditorIntents;
import com.android.contacts.interactions.CalendarInteractionsLoader;
import com.android.contacts.interactions.CallLogInteractionsLoader;
import com.android.contacts.interactions.ContactDeletionInteraction;
@@ -2176,14 +2176,9 @@
}
private Intent getEditContactIntent() {
- final Intent intent = new Intent(Intent.ACTION_EDIT, mContactData.getLookupUri());
- intent.setPackage(this.getPackageName());
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
- if (mHasComputedThemeColor) {
- intent.putExtra(ContactEditorBaseActivity.INTENT_KEY_MATERIAL_PALETTE,
- new MaterialPalette(mColorFilterColor, mStatusBarColor));
- }
- return intent;
+ return EditorIntents.createCompactEditContactIntent(
+ mContactData.getLookupUri(), mHasComputedThemeColor
+ ? new MaterialPalette(mColorFilterColor, mStatusBarColor) : null);
}
private void editContact() {