diff options
Diffstat (limited to 'java/com/android/dialer/app/calllog')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java | 25 | ||||
-rw-r--r-- | java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java | 42 |
2 files changed, 43 insertions, 24 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 60ed7dd09..ef6236bf0 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -781,19 +781,28 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder View transcriptContainerView = phoneCallDetailsViews.transcriptionView; TextView transcriptView = phoneCallDetailsViews.voicemailTranscriptionView; TextView transcriptBrandingView = phoneCallDetailsViews.voicemailTranscriptionBrandingView; - if (TextUtils.isEmpty(transcriptView.getText())) { - Assert.checkArgument(TextUtils.isEmpty(transcriptBrandingView.getText())); - } - if (!isExpanded || TextUtils.isEmpty(transcriptView.getText())) { + if (!isExpanded) { transcriptContainerView.setVisibility(View.GONE); return; } - transcriptContainerView.setVisibility(View.VISIBLE); - transcriptView.setVisibility(View.VISIBLE); + + boolean show = false; + if (TextUtils.isEmpty(transcriptView.getText())) { + transcriptView.setVisibility(View.GONE); + } else { + transcriptView.setVisibility(View.VISIBLE); + show = true; + } if (TextUtils.isEmpty(transcriptBrandingView.getText())) { - phoneCallDetailsViews.voicemailTranscriptionBrandingView.setVisibility(View.GONE); + transcriptBrandingView.setVisibility(View.GONE); } else { - phoneCallDetailsViews.voicemailTranscriptionBrandingView.setVisibility(View.VISIBLE); + transcriptBrandingView.setVisibility(View.VISIBLE); + show = true; + } + if (show) { + transcriptContainerView.setVisibility(View.VISIBLE); + } else { + transcriptContainerView.setVisibility(View.GONE); } } diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java index a6e8f10f0..189279edf 100644 --- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java +++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java @@ -146,31 +146,41 @@ public class PhoneCallDetailsHelper { if (isVoicemail) { int relevantLinkTypes = Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS | Linkify.WEB_URLS; views.voicemailTranscriptionView.setAutoLinkMask(relevantLinkTypes); - boolean showTranscriptBranding = false; + + String transcript = ""; + String branding = ""; if (!TextUtils.isEmpty(details.transcription)) { - views.voicemailTranscriptionView.setText(details.transcription); + transcript = details.transcription; // Set the branding text if the voicemail was transcribed by google // TODO(mdooley): the transcription state is only set by the google transcription code, // but a better solution would be to check the SOURCE_PACKAGE - showTranscriptBranding = - details.transcriptionState == VoicemailCompat.TRANSCRIPTION_AVAILABLE; + if (details.transcriptionState == VoicemailCompat.TRANSCRIPTION_AVAILABLE) { + branding = mResources.getString(R.string.voicemail_transcription_branding_text); + } } else { - if (details.transcriptionState == VoicemailCompat.TRANSCRIPTION_IN_PROGRESS) { - views.voicemailTranscriptionView.setText( - mResources.getString(R.string.voicemail_transcription_in_progress)); - } else if (details.transcriptionState == VoicemailCompat.TRANSCRIPTION_FAILED) { - views.voicemailTranscriptionView.setText( - mResources.getString(R.string.voicemail_transcription_failed)); + switch (details.transcriptionState) { + case VoicemailCompat.TRANSCRIPTION_IN_PROGRESS: + branding = mResources.getString(R.string.voicemail_transcription_in_progress); + break; + case VoicemailCompat.TRANSCRIPTION_FAILED_NO_SPEECH_DETECTED: + branding = mResources.getString(R.string.voicemail_transcription_failed_no_speech); + break; + case VoicemailCompat.TRANSCRIPTION_FAILED_LANGUAGE_NOT_SUPPORTED: + branding = + mResources.getString( + R.string.voicemail_transcription_failed_language_not_supported); + break; + case VoicemailCompat.TRANSCRIPTION_FAILED: + branding = mResources.getString(R.string.voicemail_transcription_failed); + break; + default: + break; // Fall through } } - if (showTranscriptBranding) { - views.voicemailTranscriptionBrandingView.setText( - mResources.getString(R.string.voicemail_transcription_branding_text)); - } else { - views.voicemailTranscriptionBrandingView.setText(""); - } + views.voicemailTranscriptionView.setText(transcript); + views.voicemailTranscriptionBrandingView.setText(branding); } // Bold if not read |