Sms and call log entry content description string fixes
* This is incremental work to fixing TalkBack for
all phone number Strings
* Date was being added twice to the call log content
description string
* Use xliff tags for all parts of both the sms and call log
content description strings
* Removed an unnecessary ExpandingEntryCardView constructor
Bug 17322140
Change-Id: Iccc39dad5dcc3fc7f8079de439b07d306b6c24e3
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 68b1190..e8b954e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -710,7 +710,7 @@
<string name="content_description_directions">directions to location</string>
<!-- Content description for recent sms interaction [CHAR LIMIT=NONE] -->
- <string name="content_description_recent_sms">recent sms. <xliff:g id="message_details">%s</xliff:g>. click to respond</string>
+ <string name="content_description_recent_sms">recent sms. <xliff:g id="message_body">%s</xliff:g>. <xliff:g id="phone_number">%s</xliff:g>. <xliff:g id="date">%s</xliff:g>. click to respond</string>
<!-- Header for the Relation entry [CHAR LIMIT=NONE] -->
<string name="content_description_recent_call_type_incoming">incoming</string>
@@ -720,7 +720,7 @@
<string name="content_description_recent_call_type_missed">missed</string>
<!-- Content description for recent sms interaction [CHAR LIMIT=NONE] -->
- <string name="content_description_recent_call">recent call. <xliff:g id="call_details">%s</xliff:g>. click to call back</string>
+ <string name="content_description_recent_call">recent call. <xliff:g id="call_type">%s</xliff:g>. <xliff:g id="phone_number">%s</xliff:g>. <xliff:g id="date">%s</xliff:g>. click to call back</string>
<!-- Prefix for messages that you sent [CHAR LIMIT=40] -->
<string name="message_from_you_prefix">You: <xliff:g id="sms_body">%s</xliff:g></string>
diff --git a/src/com/android/contacts/interactions/CallLogInteraction.java b/src/com/android/contacts/interactions/CallLogInteraction.java
index 89ca3fb..a03f6a4 100644
--- a/src/com/android/contacts/interactions/CallLogInteraction.java
+++ b/src/com/android/contacts/interactions/CallLogInteraction.java
@@ -180,10 +180,8 @@
@Override
public String getContentDescription(Context context) {
- String callDetails = getCallTypeString(context) + ". " + getViewFooter(context) + ". " +
- getViewHeader(context) + ". " + getViewFooter(context);
return context.getResources().getString(R.string.content_description_recent_call,
- callDetails);
+ getCallTypeString(context), getViewHeader(context), getViewFooter(context));
}
private String getCallTypeString(Context context) {
diff --git a/src/com/android/contacts/interactions/CallLogInteractionsLoader.java b/src/com/android/contacts/interactions/CallLogInteractionsLoader.java
index ed6f2d5..c8e26e9 100644
--- a/src/com/android/contacts/interactions/CallLogInteractionsLoader.java
+++ b/src/com/android/contacts/interactions/CallLogInteractionsLoader.java
@@ -103,6 +103,8 @@
}
private List<ContactInteraction> getCallLogInteractions(String phoneNumber) {
+ // TODO: the phone number added to the ContactInteractions result should retain their
+ // original formatting since TalkBack is not reading the normalized number correctly
final String normalizedNumber = PhoneNumberUtils.normalizeNumber(phoneNumber);
// If the number contains only symbols, we can skip it
if (TextUtils.isEmpty(normalizedNumber)) {
diff --git a/src/com/android/contacts/interactions/SmsInteraction.java b/src/com/android/contacts/interactions/SmsInteraction.java
index 8e61213..3bba0bc 100644
--- a/src/com/android/contacts/interactions/SmsInteraction.java
+++ b/src/com/android/contacts/interactions/SmsInteraction.java
@@ -160,10 +160,8 @@
@Override
public String getContentDescription(Context context) {
- String messageDetails = getViewHeader(context) + ". " + getViewBody(context) + ". " +
- getViewFooter(context);
return context.getResources().getString(R.string.content_description_recent_sms,
- messageDetails);
+ getViewHeader(context), getViewBody(context), getViewFooter(context));
}
@Override
diff --git a/src/com/android/contacts/interactions/SmsInteractionsLoader.java b/src/com/android/contacts/interactions/SmsInteractionsLoader.java
index 8d58712..0cd1e5e 100644
--- a/src/com/android/contacts/interactions/SmsInteractionsLoader.java
+++ b/src/com/android/contacts/interactions/SmsInteractionsLoader.java
@@ -66,6 +66,8 @@
// Retrieve the thread IDs
List<String> threadIdStrings = new ArrayList<>();
for (String phone : mPhoneNums) {
+ // TODO: the phone numbers added to the ContactInteraction result should retain their
+ // original formatting since TalkBack is not reading the normalized numbers correctly
try {
threadIdStrings.add(String.valueOf(
Telephony.Threads.getOrCreateThreadId(getContext(), phone)));
diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
index f40ebe7..68698d6 100644
--- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
+++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
@@ -38,9 +38,7 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
-import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup;
-import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
@@ -88,19 +86,6 @@
private final String mThirdContentDescription;
private final int mIconResourceId;
- public Entry(int id, Drawable icon, String header, String subHeader, String text,
- String primaryContentDescription, Intent intent, Drawable alternateIcon,
- Intent alternateIntent, String alternateContentDescription,
- boolean shouldApplyColor, boolean isEditable,
- EntryContextMenuInfo entryContextMenuInfo, Drawable thirdIcon, Intent thirdIntent,
- String thirdContentDescription, int iconResourceId) {
- this(id, icon, header, subHeader, null, text, null, primaryContentDescription, intent,
- alternateIcon,
- alternateIntent, alternateContentDescription, shouldApplyColor, isEditable,
- entryContextMenuInfo, thirdIcon, thirdIntent, thirdContentDescription,
- iconResourceId);
- }
-
public Entry(int id, Drawable mainIcon, String header, String subHeader,
Drawable subHeaderIcon, String text, Drawable textIcon,
String primaryContentDescription, Intent intent,
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 909b94b..4d543a4 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -1030,7 +1030,9 @@
/* icon = */ null,
getResources().getString(R.string.name_phonetic),
phoneticName,
+ /* subHeaderIcon = */ null,
/* text = */ null,
+ /* textIcon = */ null,
/* primaryContentDescription = */ null,
/* intent = */ null,
/* alternateIcon = */ null,
@@ -1091,7 +1093,8 @@
R.drawable.ic_phone_24dp).mutate();
final Entry phonePromptEntry = new Entry(CARD_ENTRY_ID_EDIT_CONTACT,
phoneIcon, getString(R.string.quickcontact_add_phone_number),
- /* subHeader = */ null, /* text = */ null, /* primaryContentDescription = */ null,
+ /* subHeader = */ null, /* subHeaderIcon = */ null, /* text = */ null,
+ /* textIcon = */ null, /* primaryContentDescription = */ null,
getEditContactIntent(),
/* alternateIcon = */ null, /* alternateIntent = */ null,
/* alternateContentDescription = */ null, /* shouldApplyColor = */ true,
@@ -1103,7 +1106,8 @@
R.drawable.ic_email_24dp).mutate();
final Entry emailPromptEntry = new Entry(CARD_ENTRY_ID_EDIT_CONTACT,
emailIcon, getString(R.string.quickcontact_add_email), /* subHeader = */ null,
- /* text = */ null, /* primaryContentDescription = */ null,
+ /* subHeaderIcon = */ null,
+ /* text = */ null, /* textIcon = */ null, /* primaryContentDescription = */ null,
getEditContactIntent(), /* alternateIcon = */ null,
/* alternateIntent = */ null, /* alternateContentDescription = */ null,
/* shouldApplyColor = */ true, /* isEditable = */ false,