summaryrefslogtreecommitdiffstats
path: root/java/com/android
diff options
context:
space:
mode:
authormdooley <mdooley@google.com>2018-02-20 17:19:45 -0800
committerEric Erfanian <erfanian@google.com>2018-02-22 21:10:20 +0000
commitfa95b2d3c5696790d2b174b0d42984341dfc80f2 (patch)
tree19b8f8e9ae303db8b971271fbdb65eb9e0db4e95 /java/com/android
parentf5326db368ba35faf861f690b09d0ea9c8d5080f (diff)
downloadandroid_packages_apps_Dialer-fa95b2d3c5696790d2b174b0d42984341dfc80f2.tar.gz
android_packages_apps_Dialer-fa95b2d3c5696790d2b174b0d42984341dfc80f2.tar.bz2
android_packages_apps_Dialer-fa95b2d3c5696790d2b174b0d42984341dfc80f2.zip
Adding information section to voicemail settings
this cl moves the TextViewPreference from dialer to third_party so it can be shared (sorry i meant to make that a separate cl, but forgot to switch branches). and it uses the TextViewPreference to add some informational text to the voicemail settings. screen shot: https://drive.google.com/open?id=0B9o_KvtLkcuIbENkeHRCSTUyOVpkM0JEZ0liMHphMnVzVHlN mock: https://drive.google.com/file/d/1gKt72pY-igXfphpamf8CqZV8HEmnOexj/view Bug: 37340510 Test: manual test PiperOrigin-RevId: 186388299 Change-Id: I2c142f1214a9424bec0bc7f12d841f0eeaef96f1
Diffstat (limited to 'java/com/android')
-rw-r--r--java/com/android/dialer/app/res/values/strings.xml4
-rw-r--r--java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java23
-rw-r--r--java/com/android/dialer/voicemail/settings/res/values/strings.xml16
-rw-r--r--java/com/android/dialer/voicemail/settings/res/xml/voicemail_settings.xml4
-rw-r--r--java/com/android/dialer/widget/TextViewPreference.java141
-rw-r--r--java/com/android/dialer/widget/res/layout/text_view_preference.xml24
6 files changed, 209 insertions, 3 deletions
diff --git a/java/com/android/dialer/app/res/values/strings.xml b/java/com/android/dialer/app/res/values/strings.xml
index 2d5542bbf..34ec611c3 100644
--- a/java/com/android/dialer/app/res/values/strings.xml
+++ b/java/com/android/dialer/app/res/values/strings.xml
@@ -686,8 +686,8 @@
<!-- Content of voicemail donation promo dialog
[CHAR LIMIT=NONE] -->
<string name="voicemail_donation_promo_content">
- Let Google review your voicemail messages to improve transcription quality. Your
- voicemail messages will not be tied to your Google Account.
+ Let Google review your voicemail messages to improve transcription quality.
+ For voicemail transcription analysis, your voicemail messages are stored anonymously.
</string>
<!-- Text for a 'learn more' link at the end of the voicemail donation promo dialog content -->
diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java
index 5ae26f5f7..7f5bb796a 100644
--- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java
+++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java
@@ -32,12 +32,14 @@ import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
+import android.text.Html;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import com.android.dialer.notification.NotificationChannelManager;
import com.android.dialer.telecom.TelecomUtil;
+import com.android.dialer.widget.TextViewPreference;
import com.android.voicemail.VoicemailClient;
import com.android.voicemail.VoicemailClient.ActivationStateListener;
import com.android.voicemail.VoicemailComponent;
@@ -73,6 +75,7 @@ public class VoicemailSettingsFragment extends PreferenceFragment
private SwitchPreference donateVoicemailSwitchPreference;
private Preference voicemailChangePinPreference;
private PreferenceScreen advancedSettings;
+ private TextViewPreference voicemailTranscriptionInstructionText;
@Override
public void onCreate(Bundle icicle) {
@@ -209,6 +212,10 @@ public class VoicemailSettingsFragment extends PreferenceFragment
return false;
}
});
+
+ voicemailTranscriptionInstructionText =
+ (TextViewPreference) findPreference(getString(R.string.voicemail_transcription_text_key));
+ voicemailTranscriptionInstructionText.setTitle(getVoicemailTranscriptionInstructionsText());
}
@Override
@@ -348,4 +355,20 @@ public class VoicemailSettingsFragment extends PreferenceFragment
builder.setCancelable(true);
builder.show();
}
+
+ /**
+ * Builds a spannable string containing the voicemail transcription instructions text containing
+ * the appropriate "Learn More" urls.
+ *
+ * @return The voicemail transcription instructions text.
+ */
+ private CharSequence getVoicemailTranscriptionInstructionsText() {
+ String settingText =
+ getString(
+ R.string.voicemail_transcription_instruction_text,
+ getString(R.string.transcription_learn_more_url),
+ getString(R.string.donation_learn_more_url));
+ CharSequence settingSeq = Html.fromHtml(settingText);
+ return settingSeq;
+ }
}
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 10fa459ff..47228b70b 100644
--- a/java/com/android/dialer/voicemail/settings/res/values/strings.xml
+++ b/java/com/android/dialer/voicemail/settings/res/values/strings.xml
@@ -44,7 +44,7 @@
<string name="voicemail_change_pin_key" translatable="false">voicemail_change_pin_key</string>
<!-- Visual voicemail on/off title [CHAR LIMIT=40] -->
- <string name="voicemail_visual_voicemail_switch_title">Visual Voicemail</string>
+ <string name="voicemail_visual_voicemail_switch_title">Visual voicemail</string>
<!-- Visual voicemail archive on/off title [CHAR LIMIT=40] -->
<string name="voicemail_visual_voicemail_auto_archive_switch_title">Extra backup and storage</string>
@@ -125,4 +125,18 @@
<!-- The label for the confirm-disable-voicemail button [CHAR LIMIT=16] -->
<string name="confirm_disable_voicemail_accept_dialog_label">TURN OFF</string>
+ <!-- Internal preferences key for static instruction text. -->
+ <string name="voicemail_transcription_text_key" translatable="false">voicemail_transcription_text_key</string>
+
+ <!-- Additional information text and links for visual voicemail and voicemail donation setting page
+ [CHAR LIMIT=NONE] -->
+ <string name="voicemail_transcription_instruction_text">
+ Visual voicemail allows you to check voicemail messages without having to call voicemail. Transcripts provided by Google. &lt;a href="<xliff:g example="http://www.google.com" id="url1">%1$s</xliff:g>">Learn&#160;more&lt;/a>
+ &lt;br>&lt;br>
+ For voicemail transcription analysis, your voicemail messages are stored anonymously. &lt;a href="<xliff:g example="http://www.google.com" id="url2">%2$s</xliff:g>">Learn&#160;more&lt;/a>
+ </string>
+
+ <string translatable="false" name="transcription_learn_more_url">https://support.google.com/phoneapp/answer/2811844?hl=en%26ref_topic=7539039</string>
+ <string translatable="false" name="donation_learn_more_url">https://support.google.com/phoneapp/answer/2811844#voicemail_transcript</string>
+
</resources>
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 9b0391ad4..75c8cfe2b 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
@@ -43,4 +43,8 @@
android:key="@string/voicemail_advanced_settings_key"
android:title="@string/voicemail_advanced_settings_title">
</PreferenceScreen>
+
+ <com.android.dialer.widget.TextViewPreference
+ android:key="@string/voicemail_transcription_text_key"/>
+
</PreferenceScreen>
diff --git a/java/com/android/dialer/widget/TextViewPreference.java b/java/com/android/dialer/widget/TextViewPreference.java
new file mode 100644
index 000000000..2c1885c4d
--- /dev/null
+++ b/java/com/android/dialer/widget/TextViewPreference.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dialer.widget;
+
+import android.content.Context;
+import android.preference.Preference;
+import android.text.method.LinkMovementMethod;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+
+/**
+ * Provides a {@link TextView} inside a preference. Useful for displaying static text which may
+ * contain hyperlinks.
+ */
+public class TextViewPreference extends Preference {
+
+ /**
+ * The resource ID of the text to be populated in the {@link TextView} when a resource ID is used.
+ */
+ private int textResourceId = 0;
+
+ /** The text to be populated in the {@link TextView} when a {@link CharSequence} is used. */
+ private CharSequence text;
+
+ /** The {@link TextView} containing the text. */
+ private TextView textView;
+
+ /**
+ * Instantiates the {@link TextViewPreference} instance.
+ *
+ * @param context The Context this is associated with, through which it can access the current
+ * theme, resources, etc.
+ * @param attrs The attributes of the XML tag that is inflating the preference.
+ * @param defStyleAttr An attribute in the current theme that contains a reference to a style
+ * resource that supplies default values for the view. Can be 0 to not look for defaults.
+ * @param defStyleRes A resource identifier of a style resource that supplies default values for
+ * the view, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not
+ * look for defaults.
+ */
+ public TextViewPreference(
+ Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+
+ setLayoutResource(R.layout.text_view_preference);
+ }
+
+ /**
+ * Instantiates the {@link TextViewPreference} instance.
+ *
+ * @param context The Context this is associated with, through which it can access the current
+ * theme, resources, etc.
+ * @param attrs The attributes of the XML tag that is inflating the preference.
+ * @param defStyleAttr An attribute in the current theme that contains a reference to a style
+ * resource that supplies default values for the view. Can be 0 to not look for defaults.
+ */
+ public TextViewPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
+ /**
+ * Instantiates the {@link TextViewPreference} instance.
+ *
+ * @param context The Context this is associated with, through which it can access the current
+ * theme, resources, etc.
+ * @param attrs The attributes of the XML tag that is inflating the preference.
+ */
+ public TextViewPreference(Context context, AttributeSet attrs) {
+ this(context, attrs, android.R.attr.preferenceStyle, 0);
+ }
+
+ /**
+ * Instantiates the {@link TextViewPreference} instance.
+ *
+ * @param context The Context this is associated with, through which it can access the current
+ * theme, resources, etc.
+ */
+ public TextViewPreference(Context context) {
+ super(context, null);
+
+ setLayoutResource(R.layout.text_view_preference);
+ }
+
+ /**
+ * Handles binding the preference.
+ *
+ * @param view The view.
+ */
+ @Override
+ protected void onBindView(View view) {
+ super.onBindView(view);
+ textView = (TextView) view.findViewById(R.id.text);
+ if (textResourceId != 0) {
+ setTitle(textResourceId);
+ } else if (text != null) {
+ setTitle(text);
+ }
+ }
+
+ /**
+ * Sets the preference title from a {@link CharSequence}.
+ *
+ * @param text The text.
+ */
+ @Override
+ public void setTitle(CharSequence text) {
+ textResourceId = 0;
+ this.text = text;
+ if (textView == null) {
+ return;
+ }
+
+ textView.setMovementMethod(LinkMovementMethod.getInstance());
+ textView.setText(text);
+ }
+
+ /**
+ * Sets the preference title from a resource id.
+ *
+ * @param textResId The string resource Id.
+ */
+ @Override
+ public void setTitle(int textResId) {
+ textResourceId = textResId;
+ setTitle(getContext().getString(textResId));
+ }
+}
diff --git a/java/com/android/dialer/widget/res/layout/text_view_preference.xml b/java/com/android/dialer/widget/res/layout/text_view_preference.xml
new file mode 100644
index 000000000..39b550657
--- /dev/null
+++ b/java/com/android/dialer/widget/res/layout/text_view_preference.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2018 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ android:fontFamily="sans-serif"
+ android:linksClickable="true"
+ android:singleLine="false"/>