Tweaks to the voicemail TOS UI

• moved scrollbar to edge of screen
• changed divider to .5dp and added shadow
• change "DECLINE" to "NO THANKS" for verizon TOS (it already was that way for non-verizon)
• changed "ACCEPT" button to "TURN ON" text
• increased the bottom bar height
• made the google transcription text in the TOS bold
• add an image to the non-verizon TOS screen (just using test image for now)

i didn't add the 'Learn more' link, since its not ready yet.

verizon screen shot:
https://drive.google.com/open?id=0B9o_KvtLkcuIcVk0dHBtWmFfdjJWQVV3OEdVc0JXN01XZHQ4

non-verizon screen shot:
https://drive.google.com/open?id=0B9o_KvtLkcuIci1OMlVXTHVuMGYwMWZVTS01dGVwMUpLdmRr

Bug: 62375681
Test: manual and updated unit tests
PiperOrigin-RevId: 160006810
Change-Id: Id45a3a848bb219a70fddbb5a7ada29cd39e604a9
diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailErrorAlert.java b/java/com/android/dialer/app/voicemail/error/VoicemailErrorAlert.java
index d045b1b..dbdf0f0 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.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 @@
     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 a0dd30f..92c787d 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 @@
   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 @@
     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 cf6564a..56de4e9 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.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 @@
                   }
                 },
                 true /* raised */))
-        .setModal(true);
+        .setModal(true)
+        .setImageResourceId(getTosImageId());
   }
 
   private void showDeclineTosDialog(final PhoneAccountHandle handle) {
@@ -274,17 +278,32 @@
     }
   }
 
-  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 @@
         ? 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 0000000..681c795
--- /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
new file mode 100644
index 0000000..2e076c6
--- /dev/null
+++ b/java/com/android/dialer/app/voicemail/error/res/drawable/voicemail_tos_image.png
Binary files differ
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 a082e8e..ec8abed 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 090311f..dd815ca 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 ad5240b..80349e1 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 @@
   </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 c4a8542..257e93d 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>