Loading src/com/android/contacts/activities/ContactEditorBaseActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -163,7 +163,7 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity * Invoked after the contact is saved. */ void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded, Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed); Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed, long photoId); /** * Invoked after the contact is joined. Loading Loading @@ -243,7 +243,8 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity intent.getData(), (Bundle) intent.getParcelableExtra(ContactSaveService.EXTRA_UPDATED_PHOTOS), intent.getBooleanExtra(ContactEditorFragment.INTENT_EXTRA_SAVE_BACK_PRESSED, false)); false), intent.getLongExtra(ContactEditorFragment.INTENT_EXTRA_PHOTO_ID, -1)); } else if (ACTION_JOIN_COMPLETED.equals(action)) { mFragment.onJoinCompleted(intent.getData()); } Loading src/com/android/contacts/activities/ContactSelectionActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.contacts.R; import com.android.contacts.common.activity.RequestPermissionsActivity; import com.android.contacts.common.list.ContactEntryListFragment; import com.android.contacts.common.util.ImplicitIntentsUtil; import com.android.contacts.editor.EditorIntents; import com.android.contacts.list.ContactPickerFragment; import com.android.contacts.list.ContactsIntentResolver; import com.android.contacts.list.ContactsRequest; Loading Loading @@ -425,7 +426,8 @@ public class ContactSelectionActivity extends ContactsActivity startActivityForResult(intent, SUBACTIVITY_ADD_TO_EXISTING_CONTACT); } else { // Otherwise launch the full contact editor. startActivityAndForwardResult(new Intent(Intent.ACTION_EDIT, contactLookupUri)); startActivityAndForwardResult(EditorIntents.createEditContactIntent( contactLookupUri, /* materialPalette =*/ null, /* photoId =*/ -1)); } } Loading src/com/android/contacts/editor/CompactContactEditorFragment.java +3 −2 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl // Add input fields for the loaded Contact final CompactRawContactsEditorView editorView = getContent(); editorView.setListener(this); editorView.setState(mState, getMaterialPalette(), mViewIdGenerator); editorView.setState(mState, getMaterialPalette(), mViewIdGenerator, mPhotoId); // Set up the photo widget mPhotoHandler = createPhotoHandler(); Loading Loading @@ -357,7 +357,8 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl final Intent intent = isInsert ? EditorIntents.createInsertContactIntent( mState, getDisplayName(), getPhoneticName(), mUpdatedPhotos) : EditorIntents.createEditContactIntent(mLookupUri, getMaterialPalette()); : EditorIntents.createEditContactIntent(mLookupUri, getMaterialPalette(), mPhotoId); ImplicitIntentsUtil.startActivityInApp(getActivity(), intent); getActivity().finish(); Loading src/com/android/contacts/editor/CompactRawContactsEditorView.java +24 −3 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O public void setState(RawContactDeltaList rawContactDeltas, MaterialColorMapUtils.MaterialPalette materialPalette, ViewIdGenerator viewIdGenerator) { ViewIdGenerator viewIdGenerator, long photoId) { mNames.removeAllViews(); mPhoneticNames.removeAllViews(); mNicknames.removeAllViews(); Loading @@ -281,7 +281,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O mMaterialPalette = materialPalette; vlog("Setting compact editor state from " + rawContactDeltas); addPhotoView(rawContactDeltas, viewIdGenerator); addPhotoView(rawContactDeltas, viewIdGenerator, photoId); addStructuredNameView(rawContactDeltas); addEditorViews(rawContactDeltas); removeExtraEmptyTextFields(mPhoneNumbers); Loading @@ -289,7 +289,8 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O } private void addPhotoView(RawContactDeltaList rawContactDeltas, ViewIdGenerator viewIdGenerator) { ViewIdGenerator viewIdGenerator, long photoId) { // Look for a match for the photo ID that was passed in for (RawContactDelta rawContactDelta : rawContactDeltas) { if (!rawContactDelta.isVisible()) continue; final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager); Loading @@ -300,6 +301,26 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O // Look for a non-empty super primary photo final DataKind dataKind = accountType.getKindForMimetype(Photo.CONTENT_ITEM_TYPE); if (dataKind != null) { for (ValuesDelta valuesDelta : rawContactDelta.getMimeEntries(Photo.CONTENT_ITEM_TYPE)) { if (valuesDelta != null && valuesDelta.getId() != null && valuesDelta.getId().equals(photoId)) { mPhotoRawContactId = rawContactDelta.getRawContactId(); mPhoto.setValues(dataKind, valuesDelta, rawContactDelta, /* readOnly =*/ !dataKind.editable, mMaterialPalette, viewIdGenerator); return; } } } } // Look for a non-empty super primary photo for (RawContactDelta rawContactDelta : rawContactDeltas) { if (!rawContactDelta.isVisible()) continue; final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager); final DataKind dataKind = accountType.getKindForMimetype(Photo.CONTENT_ITEM_TYPE); if (dataKind != null) { final ValuesDelta valuesDelta = getNonEmptySuperPrimaryValuesDeltas( rawContactDelta, Photo.CONTENT_ITEM_TYPE, dataKind); Loading src/com/android/contacts/editor/ContactEditorBaseFragment.java +14 −4 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements private static final String KEY_DISABLE_DELETE_MENU_OPTION = "disableDeleteMenuOption"; private static final String KEY_NEW_LOCAL_PROFILE = "newLocalProfile"; private static final String KEY_MATERIAL_PALETTE = "materialPalette"; private static final String KEY_PHOTO_ID = "photoId"; private static final String KEY_VIEW_ID_GENERATOR = "viewidgenerator"; Loading Loading @@ -172,6 +173,11 @@ abstract public class ContactEditorBaseFragment extends Fragment implements */ public static final String INTENT_EXTRA_UPDATED_PHOTOS = "updated_photos"; /** * Intent key to pass the ID of the photo to display on the editor. */ public static final String INTENT_EXTRA_PHOTO_ID = "photo_id"; /** * Intent extra to specify a {@link ContactEditor.SaveMode}. */ Loading Loading @@ -308,6 +314,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements protected boolean mDisableDeleteMenuOption; protected boolean mNewLocalProfile; protected MaterialColorMapUtils.MaterialPalette mMaterialPalette; protected long mPhotoId = -1; // // Helpers Loading Loading @@ -464,6 +471,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements mDisableDeleteMenuOption = savedState.getBoolean(KEY_DISABLE_DELETE_MENU_OPTION); mNewLocalProfile = savedState.getBoolean(KEY_NEW_LOCAL_PROFILE); mMaterialPalette = savedState.getParcelable(KEY_MATERIAL_PALETTE); mPhotoId = savedState.getLong(KEY_PHOTO_ID); mRawContacts = ImmutableList.copyOf(savedState.<RawContact>getParcelableArrayList( KEY_RAW_CONTACTS)); Loading Loading @@ -584,6 +592,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements if (mMaterialPalette != null) { outState.putParcelable(KEY_MATERIAL_PALETTE, mMaterialPalette); } outState.putLong(KEY_PHOTO_ID, mPhotoId); outState.putParcelable(KEY_VIEW_ID_GENERATOR, mViewIdGenerator); Loading Loading @@ -915,7 +924,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements } onSaveCompleted(/* hadChanges =*/ false, saveMode, /* saveSucceeded =*/ mLookupUri != null, mLookupUri, /* updatedPhotos =*/ null, backPressed); /* updatedPhotos =*/ null, backPressed, mPhotoId); return true; } Loading Loading @@ -1312,6 +1321,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements if (mIntentExtras.containsKey(INTENT_EXTRA_UPDATED_PHOTOS)) { mUpdatedPhotos = mIntentExtras.getParcelable(INTENT_EXTRA_UPDATED_PHOTOS); } mPhotoId = mIntentExtras.getLong(INTENT_EXTRA_PHOTO_ID); } } Loading @@ -1335,12 +1345,12 @@ abstract public class ContactEditorBaseFragment extends Fragment implements @Override public void onJoinCompleted(Uri uri) { onSaveCompleted(false, SaveMode.RELOAD, uri != null, uri, /* updatedPhotos =*/ null, /* backPressed =*/ false); /* backPressed =*/ false, /* photoId =*/ mPhotoId); } @Override public void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded, Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed) { Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed, long photoId) { if (hadChanges) { if (saveSucceeded) { if (saveMode != SaveMode.JOIN && mShowToastAfterSave) { Loading Loading @@ -1377,7 +1387,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements ? EditorIntents.createCompactInsertContactIntent( mState, getDisplayName(), getPhoneticName(), updatedPhotos) : EditorIntents.createCompactEditContactIntent( lookupUri, getMaterialPalette(), updatedPhotos); lookupUri, getMaterialPalette(), updatedPhotos, photoId); resultIntent.putExtra(INTENT_EXTRA_SAVE_BACK_PRESSED, true); mStatus = Status.CLOSING; if (mListener != null) mListener.onSaveFinished(resultIntent); Loading Loading
src/com/android/contacts/activities/ContactEditorBaseActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -163,7 +163,7 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity * Invoked after the contact is saved. */ void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded, Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed); Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed, long photoId); /** * Invoked after the contact is joined. Loading Loading @@ -243,7 +243,8 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity intent.getData(), (Bundle) intent.getParcelableExtra(ContactSaveService.EXTRA_UPDATED_PHOTOS), intent.getBooleanExtra(ContactEditorFragment.INTENT_EXTRA_SAVE_BACK_PRESSED, false)); false), intent.getLongExtra(ContactEditorFragment.INTENT_EXTRA_PHOTO_ID, -1)); } else if (ACTION_JOIN_COMPLETED.equals(action)) { mFragment.onJoinCompleted(intent.getData()); } Loading
src/com/android/contacts/activities/ContactSelectionActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.contacts.R; import com.android.contacts.common.activity.RequestPermissionsActivity; import com.android.contacts.common.list.ContactEntryListFragment; import com.android.contacts.common.util.ImplicitIntentsUtil; import com.android.contacts.editor.EditorIntents; import com.android.contacts.list.ContactPickerFragment; import com.android.contacts.list.ContactsIntentResolver; import com.android.contacts.list.ContactsRequest; Loading Loading @@ -425,7 +426,8 @@ public class ContactSelectionActivity extends ContactsActivity startActivityForResult(intent, SUBACTIVITY_ADD_TO_EXISTING_CONTACT); } else { // Otherwise launch the full contact editor. startActivityAndForwardResult(new Intent(Intent.ACTION_EDIT, contactLookupUri)); startActivityAndForwardResult(EditorIntents.createEditContactIntent( contactLookupUri, /* materialPalette =*/ null, /* photoId =*/ -1)); } } Loading
src/com/android/contacts/editor/CompactContactEditorFragment.java +3 −2 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl // Add input fields for the loaded Contact final CompactRawContactsEditorView editorView = getContent(); editorView.setListener(this); editorView.setState(mState, getMaterialPalette(), mViewIdGenerator); editorView.setState(mState, getMaterialPalette(), mViewIdGenerator, mPhotoId); // Set up the photo widget mPhotoHandler = createPhotoHandler(); Loading Loading @@ -357,7 +357,8 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl final Intent intent = isInsert ? EditorIntents.createInsertContactIntent( mState, getDisplayName(), getPhoneticName(), mUpdatedPhotos) : EditorIntents.createEditContactIntent(mLookupUri, getMaterialPalette()); : EditorIntents.createEditContactIntent(mLookupUri, getMaterialPalette(), mPhotoId); ImplicitIntentsUtil.startActivityInApp(getActivity(), intent); getActivity().finish(); Loading
src/com/android/contacts/editor/CompactRawContactsEditorView.java +24 −3 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O public void setState(RawContactDeltaList rawContactDeltas, MaterialColorMapUtils.MaterialPalette materialPalette, ViewIdGenerator viewIdGenerator) { ViewIdGenerator viewIdGenerator, long photoId) { mNames.removeAllViews(); mPhoneticNames.removeAllViews(); mNicknames.removeAllViews(); Loading @@ -281,7 +281,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O mMaterialPalette = materialPalette; vlog("Setting compact editor state from " + rawContactDeltas); addPhotoView(rawContactDeltas, viewIdGenerator); addPhotoView(rawContactDeltas, viewIdGenerator, photoId); addStructuredNameView(rawContactDeltas); addEditorViews(rawContactDeltas); removeExtraEmptyTextFields(mPhoneNumbers); Loading @@ -289,7 +289,8 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O } private void addPhotoView(RawContactDeltaList rawContactDeltas, ViewIdGenerator viewIdGenerator) { ViewIdGenerator viewIdGenerator, long photoId) { // Look for a match for the photo ID that was passed in for (RawContactDelta rawContactDelta : rawContactDeltas) { if (!rawContactDelta.isVisible()) continue; final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager); Loading @@ -300,6 +301,26 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O // Look for a non-empty super primary photo final DataKind dataKind = accountType.getKindForMimetype(Photo.CONTENT_ITEM_TYPE); if (dataKind != null) { for (ValuesDelta valuesDelta : rawContactDelta.getMimeEntries(Photo.CONTENT_ITEM_TYPE)) { if (valuesDelta != null && valuesDelta.getId() != null && valuesDelta.getId().equals(photoId)) { mPhotoRawContactId = rawContactDelta.getRawContactId(); mPhoto.setValues(dataKind, valuesDelta, rawContactDelta, /* readOnly =*/ !dataKind.editable, mMaterialPalette, viewIdGenerator); return; } } } } // Look for a non-empty super primary photo for (RawContactDelta rawContactDelta : rawContactDeltas) { if (!rawContactDelta.isVisible()) continue; final AccountType accountType = rawContactDelta.getAccountType(mAccountTypeManager); final DataKind dataKind = accountType.getKindForMimetype(Photo.CONTENT_ITEM_TYPE); if (dataKind != null) { final ValuesDelta valuesDelta = getNonEmptySuperPrimaryValuesDeltas( rawContactDelta, Photo.CONTENT_ITEM_TYPE, dataKind); Loading
src/com/android/contacts/editor/ContactEditorBaseFragment.java +14 −4 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements private static final String KEY_DISABLE_DELETE_MENU_OPTION = "disableDeleteMenuOption"; private static final String KEY_NEW_LOCAL_PROFILE = "newLocalProfile"; private static final String KEY_MATERIAL_PALETTE = "materialPalette"; private static final String KEY_PHOTO_ID = "photoId"; private static final String KEY_VIEW_ID_GENERATOR = "viewidgenerator"; Loading Loading @@ -172,6 +173,11 @@ abstract public class ContactEditorBaseFragment extends Fragment implements */ public static final String INTENT_EXTRA_UPDATED_PHOTOS = "updated_photos"; /** * Intent key to pass the ID of the photo to display on the editor. */ public static final String INTENT_EXTRA_PHOTO_ID = "photo_id"; /** * Intent extra to specify a {@link ContactEditor.SaveMode}. */ Loading Loading @@ -308,6 +314,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements protected boolean mDisableDeleteMenuOption; protected boolean mNewLocalProfile; protected MaterialColorMapUtils.MaterialPalette mMaterialPalette; protected long mPhotoId = -1; // // Helpers Loading Loading @@ -464,6 +471,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements mDisableDeleteMenuOption = savedState.getBoolean(KEY_DISABLE_DELETE_MENU_OPTION); mNewLocalProfile = savedState.getBoolean(KEY_NEW_LOCAL_PROFILE); mMaterialPalette = savedState.getParcelable(KEY_MATERIAL_PALETTE); mPhotoId = savedState.getLong(KEY_PHOTO_ID); mRawContacts = ImmutableList.copyOf(savedState.<RawContact>getParcelableArrayList( KEY_RAW_CONTACTS)); Loading Loading @@ -584,6 +592,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements if (mMaterialPalette != null) { outState.putParcelable(KEY_MATERIAL_PALETTE, mMaterialPalette); } outState.putLong(KEY_PHOTO_ID, mPhotoId); outState.putParcelable(KEY_VIEW_ID_GENERATOR, mViewIdGenerator); Loading Loading @@ -915,7 +924,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements } onSaveCompleted(/* hadChanges =*/ false, saveMode, /* saveSucceeded =*/ mLookupUri != null, mLookupUri, /* updatedPhotos =*/ null, backPressed); /* updatedPhotos =*/ null, backPressed, mPhotoId); return true; } Loading Loading @@ -1312,6 +1321,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements if (mIntentExtras.containsKey(INTENT_EXTRA_UPDATED_PHOTOS)) { mUpdatedPhotos = mIntentExtras.getParcelable(INTENT_EXTRA_UPDATED_PHOTOS); } mPhotoId = mIntentExtras.getLong(INTENT_EXTRA_PHOTO_ID); } } Loading @@ -1335,12 +1345,12 @@ abstract public class ContactEditorBaseFragment extends Fragment implements @Override public void onJoinCompleted(Uri uri) { onSaveCompleted(false, SaveMode.RELOAD, uri != null, uri, /* updatedPhotos =*/ null, /* backPressed =*/ false); /* backPressed =*/ false, /* photoId =*/ mPhotoId); } @Override public void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded, Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed) { Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed, long photoId) { if (hadChanges) { if (saveSucceeded) { if (saveMode != SaveMode.JOIN && mShowToastAfterSave) { Loading Loading @@ -1377,7 +1387,7 @@ abstract public class ContactEditorBaseFragment extends Fragment implements ? EditorIntents.createCompactInsertContactIntent( mState, getDisplayName(), getPhoneticName(), updatedPhotos) : EditorIntents.createCompactEditContactIntent( lookupUri, getMaterialPalette(), updatedPhotos); lookupUri, getMaterialPalette(), updatedPhotos, photoId); resultIntent.putExtra(INTENT_EXTRA_SAVE_BACK_PRESSED, true); mStatus = Status.CLOSING; if (mListener != null) mListener.onSaveFinished(resultIntent); Loading