diff options
Diffstat (limited to 'java')
9 files changed, 143 insertions, 21 deletions
diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailErrorAlert.java b/java/com/android/dialer/app/voicemail/error/VoicemailErrorAlert.java index d045b1bd3..dbdf0f067 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailErrorAlert.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailErrorAlert.java @@ -20,6 +20,7 @@ import android.content.Context; import android.support.annotation.VisibleForTesting; import android.text.util.Linkify; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import com.android.dialer.app.alert.AlertManager; import com.android.dialer.app.voicemail.error.VoicemailErrorMessage.Action; @@ -132,6 +133,13 @@ public class VoicemailErrorAlert { TextView secondaryButton = (TextView) view.findViewById(R.id.voicemail_tos_button_accept); secondaryButton.setText(secondaryAction.getText()); secondaryButton.setOnClickListener(secondaryAction.getListener()); + + if (message.getImageResourceId() != null) { + ImageView voicemailTosImage = (ImageView) view.findViewById(R.id.voicemail_image); + voicemailTosImage.setImageResource(message.getImageResourceId()); + voicemailTosImage.setVisibility(View.VISIBLE); + } + return view; } diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java b/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java index a0dd30f0b..92c787d2d 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java @@ -47,6 +47,7 @@ public class VoicemailErrorMessage { private final List<Action> actions; private boolean modal; + private Integer imageResourceId; /** Something the user can click on to resolve an error, such as retrying or calling voicemail */ public static class Action { @@ -100,6 +101,16 @@ public class VoicemailErrorMessage { return this; } + @Nullable + public Integer getImageResourceId() { + return imageResourceId; + } + + public VoicemailErrorMessage setImageResourceId(Integer imageResourceId) { + this.imageResourceId = imageResourceId; + return this; + } + public VoicemailErrorMessage(CharSequence title, CharSequence description, Action... actions) { this(title, description, Arrays.asList(actions)); } diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java index cf6564a74..56de4e91a 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java @@ -22,10 +22,13 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Typeface; import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; +import android.text.SpannableString; +import android.text.style.StyleSpan; import android.view.View; import android.view.View.OnClickListener; import com.android.contacts.common.compat.TelephonyManagerCompat; @@ -114,7 +117,8 @@ public class VoicemailTosMessageCreator { } }, true /* raised */)) - .setModal(true); + .setModal(true) + .setImageResourceId(getTosImageId()); } private void showDeclineTosDialog(final PhoneAccountHandle handle) { @@ -274,17 +278,32 @@ public class VoicemailTosMessageCreator { } } - private String getTosTitle() { + private CharSequence getTosTitle() { return isVvm3() ? context.getString(R.string.verizon_terms_and_conditions_title) : context.getString(R.string.dialer_terms_and_conditions_title); } - private String getTosMessage() { - return isVvm3() - ? context.getString( - R.string.verizon_terms_and_conditions_message, getDialerTos(), getVvm3Tos()) - : context.getString(R.string.dialer_terms_and_conditions_message, getDialerTos()); + private CharSequence getTosMessage() { + if (isVvm3()) { + // For verizon the TOS consist of three pieces: google dialer TOS, Verizon TOS message and + // Verizon TOS details. + CharSequence vvm3Details = getVvm3Tos(); + CharSequence tos = + context.getString( + R.string.verizon_terms_and_conditions_message, getDialerTos(), vvm3Details); + // Make all text bold except the details. + SpannableString spannableTos = new SpannableString(tos); + spannableTos.setSpan(new StyleSpan(Typeface.BOLD), 0, tos.length() - vvm3Details.length(), 0); + return spannableTos; + } else { + // The TOS for everyone else there are no details, so just make everything bold. + CharSequence tos = + context.getString(R.string.dialer_terms_and_conditions_message, getDialerTos()); + SpannableString spannableTos = new SpannableString(tos); + spannableTos.setSpan(new StyleSpan(Typeface.BOLD), 0, tos.length(), 0); + return spannableTos; + } } private int getTosDeclinedDialogMessageId() { @@ -298,4 +317,8 @@ public class VoicemailTosMessageCreator { ? R.string.verizon_terms_and_conditions_decline_dialog_downgrade : R.string.dialer_terms_and_conditions_decline_dialog_downgrade; } + + private Integer getTosImageId() { + return isVvm3() ? null : R.drawable.voicemail_tos_image; + } } diff --git a/java/com/android/dialer/app/voicemail/error/res/drawable/shadow.xml b/java/com/android/dialer/app/voicemail/error/res/drawable/shadow.xml new file mode 100644 index 000000000..681c795f5 --- /dev/null +++ b/java/com/android/dialer/app/voicemail/error/res/drawable/shadow.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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. +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="#42000000" /> +</shape> diff --git a/java/com/android/dialer/app/voicemail/error/res/drawable/voicemail_tos_image.png b/java/com/android/dialer/app/voicemail/error/res/drawable/voicemail_tos_image.png Binary files differnew file mode 100644 index 000000000..2e076c69a --- /dev/null +++ b/java/com/android/dialer/app/voicemail/error/res/drawable/voicemail_tos_image.png diff --git a/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml b/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml index a082e8e67..ec8abed6d 100644 --- a/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml +++ b/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml @@ -23,13 +23,21 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:paddingStart="16dp" - android:paddingEnd="16dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" android:orientation="vertical"> + <ImageView + android:id="@+id/voicemail_image" + android:layout_width="@dimen/voicemail_tos_image_size" + android:layout_height="@dimen/voicemail_tos_image_size" + android:layout_gravity="center" + android:paddingTop="24dp" + android:visibility="gone" + android:importantForAccessibility="no"/> <TextView android:id="@+id/tos_message_title" android:textStyle="bold" @@ -53,8 +61,9 @@ <View android:layout_width="match_parent" - android:layout_height="1dp" - android:background="#D2D2D2"/> + android:layout_height="0.5dp" + android:elevation="1dp" + android:background="@drawable/shadow"/> <LinearLayout android:id="@+id/voicemail_tos_button" @@ -62,10 +71,12 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" android:orientation="horizontal"> <TextView android:id="@+id/voicemail_tos_button_decline" - style="@style/ErrorActionStyle" + style="@style/ErrorActionDeclineStyle" android:background="?android:attr/selectableItemBackground" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -76,7 +87,7 @@ android:layout_weight="1"/> <TextView android:id="@+id/voicemail_tos_button_accept" - style="@style/RaisedErrorActionStyle" + style="@style/ErrorActionStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/verizon_terms_and_conditions_accept_english"/> diff --git a/java/com/android/dialer/app/voicemail/error/res/values/dimens.xml b/java/com/android/dialer/app/voicemail/error/res/values/dimens.xml index 090311f15..dd815ca12 100644 --- a/java/com/android/dialer/app/voicemail/error/res/values/dimens.xml +++ b/java/com/android/dialer/app/voicemail/error/res/values/dimens.xml @@ -1,4 +1,20 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2017 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 + --> + <resources> <dimen name="alert_icon_size">24dp</dimen> <dimen name="alert_start_padding">16dp</dimen> @@ -22,4 +38,6 @@ <dimen name="voicemail_promo_card_line_spacing">4dp</dimen> <dimen name="voicemail_promo_card_title_text_size">16sp</dimen> <dimen name="voicemail_promo_card_message_size">14sp</dimen> -</resources>
\ No newline at end of file + + <dimen name="voicemail_tos_image_size">200dp</dimen> +</resources> diff --git a/java/com/android/dialer/app/voicemail/error/res/values/strings.xml b/java/com/android/dialer/app/voicemail/error/res/values/strings.xml index ad5240b9d..80349e168 100644 --- a/java/com/android/dialer/app/voicemail/error/res/values/strings.xml +++ b/java/com/android/dialer/app/voicemail/error/res/values/strings.xml @@ -174,16 +174,16 @@ Si no acepta todos estos términos y condiciones, no use el buzón de voz visual </string> <string translatable="false" name="dialer_terms_and_conditions_1.0_english"> - See and listen to your messages, without having to call voicemail.\n\nGet transcripts of your voicemail using Google’s transcription service. + See and listen to your messages, without having to call voicemail.\nGet transcripts of your voicemail using Google’s transcription service. </string> <string translatable="false" name="dialer_terms_and_conditions_1.0_spanish"> - ***TRANSLATE TO SPANISH***\nSee and listen to your messages, without having to call voicemail.\n\nGet transcripts of your voicemail using Google’s transcription service. + ***TRANSLATE TO SPANISH***\nSee and listen to your messages, without having to call voicemail.\nGet transcripts of your voicemail using Google’s transcription service. </string> - <string translatable="false" name="verizon_terms_and_conditions_accept_english">Accept</string> + <string translatable="false" name="verizon_terms_and_conditions_accept_english">Turn On</string> <string translatable="false" name="verizon_terms_and_conditions_accept_spanish">Aceptar</string> - <string translatable="false" name="verizon_terms_and_conditions_decline_english">Decline</string> + <string translatable="false" name="verizon_terms_and_conditions_decline_english">No Thanks</string> <string translatable="false" name="verizon_terms_and_conditions_decline_spanish">Rechazar</string> <string translatable="false" name="dialer_terms_and_conditions_accept_english">Turn On</string> diff --git a/java/com/android/dialer/app/voicemail/error/res/values/styles.xml b/java/com/android/dialer/app/voicemail/error/res/values/styles.xml index c4a8542f1..257e93d1b 100644 --- a/java/com/android/dialer/app/voicemail/error/res/values/styles.xml +++ b/java/com/android/dialer/app/voicemail/error/res/values/styles.xml @@ -1,6 +1,21 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- + ~ Copyright (C) 2017 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 + --> +<resources> <style name="ErrorActionStyle"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">48dp</item> @@ -9,7 +24,23 @@ <item name="android:paddingEnd">8dp</item> <item name="android:layout_marginStart">8dp</item> <item name="android:layout_marginEnd">8dp</item> - <item name="android:textColor">@color/dialtacts_theme_color</item> + <item name="android:textColor">@color/dialer_theme_color</item> + <item name="android:fontFamily">"sans-serif-medium"</item> + <item name="android:focusable">true</item> + <item name="android:singleLine">true</item> + <item name="android:textAllCaps">true</item> + <item name="android:textSize">14sp</item> + </style> + + <style name="ErrorActionDeclineStyle"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">48dp</item> + <item name="android:gravity">end|center_vertical</item> + <item name="android:paddingStart">8dp</item> + <item name="android:paddingEnd">8dp</item> + <item name="android:layout_marginStart">8dp</item> + <item name="android:layout_marginEnd">8dp</item> + <item name="android:textColor">@color/dialer_secondary_text_color</item> <item name="android:fontFamily">"sans-serif-medium"</item> <item name="android:focusable">true</item> <item name="android:singleLine">true</item> @@ -23,4 +54,4 @@ <item name="android:textSize">14sp</item> <item name="android:layout_height">@dimen/call_log_action_height</item> </style> -</resources>
\ No newline at end of file +</resources> |