Update compact editor photo to full res when possible
Bug 19655206
Change-Id: If30c7ba83851dcc7c98fa1be4bed92e302ba8245
diff --git a/src/com/android/contacts/editor/CompactContactEditorFragment.java b/src/com/android/contacts/editor/CompactContactEditorFragment.java
index 108cab6..570f09a 100644
--- a/src/com/android/contacts/editor/CompactContactEditorFragment.java
+++ b/src/com/android/contacts/editor/CompactContactEditorFragment.java
@@ -80,7 +80,11 @@
Log.w(TAG, "Invalid photo selected");
}
getContent().setPhoto(bitmap);
+
+ // If a new photo was chosen but not yet saved,
+ // we need to update the UI immediately
mUpdatedPhotos.putParcelable(String.valueOf(mPhotoRawContactId), uri);
+ getContent().setFullSizePhoto(uri);
}
@Override
@@ -224,6 +228,10 @@
// Set up the photo widget
mPhotoHandler = createPhotoHandler();
mPhotoRawContactId = editorView.getPhotoRawContactId();
+ if (mUpdatedPhotos.containsKey(String.valueOf(mPhotoRawContactId))) {
+ editorView.setFullSizePhoto((Uri) mUpdatedPhotos.getParcelable(
+ String.valueOf(mPhotoRawContactId)));
+ }
editorView.setPhotoHandler(mPhotoHandler);
// The editor is ready now so make it visible
diff --git a/src/com/android/contacts/editor/CompactPhotoEditorView.java b/src/com/android/contacts/editor/CompactPhotoEditorView.java
index 86a0ee8..c4ece0d 100644
--- a/src/com/android/contacts/editor/CompactPhotoEditorView.java
+++ b/src/com/android/contacts/editor/CompactPhotoEditorView.java
@@ -61,7 +61,6 @@
private ValuesDelta mValuesDelta;
private boolean mReadOnly;
private boolean mIsPhotoSet;
- private MaterialColorMapUtils.MaterialPalette mMaterialPalette;
private QuickContactImageView mPhotoImageView;
@@ -94,7 +93,6 @@
ViewIdGenerator viewIdGenerator) {
mValuesDelta = valuesDelta;
mReadOnly = readOnly;
- mMaterialPalette = materialPalette;
setId(viewIdGenerator.getId(rawContactDelta, dataKind, valuesDelta, /* viewIndex =*/ 0));
diff --git a/src/com/android/contacts/editor/CompactRawContactsEditorView.java b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
index 81d475e..704fe9d 100644
--- a/src/com/android/contacts/editor/CompactRawContactsEditorView.java
+++ b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
@@ -30,6 +30,7 @@
import android.content.Context;
import android.graphics.Bitmap;
+import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
import android.provider.ContactsContract.CommonDataKinds.Nickname;
@@ -219,6 +220,13 @@
}
/**
+ * Pass through to {@link CompactPhotoEditorView#setFullSizedPhoto(Uri)}.
+ */
+ public void setFullSizePhoto(Uri photoUri) {
+ mPhoto.setFullSizedPhoto(photoUri);
+ }
+
+ /**
* Pass through to {@link CompactPhotoEditorView#isWritablePhotoSet}.
*/
public boolean isWritablePhotoSet() {