diff options
author | Sarmad Hashmi <mhashmi@google.com> | 2016-01-22 13:07:32 -0800 |
---|---|---|
committer | Sarmad Hashmi <mhashmi@google.com> | 2016-02-24 21:26:58 +0000 |
commit | 5d9fdc591a5e8b5b8b0cbb1d9060f10fc2816325 (patch) | |
tree | 09d251a70e1b93ad5dea94b0b888321feeb21ccc /src/com | |
parent | 450a605729a2d45710e988e5ff4855eb36137e8f (diff) |
Collapsed and expanded voicemail cards show duration.
The duration of the voicemail is appended to the date in a MM:SS format.
BUG=25728257
Change-Id: I9c3e392336877c2ca69707e14c6ab2eed6f2e7c6
(cherry picked from commit 3f70c27d80b2e3176159f561248f95612d66afe2)
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/dialer/calllog/PhoneCallDetailsHelper.java | 32 |
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); } } |