Go to contact card after editing
- In PeopleActivity, get rid of startActivityForResult to launch editor
because the editor will take care of launching the
contact card itself (instead of relying on the PeopleActivity
in the tablet to reload the contact details)
Bug: 4769324
Change-Id: Ibbaaccb03ac7961784dfa7b15c246b8d6f6489a4
diff --git a/src/com/android/contacts/activities/ContactDetailActivity.java b/src/com/android/contacts/activities/ContactDetailActivity.java
index 2e49883..14378d9 100644
--- a/src/com/android/contacts/activities/ContactDetailActivity.java
+++ b/src/com/android/contacts/activities/ContactDetailActivity.java
@@ -298,6 +298,7 @@
@Override
public void onEditRequested(Uri contactLookupUri) {
startActivity(new Intent(Intent.ACTION_EDIT, contactLookupUri));
+ finish();
}
@Override
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index 6655c81..28bc3a3 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -148,9 +148,11 @@
}
@Override
- public void onSaveFinished(int resultCode, Intent resultIntent, boolean navigateHome) {
- setResult(resultCode, resultIntent);
- if (navigateHome) {
+ public void onSaveFinished(Intent resultIntent) {
+ if (resultIntent != null) {
+ startActivity(resultIntent);
+ } else {
+ // Navigate home
Intent intent = new Intent(ContactEditorActivity.this, PeopleActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
@@ -165,7 +167,6 @@
@Override
public void onContactNotFound() {
- setResult(Activity.RESULT_CANCELED, null);
finish();
}
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index ae61813..0b403cb 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -106,12 +106,10 @@
private static final String TAG = "PeopleActivity";
private static final Boolean DEBUG = false; // DO NOT SUBMIT WITH TRUE
- private static final int SUBACTIVITY_NEW_CONTACT = 2;
- private static final int SUBACTIVITY_EDIT_CONTACT = 3;
- private static final int SUBACTIVITY_NEW_GROUP = 4;
- private static final int SUBACTIVITY_EDIT_GROUP = 5;
- private static final int SUBACTIVITY_ACCOUNT_FILTER = 6;
- private static final int SUBACTIVITY_CUSTOMIZE_FILTER = 7;
+ private static final int SUBACTIVITY_NEW_GROUP = 2;
+ private static final int SUBACTIVITY_EDIT_GROUP = 3;
+ private static final int SUBACTIVITY_ACCOUNT_FILTER = 4;
+ private static final int SUBACTIVITY_CUSTOMIZE_FILTER = 5;
private static final String KEY_SEARCH_MODE = "searchMode";
@@ -926,7 +924,7 @@
if (extras != null) {
intent.putExtras(extras);
}
- startActivityForResult(intent, SUBACTIVITY_EDIT_CONTACT);
+ startActivity(intent);
}
@Override
@@ -1012,8 +1010,7 @@
@Override
public void onEditRequested(Uri contactLookupUri) {
- startActivityForResult(
- new Intent(Intent.ACTION_EDIT, contactLookupUri), SUBACTIVITY_EDIT_CONTACT);
+ startActivity(new Intent(Intent.ACTION_EDIT, contactLookupUri));
}
@Override
@@ -1297,7 +1294,7 @@
}
case R.id.menu_add_contact: {
final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
- startActivityForResult(intent, SUBACTIVITY_NEW_CONTACT);
+ startActivity(intent);
return true;
}
case R.id.menu_add_group: {
@@ -1387,14 +1384,6 @@
}
break;
}
- case SUBACTIVITY_EDIT_CONTACT:
- case SUBACTIVITY_NEW_CONTACT: {
- if (resultCode == RESULT_OK && PhoneCapabilityTester.isUsingTwoPanes(this)) {
- mRequest.setActionCode(ContactsRequest.ACTION_VIEW_CONTACT);
- mAllFragment.reloadDataAndSetSelectedUri(data.getData());
- }
- break;
- }
case SUBACTIVITY_NEW_GROUP:
case SUBACTIVITY_EDIT_GROUP: {
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 9b89f84..6afe8b9 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -970,7 +970,6 @@
case SaveMode.CLOSE:
case SaveMode.HOME:
final Intent resultIntent;
- final int resultCode;
if (success && contactLookupUri != null) {
final String requestAuthority =
mLookupUri == null ? null : mLookupUri.getAuthority();
@@ -978,6 +977,7 @@
final String legacyAuthority = "contacts";
resultIntent = new Intent();
+ resultIntent.setAction(Intent.ACTION_VIEW);
if (legacyAuthority.equals(requestAuthority)) {
// Build legacy Uri when requested by caller
final long contactId = ContentUris.parseId(Contacts.lookupContact(
@@ -991,15 +991,12 @@
resultIntent.setData(contactLookupUri);
}
- resultCode = Activity.RESULT_OK;
} else {
- resultCode = Activity.RESULT_CANCELED;
resultIntent = null;
}
// It is already saved, so prevent that it is saved again
mStatus = Status.CLOSING;
- if (mListener != null) mListener.onSaveFinished(resultCode, resultIntent,
- saveMode == SaveMode.HOME);
+ if (mListener != null) mListener.onSaveFinished(resultIntent);
break;
case SaveMode.RELOAD:
@@ -1101,7 +1098,7 @@
/**
* Contact was saved and the Fragment can now be closed safely.
*/
- void onSaveFinished(int resultCode, Intent resultIntent, boolean navigateHome);
+ void onSaveFinished(Intent resultIntent);
/**
* User decided to delete the contact.