Fix SMS talkback descriptions
Change SMS content descriptions for talkback from "Text message" for all
phones to the phone type specific resource strings "Text work", "Text home",
"Text <custom_type>", etc.
Bug:9392161
Change-Id: Ie765aad6d7d8f7e19f3c22a716392417aba4f29c
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index ee2df1c..e48d248 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -89,6 +89,7 @@
import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.util.AccountsListAdapter.AccountListFilter;
+import com.android.contacts.common.util.ContactDisplayUtils;
import com.android.contacts.model.Contact;
import com.android.contacts.model.RawContact;
import com.android.contacts.model.RawContactDelta;
@@ -592,7 +593,8 @@
entry.intent = phoneIntent;
entry.secondaryIntent = smsIntent;
entry.secondaryActionIcon = kind.iconAltRes;
- entry.secondaryActionDescription = kind.iconAltDescriptionRes;
+ entry.secondaryActionDescription =
+ ContactDisplayUtils.getSmsLabelResourceId(entry.type);
} else if (mHasPhone) {
entry.intent = phoneIntent;
} else if (mHasSms) {
@@ -1728,7 +1730,13 @@
String secondaryActionDescription = null;
if (entry.secondaryActionIcon != -1) {
secondaryActionIcon = resources.getDrawable(entry.secondaryActionIcon);
- secondaryActionDescription = resources.getString(entry.secondaryActionDescription);
+ if (ContactDisplayUtils.isCustomPhoneType(entry.type)) {
+ secondaryActionDescription = resources.getString(
+ entry.secondaryActionDescription, entry.typeString);
+ } else {
+ secondaryActionDescription = resources.getString(
+ entry.secondaryActionDescription);
+ }
} else if ((entry.chatCapability & Im.CAPABILITY_HAS_CAMERA) != 0) {
secondaryActionIcon =
resources.getDrawable(R.drawable.sym_action_videochat_holo_light);