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

Commit 34047d2d authored by Gary Mai's avatar Gary Mai
Browse files

A11y bug fixes for editor

Set profile photo content description as "Contact photo" if
in read-only mode, otherwise it's still "Change photo"
Set the whole row for read-only data to be focusable so it
reads the entire thing in one go
Fix ordering of content description for account header.

Test:
Manually verified the above.

Bug:32952012
Bug:32952102
Bug:32952414
Change-Id: I845f020e805a7f715892690b59c4bc00a8435e63
parent 12b8e80c
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -16,9 +16,10 @@

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/read_only_row"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="@dimen/editor_delete_button_width"
    android:focusableInTouchMode="true"
    android:layout_marginBottom="@dimen/editor_padding_between_read_only_editor_views"
    android:orientation="horizontal">

@@ -41,9 +42,7 @@
            android:textSize="@dimen/editor_form_text_size"
            android:textColor="?android:attr/textColorSecondary"
            android:singleLine="true"
            android:saveEnabled="false"
            android:textAlignment="viewStart"
            android:enabled="false"/>
            android:textAlignment="viewStart"/>

        <TextView
            android:id="@+id/type"
@@ -52,9 +51,7 @@
            android:textSize="@dimen/editor_form_text_size"
            android:textColor="?android:attr/textColorSecondary"
            android:singleLine="true"
            android:saveEnabled="false"
            android:textAlignment="viewStart"
            android:enabled="false"/>
            android:textAlignment="viewStart"/>

    </LinearLayout>

+3 −0
Original line number Diff line number Diff line
@@ -851,6 +851,9 @@
    <!-- 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>

    <!-- 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>

    <!-- Toast message displayed when the editor fails to load for a contacts. [CHAR LIMIT=NONE] -->
    <string name="editor_failed_to_load">Failed to open editor.</string>

+4 −0
Original line number Diff line number Diff line
@@ -116,10 +116,14 @@ public class PhotoEditorView extends RelativeLayout implements View.OnClickListe
            mPhotoIcon.setVisibility(View.GONE);
            mPhotoIconOverlay.setVisibility(View.GONE);
            mPhotoTouchInterceptOverlay.setClickable(false);
            mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
                    R.string.editor_contact_photo_content_description));
        } else {
            mPhotoIcon.setVisibility(View.VISIBLE);
            mPhotoIconOverlay.setVisibility(View.VISIBLE);
            mPhotoTouchInterceptOverlay.setOnClickListener(this);
            mPhotoTouchInterceptOverlay.setContentDescription(getContext().getString(
                    R.string.editor_change_photo_content_description));
        }
    }

+3 −6
Original line number Diff line number Diff line
@@ -685,10 +685,8 @@ public class RawContactEditorView extends LinearLayout implements View.OnClickLi

    private void bindData(Drawable icon, String iconContentDescription, CharSequence data,
            CharSequence type, boolean isFirstEntry, boolean forceLTR) {
        final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
        final View field = inflater.inflate(R.layout.item_read_only_field, mKindSectionViews,
                false);
        final View field = mLayoutInflater.inflate(R.layout.item_read_only_field, mKindSectionViews,
                /* attachToRoot */ false);
        if (isFirstEntry) {
            final ImageView imageView = (ImageView) field.findViewById(R.id.kind_icon);
            imageView.setImageDrawable(icon);
@@ -749,8 +747,7 @@ public class RawContactEditorView extends LinearLayout implements View.OnClickLi

        // Set the content description
        mAccountHeaderContainer.setContentDescription(
                EditorUiUtils.getAccountInfoContentDescription(primaryText,
                        secondaryText));
                EditorUiUtils.getAccountInfoContentDescription(secondaryText, primaryText));
    }

    private void addAccountSelector(final RawContactDelta rawContactDelta) {