diff options
Diffstat (limited to 'java/com/android/dialer/voicemail/listui')
3 files changed, 29 insertions, 0 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java index 71c98031a..b0c07df66 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java @@ -43,6 +43,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener; import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutorComponent; +import com.android.dialer.compat.android.provider.VoicemailCompat; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.contactphoto.NumberAttributeConverter; import com.android.dialer.lettertile.LetterTileDrawable; @@ -58,6 +59,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On private final TextView primaryTextView; private final TextView secondaryTextView; private final TextView transcriptionTextView; + private final TextView transcriptionBrandingTextView; private final QuickContactBadge quickContactBadge; private final NewVoicemailMediaPlayerView mediaPlayerView; private final ImageView menuButton; @@ -76,6 +78,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On primaryTextView = view.findViewById(R.id.primary_text); secondaryTextView = view.findViewById(R.id.secondary_text); transcriptionTextView = view.findViewById(R.id.transcription_text); + transcriptionBrandingTextView = view.findViewById(R.id.transcription_branding); quickContactBadge = view.findViewById(R.id.quick_contact_photo); mediaPlayerView = view.findViewById(R.id.new_voicemail_media_player); menuButton = view.findViewById(R.id.menu_button); @@ -226,6 +229,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On String.valueOf(mediaPlayerView.getVoicemailUri()), String.valueOf(viewHolderVoicemailUri)); transcriptionTextView.setMaxLines(1); + transcriptionBrandingTextView.setVisibility(GONE); isViewHolderExpanded = false; mediaPlayerView.reset(); @@ -251,6 +255,8 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On secondaryTextView.setTypeface(null, Typeface.NORMAL); transcriptionTextView.setTypeface(null, Typeface.NORMAL); + transcriptionBrandingTextView.setVisibility(GONE); + mediaPlayerView.reset(); LogUtil.i( @@ -319,6 +325,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On transcriptionTextView.setMaxLines(999); isViewHolderExpanded = true; + updateBrandingText(voicemailEntry); // Once the media player is visible update its state mediaPlayerView.setVisibility(View.VISIBLE); mediaPlayerView.bindValuesFromAdapterOfExpandedViewHolderMediaPlayerView( @@ -333,6 +340,15 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On String.valueOf(mediaPlayerView.getVoicemailUri())); } + private void updateBrandingText(VoicemailEntry voicemailEntry) { + if (voicemailEntry.transcriptionState() == VoicemailCompat.TRANSCRIPTION_AVAILABLE + && !TextUtils.isEmpty(voicemailEntry.transcription())) { + transcriptionBrandingTextView.setVisibility(VISIBLE); + } else { + transcriptionBrandingTextView.setVisibility(GONE); + } + } + @WorkerThread private Integer markVoicemailAsRead(Pair<Context, Uri> contextUriPair) { Assert.isWorkerThread(); diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml index 95769fe32..6900627dd 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml @@ -82,6 +82,16 @@ android:layout_gravity="center_vertical" android:visibility="gone"/> + <TextView + android:id="@+id/transcription_branding" + style="@style/SecondaryText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/call_log_entry_photo_text_margin" + android:layout_gravity="center_vertical" + android:text="@string/voicemail_transcription_branding_text" + android:visibility="gone"/> + <com.android.dialer.voicemail.listui.NewVoicemailMediaPlayerView android:id="@+id/new_voicemail_media_player" android:layout_width="match_parent" diff --git a/java/com/android/dialer/voicemail/listui/res/values/strings.xml b/java/com/android/dialer/voicemail/listui/res/values/strings.xml index e7373d69f..db33c1909 100644 --- a/java/com/android/dialer/voicemail/listui/res/values/strings.xml +++ b/java/com/android/dialer/voicemail/listui/res/values/strings.xml @@ -54,4 +54,7 @@ If you do not accept all of these terms and conditions, do not use Visual Voice <string translatable="false" name="verizon_terms_and_conditions_accept_english">Turn On</string> + <!-- Label indicating who provided the voicemail transcription [CHAR LIMIT=64] --> + <string name="voicemail_transcription_branding_text">Transcribed by Google</string> + </resources> |