diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-24 18:03:44 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-24 18:03:44 +0000 |
commit | a53ed4f8e4302f8d01baa500731b76a730751d59 (patch) | |
tree | 4176c811250c7c46d39e2fd2a646f486656924ea /src | |
parent | 66e297ac1fa18ceef625ac2e61405e5a724a7e60 (diff) | |
parent | 5dfabdd77780e051b5ed8f25389863a0a464d3ac (diff) |
Merge "Show transcriptions in voicemail notifications." into mnc-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/DefaultVoicemailNotifier.java | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java index d43238a14..3d6eb0b87 100644 --- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java +++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java @@ -151,6 +151,12 @@ public class DefaultVoicemailNotifier { } } + // If there is only one voicemail, set its transcription as the "long text". + String transcription = null; + if (newCalls.length == 1) { + transcription = newCalls[0].transcription; + } + if (newCallUri != null && callToNotify == null) { Log.e(TAG, "The new call could not be found in the call log: " + newCallUri); } @@ -165,6 +171,7 @@ public class DefaultVoicemailNotifier { .setSmallIcon(icon) .setContentTitle(title) .setContentText(callers) + .setStyle(new Notification.BigTextStyle().bigText(transcription)) .setColor(resources.getColor(R.color.dialer_theme_color)) .setDefaults(callToNotify != null ? Notification.DEFAULT_ALL : 0) .setDeleteIntent(createMarkNewVoicemailsAsOldIntent()) @@ -207,15 +214,23 @@ public class DefaultVoicemailNotifier { public final int numberPresentation; public final String accountComponentName; public final String accountId; - - public NewCall(Uri callsUri, Uri voicemailUri, String number, - int numberPresentation, String accountComponentName, String accountId) { + public final String transcription; + + public NewCall( + Uri callsUri, + Uri voicemailUri, + String number, + int numberPresentation, + String accountComponentName, + String accountId, + String transcription) { this.callsUri = callsUri; this.voicemailUri = voicemailUri; this.number = number; this.numberPresentation = numberPresentation; this.accountComponentName = accountComponentName; this.accountId = accountId; + this.transcription = transcription; } } @@ -238,8 +253,13 @@ public class DefaultVoicemailNotifier { */ private static final class DefaultNewCallsQuery implements NewCallsQuery { private static final String[] PROJECTION = { - Calls._ID, Calls.NUMBER, Calls.VOICEMAIL_URI, Calls.NUMBER_PRESENTATION, - Calls.PHONE_ACCOUNT_COMPONENT_NAME, Calls.PHONE_ACCOUNT_ID + Calls._ID, + Calls.NUMBER, + Calls.VOICEMAIL_URI, + Calls.NUMBER_PRESENTATION, + Calls.PHONE_ACCOUNT_COMPONENT_NAME, + Calls.PHONE_ACCOUNT_ID, + Calls.TRANSCRIPTION }; private static final int ID_COLUMN_INDEX = 0; private static final int NUMBER_COLUMN_INDEX = 1; @@ -247,6 +267,7 @@ public class DefaultVoicemailNotifier { private static final int NUMBER_PRESENTATION_COLUMN_INDEX = 3; private static final int PHONE_ACCOUNT_COMPONENT_NAME_COLUMN_INDEX = 4; private static final int PHONE_ACCOUNT_ID_COLUMN_INDEX = 5; + private static final int TRANSCRIPTION_COLUMN_INDEX = 6; private final ContentResolver mContentResolver; @@ -281,10 +302,14 @@ public class DefaultVoicemailNotifier { Uri callsUri = ContentUris.withAppendedId( Calls.CONTENT_URI_WITH_VOICEMAIL, cursor.getLong(ID_COLUMN_INDEX)); Uri voicemailUri = voicemailUriString == null ? null : Uri.parse(voicemailUriString); - return new NewCall(callsUri, voicemailUri, cursor.getString(NUMBER_COLUMN_INDEX), + return new NewCall( + callsUri, + voicemailUri, + cursor.getString(NUMBER_COLUMN_INDEX), cursor.getInt(NUMBER_PRESENTATION_COLUMN_INDEX), cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME_COLUMN_INDEX), - cursor.getString(PHONE_ACCOUNT_ID_COLUMN_INDEX)); + cursor.getString(PHONE_ACCOUNT_ID_COLUMN_INDEX), + cursor.getString(TRANSCRIPTION_COLUMN_INDEX)); } } |