summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/calllog
diff options
context:
space:
mode:
authorSarmad Hashmi <mhashmi@google.com>2016-02-10 02:11:09 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-10 02:11:09 +0000
commit569cb462299511dc2229ed15cfd8606ae249830c (patch)
tree1ef712e2e6374a6f20c33092d745dcf878bfe97b /src/com/android/dialer/calllog
parent9ba15b1a5ad47a69bf2b8654debddc3c27ae790c (diff)
parent6b6c6b756c54ef97c8ef6b445152dfaa1c42a5eb (diff)
Merge "Collapsed and expanded voicemail cards show duration." into ub-contactsdialer-master-dev
am: 6b6c6b756c * commit '6b6c6b756c54ef97c8ef6b445152dfaa1c42a5eb': Collapsed and expanded voicemail cards show duration.
Diffstat (limited to 'src/com/android/dialer/calllog')
-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);
}
}