summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllogutils
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-03-30 09:01:44 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-30 10:27:50 -0700
commit0182e001d3e73f3a4354ba7550e1e5b001a7bce5 (patch)
tree8ec4011ba01d34ac01cd879e2fc99cf64ecb7a34 /java/com/android/dialer/calllogutils
parentfbf5faff115beb005d5b6138fcd965cf1a606c7e (diff)
Differentiate video call types (carrier/Duo) in call descriptions for the new UI.
Bug: 70988686 Test: CallLogEntryTextTest PiperOrigin-RevId: 191071267 Change-Id: I392e3b4c47e266f0a553fe28079d4800fc174a8f
Diffstat (limited to 'java/com/android/dialer/calllogutils')
-rw-r--r--java/com/android/dialer/calllogutils/CallLogEntryText.java60
-rw-r--r--java/com/android/dialer/calllogutils/res/values/strings.xml7
2 files changed, 43 insertions, 24 deletions
diff --git a/java/com/android/dialer/calllogutils/CallLogEntryText.java b/java/com/android/dialer/calllogutils/CallLogEntryText.java
index c77869169..e346de011 100644
--- a/java/com/android/dialer/calllogutils/CallLogEntryText.java
+++ b/java/com/android/dialer/calllogutils/CallLogEntryText.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.provider.CallLog.Calls;
import android.text.TextUtils;
import com.android.dialer.calllog.model.CoalescedRow;
+import com.android.dialer.duo.DuoConstants;
import com.android.dialer.time.Clock;
import com.google.common.base.Optional;
import com.google.common.collect.Collections2;
@@ -72,20 +73,22 @@ public final class CallLogEntryText {
* <p>Rules:
*
* <ul>
- * <li>For numbers that are not spam or blocked: (Duo video, )?$Label|$Location • Date
- * <li>For blocked non-spam numbers: Blocked • (Duo video, )?$Label|$Location • Date
- * <li>For spam but not blocked numbers: Spam • (Duo video, )?$Label • Date
- * <li>For blocked spam numbers: Blocked • Spam • (Duo video, )?$Label • Date
+ * <li>For numbers that are not spam or blocked: $Label(, Duo video|Carrier video)?|$Location •
+ * Date
+ * <li>For blocked non-spam numbers: Blocked • $Label(, Duo video|Carrier video)?|$Location •
+ * Date
+ * <li>For spam but not blocked numbers: Spam • $Label(, Duo video|Carrier video)? • Date
+ * <li>For blocked spam numbers: Blocked • Spam • $Label(, Duo video|Carrier video)? • Date
* </ul>
*
* <p>Examples:
*
* <ul>
- * <li>Duo Video, Mobile • Now
- * <li>Duo Video • 10 min ago
+ * <li>Mobile, Duo video • Now
+ * <li>Duo video • 10 min ago
* <li>Mobile • 11:45 PM
* <li>Mobile • Sun
- * <li>Blocked • Duo Video, Mobile • Now
+ * <li>Blocked • Mobile, Duo video • Now
* <li>Blocked • Brooklyn, NJ • 10 min ago
* <li>Spam • Mobile • Now
* <li>Spam • Now
@@ -125,20 +128,20 @@ public final class CallLogEntryText {
/*
* Rules:
* For numbers that are not spam or blocked:
- * (Duo video, )?$Label|$Location [• NumberIfNoName]?
+ * $Label(, Duo video|Carrier video)?|$Location [• NumberIfNoName]?
* For blocked non-spam numbers:
- * Blocked • (Duo video, )?$Label|$Location [• NumberIfNoName]?
+ * Blocked • $Label(, Duo video|Carrier video)?|$Location [• NumberIfNoName]?
* For spam but not blocked numbers:
- * Spam • (Duo video, )?$Label [• NumberIfNoName]?
+ * Spam • $Label(, Duo video|Carrier video)? [• NumberIfNoName]?
* For blocked spam numbers:
- * Blocked • Spam • (Duo video, )?$Label [• NumberIfNoName]?
+ * Blocked • Spam • $Label(, Duo video|Carrier video)? [• NumberIfNoName]?
*
* The number is shown at the end if there is no name for the entry. (It is shown in primary
* text otherwise.)
*
* Examples:
- * Duo Video, Mobile • 555-1234
- * Duo Video • 555-1234
+ * Mobile, Duo video • 555-1234
+ * Duo video • 555-1234
* Mobile • 555-1234
* Blocked • Mobile • 555-1234
* Blocked • Brooklyn, NJ • 555-1234
@@ -178,7 +181,7 @@ public final class CallLogEntryText {
}
/**
- * Returns a value such as "Duo Video, Mobile" without the time of the call or formatted number
+ * Returns a value such as "Mobile, Duo video" without the time of the call or formatted number
* appended.
*
* <p>When the secondary text is shown in call log entry list, this prefix is suffixed with the
@@ -187,18 +190,30 @@ public final class CallLogEntryText {
*/
private static CharSequence getNumberTypeLabel(Context context, CoalescedRow row) {
StringBuilder secondaryText = new StringBuilder();
- if ((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) {
- // TODO(zachh): Add "Duo" prefix?
- secondaryText.append(context.getText(R.string.new_call_log_video));
- }
+
+ // The number type label comes first (e.g., "Mobile", "Work", "Home", etc).
String numberTypeLabel = row.getNumberAttributes().getNumberTypeLabel();
- if (!TextUtils.isEmpty(numberTypeLabel)) {
+ secondaryText.append(numberTypeLabel);
+
+ // Add video call info if applicable.
+ if ((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) {
if (secondaryText.length() > 0) {
secondaryText.append(", ");
}
- secondaryText.append(numberTypeLabel);
- } else if (!row.getNumberAttributes().getIsSpam()) {
- // Don't show the location if there's a number type label or the number is spam.
+
+ boolean isDuoCall =
+ DuoConstants.PHONE_ACCOUNT_COMPONENT_NAME
+ .flattenToString()
+ .equals(row.getPhoneAccountComponentName());
+ secondaryText.append(
+ context.getText(
+ isDuoCall ? R.string.new_call_log_duo_video : R.string.new_call_log_carrier_video));
+ }
+
+ // Show the location if
+ // (1) there is no number type label, and
+ // (2) the number is not spam.
+ if (TextUtils.isEmpty(numberTypeLabel) && !row.getNumberAttributes().getIsSpam()) {
String location = row.getGeocodedLocation();
if (!TextUtils.isEmpty(location)) {
if (secondaryText.length() > 0) {
@@ -207,6 +222,7 @@ public final class CallLogEntryText {
secondaryText.append(location);
}
}
+
return secondaryText;
}
diff --git a/java/com/android/dialer/calllogutils/res/values/strings.xml b/java/com/android/dialer/calllogutils/res/values/strings.xml
index f536ca66d..bc19ce22a 100644
--- a/java/com/android/dialer/calllogutils/res/values/strings.xml
+++ b/java/com/android/dialer/calllogutils/res/values/strings.xml
@@ -131,8 +131,11 @@
<!-- String to be displayed to indicate in the call log that a call just now occurred. -->
<string name="just_now">Just now</string>
- <!-- Text to show in call log for a video call. [CHAR LIMIT=16] -->
- <string name="new_call_log_video">Video</string>
+ <!-- Text to show in call log for a carrier video call. [CHAR LIMIT=30] -->
+ <string name="new_call_log_carrier_video">Carrier video</string>
+
+ <!-- Text to show in call log for a duo video call. [CHAR LIMIT=30] -->
+ <string name="new_call_log_duo_video">Duo video</string>
<!-- String used to display calls from unknown numbers in the call log. [CHAR LIMIT=30] -->
<string name="new_call_log_unknown">Unknown</string>