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

Commit 5793dd52 authored by Daniel Lehmann's avatar Daniel Lehmann Committed by Android (Google) Code Review
Browse files

Merge "Fix accesibility text in quick contact and itemview"

parents 3dbae9a5 faa49c91
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -1745,6 +1745,7 @@

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
              [CHAR LIMIT=NONE]
    -->
    <string name="description_send_text_message">Send text message to <xliff:g id="name">%1$s</xliff:g></string>

@@ -1753,9 +1754,32 @@

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
              [CHAR LIMIT=NONE]
    -->
    <string name="description_call_log_unheard_voicemail">Unheard voicemail</string>

    <!-- String describing the button to send a text message on quick contact.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
              [CHAR LIMIT=NONE]
    -->
    <string name="description_send_message">Send message to <xliff:g id="name">%1$s</xliff:g></string>

    <!-- String describing the text for a phone number in quick contact.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_dial_phone_number">Dial phone <xliff:g id="name">%1$s</xliff:g></string>

    <!-- String describing the text for photo of a contact in a contacts list.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_quick_contact_for">Quick contact for <xliff:g id="name">%1$s</xliff:g></string>

    <!-- The string used to represent an unknown location for a phone number in the call log [CHAR LIMIT=3] -->
    <string name="call_log_empty_gecode">-</string>

+12 −0
Original line number Diff line number Diff line
@@ -698,6 +698,11 @@ public class ContactListItemView extends ViewGroup
        }
        if (mQuickContact == null) {
            mQuickContact = new QuickContactBadge(mContext, null, QUICK_CONTACT_BADGE_STYLE);
            if (mNameTextView != null) {
                mQuickContact.setContentDescription(mContext.getString(
                        R.string.description_quick_contact_for, mNameTextView.getText()));
            }

            addView(mQuickContact);
            mPhotoViewWidthAndHeightAreReady = false;
        }
@@ -1038,6 +1043,13 @@ public class ContactListItemView extends ViewGroup

        mDisplayNameFormatter.setDisplayName(
                getNameTextView(), displayOrder, highlightingEnabled, mHighlightedPrefix);
        // Since the quick contact content description is derived from the display name and there is
        // no guarantee that when the quick contact is initialized the display name is already set,
        // do it here too.
        if (mQuickContact != null) {
            mQuickContact.setContentDescription(mContext.getString(
                    R.string.description_quick_contact_for, mNameTextView.getText()));
        }
    }

    public void hideDisplayName() {
+11 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.contacts.R;

import android.app.Fragment;
import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@@ -115,6 +116,16 @@ public class QuickContactListFragment extends Fragment {
                alternateActionButton.setImageDrawable(action.getAlternateIcon());
                alternateActionButton.setVisibility(hasAlternateAction ? View.VISIBLE : View.GONE);

                // Special case for phone numbers in accessibility mode
                if (action.getMimeType().equals(Phone.CONTENT_ITEM_TYPE)) {
                    text1.setContentDescription(getActivity().getString(
                            R.string.description_dial_phone_number, action.getBody()));
                    if (hasAlternateAction) {
                        alternateActionButton.setContentDescription(getActivity()
                                .getString(R.string.description_send_message, action.getBody()));
                    }
                }

                text1.setText(action.getBody());
                text2.setText(action.getSubtitle());