Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a20bb7f9 authored by Walter Jang's avatar Walter Jang Committed by Android (Google) Code Review
Browse files

Merge "Update compact editor photo to full res when possible"

parents 9f9d78e4 41b3ea1c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -80,7 +80,11 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
                    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 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
        // 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
+0 −2
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ public class CompactPhotoEditorView extends LinearLayout implements View.OnClick
    private ValuesDelta mValuesDelta;
    private boolean mReadOnly;
    private boolean mIsPhotoSet;
    private MaterialColorMapUtils.MaterialPalette mMaterialPalette;

    private QuickContactImageView mPhotoImageView;

@@ -94,7 +93,6 @@ public class CompactPhotoEditorView extends LinearLayout implements View.OnClick
            ViewIdGenerator viewIdGenerator) {
        mValuesDelta = valuesDelta;
        mReadOnly = readOnly;
        mMaterialPalette = materialPalette;

        setId(viewIdGenerator.getId(rawContactDelta, dataKind, valuesDelta, /* viewIndex =*/ 0));

+8 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.contacts.editor.CompactContactEditorFragment.PhotoHandler;

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;
@@ -218,6 +219,13 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
        mPhoto.setPhoto(bitmap);
    }

    /**
     * Pass through to {@link CompactPhotoEditorView#setFullSizedPhoto(Uri)}.
     */
    public void setFullSizePhoto(Uri photoUri) {
        mPhoto.setFullSizedPhoto(photoUri);
    }

    /**
     * Pass through to {@link CompactPhotoEditorView#isWritablePhotoSet}.
     */