Merge "Fix bugs when reading phone number in talkback mode." into ub-contactsdialer-a-dev
diff --git a/src/com/android/contacts/editor/TextFieldsEditorView.java b/src/com/android/contacts/editor/TextFieldsEditorView.java
index c0c2332..cdb4485 100644
--- a/src/com/android/contacts/editor/TextFieldsEditorView.java
+++ b/src/com/android/contacts/editor/TextFieldsEditorView.java
@@ -20,6 +20,8 @@
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;
@@ -251,7 +253,11 @@
// Read current value from state
final String column = field.column;
final String value = entry.getAsString(column);
- fieldView.setText(value);
+ 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);
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index af6dfdb..b838b6b 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -72,6 +72,7 @@
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 @@
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 @@
}
}
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 @@
-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,