Fix FDN back button, restyle screen.

While fixing the original, there was a bunch of jank and inconsistent
styling I noticed on some of the FDN settings screens, so I tried
to clean it up somewhat.

+ Fix non-functional button on the GetPin2Screen, which was the
original bug.
+ Fixed underline tint color on the GetPin2Screen.
+ Moved text labels into EditText hints on edit/pin2 screens.
+ Updated margin/alignments, consolidated layouts to be simpler.

Bug: 18410153
Bug: 19285837
Change-Id: I6748a924615120173fa3ced57ed01c68464c8044
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index bc84bf5..3be2bb0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -388,7 +388,7 @@
 
         <activity android:name="com.android.phone.settings.fdn.GetPin2Screen"
                 android:label="@string/get_pin2"
-                android:theme="@style/SettingsLight"
+                android:theme="@style/DialerSettingsLight"
                 android:windowSoftInputMode="stateVisible">
         </activity>
 
diff --git a/res/layout/edit_fdn_contact_screen.xml b/res/layout/edit_fdn_contact_screen.xml
index 0a99152..24e0c6b 100644
--- a/res/layout/edit_fdn_contact_screen.xml
+++ b/res/layout/edit_fdn_contact_screen.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.
@@ -14,78 +14,40 @@
      limitations under the License.
 -->
 
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/pinc"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="wrap_content"
+    android:layout_margin="16dp"
+    android:orientation="vertical"
+    android:gravity="center">
 
-    <!-- Keyboard Version -->
-    <!-- Modified for greater consistency with the rest of settings. -->
-    <LinearLayout android:id="@+id/pinc"
-        android:orientation="vertical"
+    <EditText android:id="@+id/fdn_name"
+        android:hint="@string/name"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+        android:layout_height="wrap_content"
+        android:inputType="textPersonName"
+        android:imeOptions="actionNext"
+        android:singleLine="true"
+        android:scrollHorizontally="true"
+        android:autoText="false"
+        android:capitalize="words" />
 
-        <LinearLayout
-            android:orientation="horizontal"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingTop="15dip"
-            android:paddingBottom="5dip">
+    <EditText android:id="@+id/fdn_number"
+        android:hint="@string/number"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:inputType="phone"
+        android:imeOptions="actionDone"
+        android:singleLine="true"
+        android:scrollHorizontally="true"
+        android:autoText="false"
+        android:capitalize="none" />
 
-            <TextView
-                android:layout_width="100dip"
-                android:layout_height="wrap_content"
-                android:paddingStart="10dip"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:text="@string/name" />
+    <Button android:id="@+id/button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:text="@string/save" />
 
-            <EditText android:id="@+id/fdn_name"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginEnd="10dip"
-                android:inputType="textPersonName"
-                android:imeOptions="actionNext"
-                android:singleLine="true"
-                android:scrollHorizontally="true"
-                android:autoText="false"
-                android:capitalize="words" />
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:orientation="horizontal"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingTop="5dip"
-            android:paddingBottom="5dip">
-
-            <TextView
-                android:layout_width="100dip"
-                android:layout_height="wrap_content"
-                android:paddingStart="10dip"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:text="@string/number" />
-
-            <EditText android:id="@+id/fdn_number"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginEnd="10dip"
-                android:inputType="phone"
-                android:imeOptions="actionDone"
-                android:singleLine="true"
-                android:scrollHorizontally="true"
-                android:autoText="false"
-                android:capitalize="none" />
-
-        </LinearLayout>
-
-        <Button android:id="@+id/button"
-            android:layout_marginTop="8dip"
-            android:layout_marginStart="10dip"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/save" />
-
-    </LinearLayout>
-
-</RelativeLayout>
+</LinearLayout>
diff --git a/res/layout/get_pin2_screen.xml b/res/layout/get_pin2_screen.xml
index 6268335..eecf736 100644
--- a/res/layout/get_pin2_screen.xml
+++ b/res/layout/get_pin2_screen.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.
@@ -14,47 +14,29 @@
      limitations under the License.
 -->
 
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/pinc"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="wrap_content"
+    android:layout_margin="16dp"
+    android:orientation="vertical"
+    android:gravity="center">
 
-    <!-- Keyboard Version -->
-    <!-- Modified for greater consistency with the rest of settings. -->
-    <LinearLayout android:id="@+id/pinc"
-        android:orientation="vertical"
+    <EditText android:id="@+id/pin"
+        android:hint="@string/enter_pin2_text"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="15dip"
-        android:layout_marginStart="15dip">
+        android:maxLines="1"
+        android:scrollHorizontally="true"
+        android:autoText="false"
+        android:capitalize="none"
+        android:password="true"
+        android:imeOptions="actionDone" />
 
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingBottom="5dip"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:text="@string/enter_pin2_text" />
+    <Button android:id="@+id/ok"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:text="@android:string/ok" />
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-            <EditText
-                android:id="@+id/pin"
-                android:layout_width="200dip"
-                android:layout_height="wrap_content"
-                android:maxLines="1"
-                android:scrollHorizontally="true"
-                android:autoText="false"
-                android:capitalize="none"
-                android:password="true"
-                android:imeOptions="actionDone" />
-
-            <Button
-                android:id="@+id/ok"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@android:string/ok"/>
-        </LinearLayout>
-    </LinearLayout>
-
-</RelativeLayout>
+</LinearLayout>
diff --git a/src/com/android/phone/settings/fdn/GetPin2Screen.java b/src/com/android/phone/settings/fdn/GetPin2Screen.java
index 5959a51..2394a69 100644
--- a/src/com/android/phone/settings/fdn/GetPin2Screen.java
+++ b/src/com/android/phone/settings/fdn/GetPin2Screen.java
@@ -25,6 +25,7 @@
 import android.text.method.DigitsKeyListener;
 import android.util.Log;
 import android.view.KeyEvent;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
 import android.widget.Button;
@@ -60,6 +61,15 @@
         mOkButton.setOnClickListener(mClicked);
     }
 
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            onBackPressed();
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
     private String getPin2() {
         return mPin2Field.getText().toString();
     }