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

Commit ef6ceb27 authored by Gary Mai's avatar Gary Mai
Browse files

Update editor photo view green lines

Default photo reads "Add contact photo"
Existing photo reads "Change contact photo"

Test: Manually verified the above, including proper updates when
  * adding a new photo
  * removing the photo

Bug: 32976203
Bug: 32975967
Change-Id: Id10023998b177d0e5e86db1ca11bcf5dd9727a87
parent eafc1798
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -848,8 +848,11 @@
    <!-- Button to expand the contact editor to show all available input fields. [CHAR LIMIT=60] -->
    <string name="editor_more_fields">More fields</string>

    <!-- Content description for the contact editor photo overlay which, when clicked, shows a dialog with the options for changing the contact photo. [CHAR LIMIT=30] -->
    <string name="editor_change_photo_content_description">Change photo</string>
    <!-- Content description for the contact editor photo overlay which, when clicked, shows a dialog with the options for changing the contact photo. [CHAR LIMIT=NONE] -->
    <string name="editor_change_photo_content_description">Change contact photo</string>

    <!-- Content description for the contact editor photo overlay which, when clicked, shows a dialog with the options for adding a contact photo. [CHAR LIMIT=NONE] -->
    <string name="editor_add_photo_content_description">Add contact photo</string>

    <!-- Accessibility content description, describes the image as being the photo for the contact the user is viewing. [CHAR LIMIT=NONE] -->
    <string name="editor_contact_photo_content_description">Contact photo</string>
+10 −2
Original line number Diff line number Diff line
@@ -122,8 +122,7 @@ public class PhotoEditorView extends RelativeLayout implements View.OnClickListe
            mPhotoIcon.setVisibility(View.VISIBLE);
            mPhotoIconOverlay.setVisibility(View.VISIBLE);
            mPhotoTouchInterceptOverlay.setOnClickListener(this);
            mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
                    R.string.editor_change_photo_content_description));
            updatePhotoDescription();
        }
    }

@@ -212,13 +211,21 @@ public class PhotoEditorView extends RelativeLayout implements View.OnClickListe
    private void setPhoto(Bitmap bitmap) {
        mPhotoImageView.setImageBitmap(bitmap);
        mIsNonDefaultPhotoBound = true;
        updatePhotoDescription();
    }

    private void setDefaultPhoto(MaterialPalette materialPalette) {
        mIsNonDefaultPhotoBound = false;
        updatePhotoDescription();
        EditorUiUtils.setDefaultPhoto(mPhotoImageView, getResources(), materialPalette);
    }

    private void updatePhotoDescription() {
        mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
                mIsNonDefaultPhotoBound
                        ? R.string.editor_change_photo_content_description
                        : R.string.editor_add_photo_content_description));
    }
    /**
     * Binds a full size photo loaded from the given Uri.
     */
@@ -226,6 +233,7 @@ public class PhotoEditorView extends RelativeLayout implements View.OnClickListe
        EditorUiUtils.loadPhoto(ContactPhotoManager.getInstance(getContext()),
                mPhotoImageView, photoUri);
        mIsNonDefaultPhotoBound = true;
        updatePhotoDescription();
    }

    /**