summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
diff options
context:
space:
mode:
authorBrandon Maxwell <maxwelb@google.com>2015-10-12 12:09:12 -0700
committerBrandon Maxwell <maxwelb@google.com>2015-10-14 15:00:07 -0700
commita482522fb8fe4e9959c749f4ec616ae59cf06b28 (patch)
treeca01e28fb44e1af4b37dd691c79a5cbf51da4825 /src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
parent975d2d46ac7148a86065ebf5987bc9aa2365d251 (diff)
Moving call type/location for voicemail
Combination of two related bugs. 22168682: In the voicemail call log, moved call type/location to below the call action button and removed the call details button as it didn't have any additional information. 22514722: Modified spacing and text sizes for call log. Moved voicemail transcription below call date as in mocks. Bug:22168682,22514722 Change-Id: I557761b815604fee4e6b61f4670608b8fa90d3a7
Diffstat (limited to 'src/com/android/dialer/calllog/PhoneCallDetailsHelper.java')
-rw-r--r--src/com/android/dialer/calllog/PhoneCallDetailsHelper.java45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java b/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
index 37920565a..b16079a9c 100644
--- a/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
@@ -16,6 +16,7 @@
package com.android.dialer.calllog;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import android.content.Context;
@@ -50,6 +51,9 @@ public class PhoneCallDetailsHelper {
private final Resources mResources;
/** The injected current time in milliseconds since the epoch. Used only by tests. */
private Long mCurrentTimeMillisForTest;
+
+ private CharSequence mPhoneTypeLabelForTest;
+
private final TelecomCallLogCache mTelecomCallLogCache;
/** Calendar used to construct dates */
@@ -138,12 +142,9 @@ public class PhoneCallDetailsHelper {
views.nameView.setText(nameText);
- if (isVoicemail && !TextUtils.isEmpty(details.transcription)) {
- views.voicemailTranscriptionView.setText(details.transcription);
- views.voicemailTranscriptionView.setVisibility(View.VISIBLE);
- } else {
- views.voicemailTranscriptionView.setText(null);
- views.voicemailTranscriptionView.setVisibility(View.GONE);
+ if (isVoicemail) {
+ views.voicemailTranscriptionView.setText(TextUtils.isEmpty(details.transcription) ? null
+ : details.transcription);
}
// Bold if not read
@@ -151,10 +152,14 @@ public class PhoneCallDetailsHelper {
views.nameView.setTypeface(typeface);
views.voicemailTranscriptionView.setTypeface(typeface);
views.callLocationAndDate.setTypeface(typeface);
+ views.callLocationAndDate.setTextColor(mResources.getColor(
+ details.isRead ? R.color.call_log_detail_color : R.color.call_log_unread_text_color,
+ mContext.getTheme()));
}
/**
- * Builds a string containing the call location and date.
+ * Builds a string containing the call location and date. For voicemail logs only the call date
+ * is returned because location information is displayed in the call action button
*
* @param details The call details.
* @return The call location and date string.
@@ -162,15 +167,18 @@ public class PhoneCallDetailsHelper {
private CharSequence getCallLocationAndDate(PhoneCallDetails details) {
mDescriptionItems.clear();
- // Get type of call (ie mobile, home, etc) if known, or the caller's location.
- CharSequence callTypeOrLocation = getCallTypeOrLocation(details);
+ if (details.callTypes[0] != Calls.VOICEMAIL_TYPE) {
+ // Get type of call (ie mobile, home, etc) if known, or the caller's location.
+ CharSequence callTypeOrLocation = getCallTypeOrLocation(details);
- // Only add the call type or location if its not empty. It will be empty for unknown
- // callers.
- if (!TextUtils.isEmpty(callTypeOrLocation)) {
- mDescriptionItems.add(callTypeOrLocation);
+ // Only add the call type or location if its not empty. It will be empty for unknown
+ // callers.
+ if (!TextUtils.isEmpty(callTypeOrLocation)) {
+ mDescriptionItems.add(callTypeOrLocation);
+ }
}
- // The date of this call, relative to the current time.
+
+ // The date of this call
mDescriptionItems.add(getCallDate(details));
// Create a comma separated list from the call type or location, and call date.
@@ -197,8 +205,8 @@ public class PhoneCallDetailsHelper {
} else if (!(details.numberType == Phone.TYPE_CUSTOM
&& TextUtils.isEmpty(details.numberLabel))) {
// Get type label only if it will not be "Custom" because of an empty number label.
- numberFormattedLabel = Phone.getTypeLabel(
- mResources, details.numberType, details.numberLabel);
+ numberFormattedLabel = MoreObjects.firstNonNull(mPhoneTypeLabelForTest,
+ Phone.getTypeLabel(mResources, details.numberType, details.numberLabel));
}
}
@@ -208,6 +216,11 @@ public class PhoneCallDetailsHelper {
return numberFormattedLabel;
}
+ @NeededForTesting
+ public void setPhoneTypeLabelForTest(CharSequence phoneTypeLabel) {
+ this.mPhoneTypeLabelForTest = phoneTypeLabel;
+ }
+
/**
* Get the call date/time of the call. For the call log this is relative to the current time.
* e.g. 3 minutes ago. For voicemail, see {@link #getGranularDateTime(PhoneCallDetails)}