diff options
author | Brian Attwell <brianattwell@google.com> | 2014-11-06 14:12:56 -0800 |
---|---|---|
committer | Brian Attwell <brianattwell@google.com> | 2014-11-06 18:39:34 -0800 |
commit | c300521331c04767cd19dfe05ab77567514bbaa0 (patch) | |
tree | a0011b38d920d41b8a44d96fcca961119e736397 /src/com/android/contacts/editor/ContactEditorFragment.java | |
parent | b7e654fae3cf0bd05605b0f5dd28d82f99e6d8fe (diff) | |
download | packages_apps_Contacts-c300521331c04767cd19dfe05ab77567514bbaa0.tar.gz packages_apps_Contacts-c300521331c04767cd19dfe05ab77567514bbaa0.tar.bz2 packages_apps_Contacts-c300521331c04767cd19dfe05ab77567514bbaa0.zip |
Use larger photo in contact editor
Increase the size of the photo in the contact editor.
This means we can no longer rely on thumbnails. We
now need to load contact photos from Uris.
Bug: 18004959
Change-Id: Ice2099998194adad9336c5d90e9873a230ca4bd5
Diffstat (limited to 'src/com/android/contacts/editor/ContactEditorFragment.java')
-rw-r--r-- | src/com/android/contacts/editor/ContactEditorFragment.java | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java index 23ea6af73..ca7151a15 100644 --- a/src/com/android/contacts/editor/ContactEditorFragment.java +++ b/src/com/android/contacts/editor/ContactEditorFragment.java @@ -34,7 +34,6 @@ import android.content.Intent; import android.content.Loader; import android.database.Cursor; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Rect; import android.media.RingtoneManager; import android.net.Uri; @@ -862,10 +861,10 @@ public class ContactEditorFragment extends Fragment implements // Set up the photo handler. bindPhotoHandler(editor, type, mState); - // If a new photo was chosen but not yet saved, we need to - // update the thumbnail to reflect this. - Bitmap bitmap = updatedBitmapForRawContact(rawContactId); - if (bitmap != null) editor.setPhotoBitmap(bitmap); + // If a new photo was chosen but not yet saved, we need to update the UI to + // reflect this. + final Uri photoUri = updatedPhotoUriForRawContact(rawContactId); + if (photoUri != null) editor.setFullSizedPhoto(photoUri); if (editor instanceof RawContactEditorView) { final Activity activity = getActivity(); @@ -922,14 +921,12 @@ public class ContactEditorFragment extends Fragment implements } /** - * If we've stashed a temporary file containing a contact's new photo, - * decode it and return the bitmap. + * If we've stashed a temporary file containing a contact's new photo, return its URI. * @param rawContactId identifies the raw-contact whose Bitmap we'll try to return. - * @return Bitmap of photo for specified raw-contact, or null - */ - private Bitmap updatedBitmapForRawContact(long rawContactId) { - String path = mUpdatedPhotos.getString(String.valueOf(rawContactId)); - return path == null ? null : BitmapFactory.decodeFile(path); + * @return Uru of photo for specified raw-contact, or null + */ + private Uri updatedPhotoUriForRawContact(long rawContactId) { + return (Uri) mUpdatedPhotos.get(String.valueOf(rawContactId)); } private void bindPhotoHandler(BaseRawContactEditorView editor, AccountType type, @@ -1861,7 +1858,7 @@ public class ContactEditorFragment extends Fragment implements } if (requestingEditor != null) { - requestingEditor.setPhotoBitmap(photo); + requestingEditor.setPhotoEntry(photo); } else { Log.w(TAG, "The contact that requested the photo is no longer present."); } @@ -2065,7 +2062,7 @@ public class ContactEditorFragment extends Fragment implements */ @Override public void onRemovePictureChosen() { - mEditor.setPhotoBitmap(null); + mEditor.setPhotoEntry(null); // Prevent bitmap from being restored if rotate the device. // (only if we first chose a new photo before removing it) |