From ae8144b6905143e0a8e5a6920b6ed8f60cf8b00e Mon Sep 17 00:00:00 2001 From: uabdullah Date: Fri, 2 Feb 2018 15:28:40 -0800 Subject: NUI VM Transcribed by Google UI Support Shows the "Transcribed by Google" logo for voicemails transcribed by Google Bug: 72491920 Test: Unit Tests PiperOrigin-RevId: 184343786 Change-Id: I9d662860e218ff555c65f667f4ee15015df47ab2 --- .../dialer/voicemail/listui/NewVoicemailViewHolder.java | 16 ++++++++++++++++ .../voicemail/listui/res/layout/new_voicemail_entry.xml | 10 ++++++++++ .../dialer/voicemail/listui/res/values/strings.xml | 3 +++ 3 files changed, 29 insertions(+) (limited to 'java') 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 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"/> + + Turn On + + Transcribed by Google + -- cgit v1.2.3