summaryrefslogtreecommitdiff
path: root/src/com/android/dialer
diff options
context:
space:
mode:
authorSarmad Hashmi <mhashmi@google.com>2016-02-09 23:44:54 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-02-09 23:44:54 +0000
commit6b6c6b756c54ef97c8ef6b445152dfaa1c42a5eb (patch)
treebbd99537e553a2834d01039b121ba75f63421ab5 /src/com/android/dialer
parente14ae7dd12e943e20a96798c53a7b1e0ddb18e42 (diff)
parent3f70c27d80b2e3176159f561248f95612d66afe2 (diff)
Merge "Collapsed and expanded voicemail cards show duration." into ub-contactsdialer-master-dev
Diffstat (limited to 'src/com/android/dialer')
-rw-r--r--src/com/android/dialer/calllog/PhoneCallDetailsHelper.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java b/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
index e6b850872..be02e4c1b 100644
--- a/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java
@@ -40,6 +40,7 @@ import com.android.dialer.util.DialerUtils;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.concurrent.TimeUnit;
/**
* Helper class to fill in the views in {@link PhoneCallDetailsViews}.
@@ -110,10 +111,8 @@ public class PhoneCallDetailsHelper {
callCount = null;
}
- CharSequence callLocationAndDate = getCallLocationAndDate(details);
-
- // Set the call count, location and date.
- setCallCountAndDate(views, callCount, callLocationAndDate);
+ // Set the call count, location, date and if voicemail, set the duration.
+ setDetailText(views, callCount, details);
// Set the account label if it exists.
String accountLabel = mCallLogCache.getAccountLabel(details.accountHandle);
@@ -314,10 +313,11 @@ public class PhoneCallDetailsHelper {
}
}
- /** Sets the call count and date. */
- private void setCallCountAndDate(PhoneCallDetailsViews views, Integer callCount,
- CharSequence dateText) {
+ /** Sets the call count, date, and if it is a voicemail, sets the duration. */
+ private void setDetailText(PhoneCallDetailsViews views, Integer callCount,
+ PhoneCallDetails details) {
// Combine the count (if present) and the date.
+ CharSequence dateText = getCallLocationAndDate(details);
final CharSequence text;
if (callCount != null) {
text = mResources.getString(
@@ -326,6 +326,22 @@ public class PhoneCallDetailsHelper {
text = dateText;
}
- views.callLocationAndDate.setText(text);
+ if (details.callTypes[0] == Calls.VOICEMAIL_TYPE) {
+ views.callLocationAndDate.setText(mResources.getString(
+ R.string.voicemailCallLogDateTimeFormatWithDuration, text,
+ getVoicemailDuration(details)));
+ } else {
+ views.callLocationAndDate.setText(text);
+ }
+
+ }
+
+ private String getVoicemailDuration(PhoneCallDetails details) {
+ long minutes = TimeUnit.SECONDS.toMinutes(details.duration);
+ long seconds = details.duration - TimeUnit.MINUTES.toSeconds(minutes);
+ if (minutes > 99) {
+ minutes = 99;
+ }
+ return mResources.getString(R.string.voicemailDurationFormat, minutes, seconds);
}
}