Restyle USSD AlertDialog.

+ Fix text color.
+ Tweak padding by adding FrameLayout and applying padding.
+ Change button colors to dialer blue.

Bug: 19015785
Change-Id: I2f5ace88897db728dd677786f2be744d91cdadf7
diff --git a/res/layout/dialog_ussd_response.xml b/res/layout/dialog_ussd_response.xml
index dabce3e..93efee3 100644
--- a/res/layout/dialog_ussd_response.xml
+++ b/res/layout/dialog_ussd_response.xml
@@ -4,9 +4,9 @@
      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.
@@ -19,7 +19,14 @@
      scrollView ScrollView, in the contentPanel LinearLayout, so it
      does not need to be replaced here.  For now, all we have is the
      input_field EditText to display user data entry. -->
-<EditText xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/input_field"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"/>
+    android:layout_height="wrap_content"
+    android:paddingStart="20dp"
+    android:paddingEnd="20dp">
+
+    <EditText android:id="@+id/input_field"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+</FrameLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 944bbee..3d1b1ad 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -183,6 +183,7 @@
     <style name="DialerAlertDialogTheme"
         parent="@android:style/Theme.Material.Light.Dialog">
         <item name="android:colorAccent">@color/dialer_theme_color</item>
+        <item name="android:textColor">?android:attr/textColorPrimaryInverseDisableOnly</item>
     </style>
 
     <style name="NetworkOperatorsSettingsTheme" parent="@android:style/Theme.Material.Light">
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 502a379..6b34208 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -38,6 +38,7 @@
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 import android.util.Log;
+import android.view.ContextThemeWrapper;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -1017,7 +1018,9 @@
                 //      time that a USSD should be canceled.
 
                 // inflate the layout with the scrolling text area for the dialog.
-                LayoutInflater inflater = (LayoutInflater) context.getSystemService(
+                ContextThemeWrapper contextThemeWrapper =
+                        new ContextThemeWrapper(context, R.style.DialerAlertDialogTheme);
+                LayoutInflater inflater = (LayoutInflater) contextThemeWrapper.getSystemService(
                         Context.LAYOUT_INFLATER_SERVICE);
                 View dialogView = inflater.inflate(R.layout.dialog_ussd_response, null);
 
@@ -1056,7 +1059,7 @@
                     };
 
                 // build the dialog
-                final AlertDialog newDialog = new AlertDialog.Builder(context, THEME)
+                final AlertDialog newDialog = new AlertDialog.Builder(contextThemeWrapper)
                         .setMessage(text)
                         .setView(dialogView)
                         .setPositiveButton(R.string.send_button, mUSSDDialogListener)
@@ -1092,6 +1095,11 @@
 
                 // now show the dialog!
                 newDialog.show();
+
+                newDialog.getButton(DialogInterface.BUTTON_POSITIVE)
+                        .setTextColor(context.getResources().getColor(R.color.dialer_theme_color));
+                newDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
+                        .setTextColor(context.getResources().getColor(R.color.dialer_theme_color));
             }
         }
     }