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

Commit 334e81b9 authored by Wenyi Wang's avatar Wenyi Wang Committed by Android (Google) Code Review
Browse files

Merge "Correct content description of labels spinner and delete button in...

Merge "Correct content description of labels spinner and delete button in editor" into ub-contactsdialer-a-dev
parents 96101f6b daf8a41b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -882,4 +882,12 @@
    <!-- Message below contact name, showing from which account [CHAR LIMIT=NONE]-->
    <string name="contact_from_account_name">From <xliff:g id="account_name">%s</xliff:g></string>

    <!-- Content description of delete button to the right of each section in editor, including
    data type. For example: Delete Home Phone, Delete Work Email, etc [CHAR LIMIT=30]-->
    <string name="editor_delete_view_description">Delete <xliff:g id="data_type">%s </xliff:g><xliff:g id="data_kind">%s</xliff:g></string>

    <!-- Content description of delete button to the right of each section in editor, without data
    type. For example: Delete Website, Delete SIP, etc [CHAR LIMIT=30]-->
    <string name="editor_delete_view_description_short">Delete <xliff:g id="data_kind">%s</xliff:g></string>

</resources>
+17 −0
Original line number Diff line number Diff line
@@ -308,8 +308,23 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
        mLabel.setAdapter(mEditTypeAdapter);
        if (mEditTypeAdapter.hasCustomSelection()) {
            mLabel.setSelection(mEditTypeAdapter.getPosition(CUSTOM_SELECTION));
            mDeleteContainer.setContentDescription(
                    getContext().getString(R.string.editor_delete_view_description,
                            mEntry.getAsString(mType.customColumn),
                            getContext().getString(mKind.titleRes)));
        } else {
            mLabel.setSelection(mEditTypeAdapter.getPosition(mType));
            if (mType != null) {
                mDeleteContainer.setContentDescription(
                        getContext().getString(R.string.editor_delete_view_description,
                                getContext().getString(mType.labelRes),
                                getContext().getString(mKind.titleRes)));
            } else {
                mDeleteContainer.setContentDescription(
                        getContext().getString(R.string.editor_delete_view_description_short,
                                getContext().getString(mKind.titleRes)));
            }

        }
    }

@@ -404,6 +419,8 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
        final boolean hasTypes = RawContactModifier.hasEditTypes(kind);
        setupLabelButton(hasTypes);
        mLabel.setEnabled(!readOnly && isEnabled());
        mLabel.setContentDescription(getContext().getResources().getString(mKind.titleRes));

        if (hasTypes) {
            mType = RawContactModifier.getCurrentType(entry, kind);
            rebuildLabel();