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

Commit b6949dc7 authored by Tingting Wang's avatar Tingting Wang
Browse files

Fix bugs when reading phone number in talkback mode.

1) In quick contact UI, phone number should be read out in number format.
2) In edit UI, phone number also should be read out in number format.

BUG 25447971

Change-Id: I5b2e60cd25c2585d4314996c14b126e9f2ce0470
parent 5a83ad90
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.content.Context;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.ContactsContract;
import android.telephony.PhoneNumberUtils;
import android.text.Editable;
import android.text.InputType;
import android.text.TextUtils;
@@ -243,7 +245,11 @@ public class TextFieldsEditorView extends LabeledEditorView {
            // Read current value from state
            final String column = field.column;
            final String value = entry.getAsString(column);
            if (ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE.equals(kind.mimeType)) {
                fieldView.setText(PhoneNumberUtils.createTtsSpannable(value));
            } else {
                fieldView.setText(value);
            }

            // Show the delete button if we have a non-null value
            setDeleteButtonVisible(value != null);
+7 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import android.support.v7.widget.CardView;
import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.text.BidiFormatter;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
@@ -1700,6 +1701,7 @@ public class QuickContactActivity extends ContactsActivity
        String text = null;
        Drawable textIcon = null;
        StringBuilder primaryContentDescription = new StringBuilder();
        Spannable phoneContentDescription = null;
        Intent intent = null;
        boolean shouldApplyColor = true;
        Drawable alternateIcon = null;
@@ -1845,6 +1847,8 @@ public class QuickContactActivity extends ContactsActivity
                    }
                }
                primaryContentDescription.append(header);
                phoneContentDescription = com.android.contacts.common.util.ContactDisplayUtils
                        .getTelephoneTtsSpannable(primaryContentDescription.toString(), header);
                icon = res.getDrawable(R.drawable.ic_phone_24dp);
                iconResourceId = R.drawable.ic_phone_24dp;
                if (PhoneCapabilityTester.isPhone(context)) {
@@ -2076,7 +2080,9 @@ public class QuickContactActivity extends ContactsActivity
                -1 : (int) dataItem.getId();

        return new Entry(dataId, icon, header, subHeader, subHeaderIcon, text, textIcon,
                new SpannableString(primaryContentDescription.toString()),
                phoneContentDescription == null
                        ? new SpannableString(primaryContentDescription.toString())
                        : phoneContentDescription,
                intent, alternateIcon, alternateIntent,
                alternateContentDescription.toString(), shouldApplyColor, isEditable,
                entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription, thirdAction,