From 2213f8e4a91bf5bd39e8f55554f7020f0e6b5792 Mon Sep 17 00:00:00 2001 From: uabdullah Date: Wed, 21 Mar 2018 15:58:49 -0700 Subject: Add learn more info to VM Transcription setting Updates the transcription setting from using a switch preference to a SwitchPreferenceWithClickableSummary. This allows the voicemail transcription setting preferences summary to be clicked and opened to the specified learn more url. Bug: 74033229 Test: Unit Tests PiperOrigin-RevId: 189983125 Change-Id: I1b162f3e2e582243fe8f84633e9401155170194c --- .../settings/VoicemailSettingsFragment.java | 20 ++++++++++++++++---- .../dialer/voicemail/settings/res/values/strings.xml | 2 +- .../settings/res/xml/voicemail_settings.xml | 5 +++-- 3 files changed, 20 insertions(+), 7 deletions(-) (limited to 'java') diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java index 2e76b70fe..007ab202d 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java @@ -75,7 +75,7 @@ public class VoicemailSettingsFragment extends PreferenceFragment // Settings that are supported by dialer only if the carrier configurations are valid. private SwitchPreference visualVoicemailPreference; private SwitchPreference voicemailAutoArchivePreference; - private SwitchPreference transcribeVoicemailPreference; + private SwitchPreferenceWithClickableSummary transcribeVoicemailPreference; // Voicemail transcription analysis toggle private SwitchPreferenceWithClickableSummary donateTranscribedVoicemailPreference; private Preference voicemailChangePinPreference; @@ -148,12 +148,24 @@ public class VoicemailSettingsFragment extends PreferenceFragment transcribeVoicemailPreference.setOnPreferenceChangeListener(this); transcribeVoicemailPreference.setChecked( voicemailClient.isVoicemailTranscriptionEnabled(getContext(), phoneAccountHandle)); - transcribeVoicemailPreference.setSummary( - R.string.voicemail_transcription_preference_summary_info); + transcribeVoicemailPreference.setSummary(getVoicemailTranscriptionInformationalText()); transcribeVoicemailPreference.setEnabled(true); getPreferenceScreen().addPreference(transcribeVoicemailPreference); } + /** + * Builds a spannable string containing the voicemail transcription informational text containing + * the appropriate "Learn More" urls. + * + * @return The voicemail transcription information text. + */ + private CharSequence getVoicemailTranscriptionInformationalText() { + return new ContentWithLearnMoreSpanner(getContext()) + .create( + getContext().getString(R.string.voicemail_transcription_preference_summary_info), + getContext().getString(R.string.transcription_learn_more_url)); + } + private void updateTranscriptionDonationPreference() { if (!VoicemailComponent.get(getContext()) .getVoicemailClient() @@ -231,7 +243,7 @@ public class VoicemailSettingsFragment extends PreferenceFragment voicemailAutoArchivePreference.setOrder(VMSettingOrdering.VOICEMAIL_AUTO_ARCHIVE); transcribeVoicemailPreference = - (SwitchPreference) + (SwitchPreferenceWithClickableSummary) findPreference(getString(R.string.voicemail_visual_voicemail_transcription_key)); transcribeVoicemailPreference.setOrder(VMSettingOrdering.VOICEMAIL_TRANSCRIPTION); diff --git a/java/com/android/dialer/voicemail/settings/res/values/strings.xml b/java/com/android/dialer/voicemail/settings/res/values/strings.xml index 7df8a0192..ad245ee47 100644 --- a/java/com/android/dialer/voicemail/settings/res/values/strings.xml +++ b/java/com/android/dialer/voicemail/settings/res/values/strings.xml @@ -119,7 +119,7 @@ Activating voicemail - Get transcripts of your voicemail using Google\'s transcription service. + Get transcripts of your voicemail using Google\'s transcription service. %1$s Let Google review your voicemail messages to improve transcription accuracy. Your voicemail messages are stored anonymously. %1$s diff --git a/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml b/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml index e5af813b6..fc839ee3e 100644 --- a/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml +++ b/java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml @@ -31,10 +31,11 @@ android:key="@string/voicemail_visual_voicemail_archive_key" android:title="@string/voicemail_visual_voicemail_auto_archive_switch_title"/>" - " + android:title="@string/voicemail_visual_voicemail_transcription_switch_title" + app:urlToOpen="@string/transcription_learn_more_url"/>