diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-24 18:23:39 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-06-24 18:23:39 +0000 |
commit | 5619ed66afe6fc0001e44bcbbdc88424f850aa15 (patch) | |
tree | 057a193fb860893cfbaa2ba804dc79c4374d927d /src | |
parent | 7c751d9a04c8e00c0ea282d07b611898d12adb69 (diff) | |
parent | 219b61b32d9d88bdb8c1ae93a230466d07cbf190 (diff) |
am 219b61b3: am a53ed4f8: Merge "Show transcriptions in voicemail notifications." into mnc-dev
* commit '219b61b32d9d88bdb8c1ae93a230466d07cbf190':
Show transcriptions in voicemail notifications.
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)); } } |