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

Commit 4e0e969b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Write null into file ID when removing photo"

parents ab70b520 18724188
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public class CompactPhotoEditorView extends RelativeLayout implements View.OnCli
    private View mPhotoIcon;
    private View mPhotoIconOverlay;
    private View mPhotoTouchInterceptOverlay;
    private MaterialPalette mMaterialPalette;

    private boolean mReadOnly;
    private boolean mIsNonDefaultPhotoBound;
@@ -122,12 +123,16 @@ public class CompactPhotoEditorView extends RelativeLayout implements View.OnCli
        }
    }

    public void setPalette(MaterialPalette palette) {
        mMaterialPalette = palette;
    }

    /**
     * Tries to bind a full size photo or a bitmap loaded from the given ValuesDelta,
     * and falls back to the default avatar, tinted using the given MaterialPalette (if it's not
     * null);
     */
    public void setPhoto(ValuesDelta valuesDelta, MaterialPalette materialPalette) {
    public void setPhoto(ValuesDelta valuesDelta) {
        // Check if we can update to the full size photo immediately
        final Long photoFileId = EditorUiUtils.getPhotoFileId(valuesDelta);
        if (photoFileId != null) {
@@ -146,7 +151,7 @@ public class CompactPhotoEditorView extends RelativeLayout implements View.OnCli
            return;
        }

        setDefaultPhoto(materialPalette);
        setDefaultPhoto(mMaterialPalette);
        adjustDimensions();
    }

@@ -223,9 +228,7 @@ public class CompactPhotoEditorView extends RelativeLayout implements View.OnCli
     * Removes the current bound photo bitmap.
     */
    public void removePhoto() {
        mPhotoImageView.setImageBitmap(/* bitmap =*/ null);
        mIsNonDefaultPhotoBound = false;
        setDefaultPhoto(/* materialPalette =*/ null);
        setDefaultPhoto(mMaterialPalette);
    }

    @Override
+3 −1
Original line number Diff line number Diff line
@@ -384,6 +384,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
    public void removePhoto() {
        mPhotoValuesDelta.setFromTemplate(true);
        mPhotoValuesDelta.put(Photo.PHOTO, (byte[]) null);
        mPhotoValuesDelta.put(Photo.PHOTO_FILE_ID, (String) null);

        mPhotoView.removePhoto();
    }
@@ -940,7 +941,8 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
            return;
        }
        // Set the photo view
        mPhotoView.setPhoto(superPrimaryDelta, mMaterialPalette);
        mPhotoView.setPalette(mMaterialPalette);
        mPhotoView.setPhoto(superPrimaryDelta);

        if (isReadOnlyRawContact()) {
            mPhotoView.setReadOnly(true);