Fixed a crash when loading Bluetooth Settings.

Bug: 17320674
Change-Id: Ibff0b5929b88b1a48c1fdd810fd8461bdb5f1274
diff --git a/res/layout/bluetooth_device_settings.xml b/res/layout/bluetooth_device_settings.xml
new file mode 100644
index 0000000..cc2cc09
--- /dev/null
+++ b/res/layout/bluetooth_device_settings.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:gravity="center">
+
+    <LinearLayout android:id="@+id/dialog_layout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:paddingBottom="@dimen/bluetooth_dialog_padding"
+            style="@style/bt_item" >
+
+            <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/bluetooth_preference_paired_dialog_name_label"
+                    android:textDirection="locale"
+                    android:textColor="?android:attr/colorAccent"
+                    style="@style/bt_item_label" />
+
+            <EditText android:id="@+id/name"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:inputType="textNoSuggestions"
+                    android:maxLength="@integer/bluetooth_name_length"
+                    android:singleLine="true"
+                    style="@style/bt_item_edit_content" />
+
+            <fragment android:id="@+id/bluetooth_fragment_settings"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    class="com.android.settings.bluetooth.DeviceProfilesSettings" />
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c3d2564..03a9fde 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -196,6 +196,29 @@
         <item name="android:textColor">?android:attr/colorAccent</item>
     </style>
 
+    <style name="bt_item">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_marginTop">8dip</item>
+        <item name="android:layout_marginStart">16dip</item>
+        <item name="android:layout_marginEnd">16dip</item>
+        <item name="android:orientation">vertical</item>
+        <item name="android:gravity">start</item>
+    </style>
+
+    <style name="bt_item_label">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:textSize">14sp</item>
+        <item name="android:textAlignment">viewStart</item>
+    </style>
+
+    <style name="bt_item_edit_content">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:textSize">18sp</item>
+    </style>
+
     <style name="wifi_item">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 054995b..ec288f3 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -393,7 +393,7 @@
             }
             if (profileFrag == null) {
                 LayoutInflater inflater = getActivity().getLayoutInflater();
-                mSettingsDialogView = inflater.inflate(R.layout.bluetooth_device_picker, null);
+                mSettingsDialogView = inflater.inflate(R.layout.bluetooth_device_settings, null);
                 profileFrag = (DeviceProfilesSettings)activity.getFragmentManager()
                     .findFragmentById(R.id.bluetooth_fragment_settings);
             }