Refactor settings top level activities to use fragments.

Added a base class SettingsPreferenceFragment from which the settings activities should
be derived so that they can behave like fragments. It contains some commonly called
utility methods and dialog conversion to DialogFragment.

Some of the top-level activities can be launched directly without the left pane.
Settings.java acts as a proxy activity that contains just that settings fragment without
the left pane.

There are still a lot of second and third level activities that need to be fragmentized.
This is just the first pass to test the 2-pane layout.
diff --git a/res/layout-xlarge/settings_top_level.xml b/res/layout-xlarge/settings_top_level.xml
new file mode 100644
index 0000000..09590b1
--- /dev/null
+++ b/res/layout-xlarge/settings_top_level.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<!-- Top-level Settings layout with fragments. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <fragment class="com.android.settings.Settings$TopLevelSettings"
+            android:id="@+id/top_level"
+            android:layout_width="0px"
+            android:layout_height="match_parent"
+            android:layout_weight=".4" 
+            android:layout_marginRight="10dp"/>
+    <FrameLayout android:id="@+id/prefs"
+            android:layout_width="0px"
+            android:layout_height="match_parent"
+            android:layout_weight=".6" />
+</LinearLayout>
diff --git a/res/layout/preference_icon.xml b/res/layout/preference_icon.xml
index e51a73b..51612ce 100644
--- a/res/layout/preference_icon.xml
+++ b/res/layout/preference_icon.xml
@@ -21,7 +21,7 @@
     android:id="@+android:id/widget_frame"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:minHeight="56dp"
     android:gravity="center_vertical"
     android:paddingRight="?android:attr/scrollbarSize">
     
diff --git a/res/layout/settings_top_level.xml b/res/layout/settings_top_level.xml
new file mode 100644
index 0000000..1ee6c9f
--- /dev/null
+++ b/res/layout/settings_top_level.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<!-- Top-level Settings layout with fragments. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <FrameLayout android:id="@+id/prefs"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            />
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5283414..8c2aead 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1274,9 +1274,9 @@
     <!-- About phone screen, summary of the item to go into the phone status screen -->
     <string name="device_status_summary">Phone number, signal, etc.</string>
     <!-- Main settings screen item's title to go into the SD card and storage settings screen-->
-    <string name="storage_settings">SD card &amp; phone storage</string>
+    <string name="storage_settings">Storage</string>
     <!-- SD card and storage settings screen title -->
-    <string name="storage_settings_title">SD card &amp; phone storage settings</string>
+    <string name="storage_settings_title">Storage settings</string>
     <!-- Main settings screen item's summary for the SD card and storage settings -->
     <string name="storage_settings_summary">Unmount SD card, view available storage</string>
     <!-- Do not translate. About phone, status item title -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 7beab15..f82af85 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -15,7 +15,8 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+        android:title="@string/accessibility_settings_title">
 
     <CheckBoxPreference
             android:key="toggle_accessibility_service_checkbox"
diff --git a/res/xml/device_info_memory.xml b/res/xml/device_info_memory.xml
index 785fded..c3d7a24 100644
--- a/res/xml/device_info_memory.xml
+++ b/res/xml/device_info_memory.xml
@@ -14,7 +14,8 @@
      limitations under the License.
 -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/storage_settings_title">
 
     <PreferenceCategory android:title="@string/sd_memory">
         <Preference android:key="memory_sd_size" 
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index 3b94680..edcfc6c 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -15,7 +15,8 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+        android:title="@string/language_keyboard_settings_title">
 
     <PreferenceScreen
             android:key="phone_language"
diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml
index 7ac14dc..742c621 100644
--- a/res/xml/privacy_settings.xml
+++ b/res/xml/privacy_settings.xml
@@ -14,7 +14,8 @@
      limitations under the License.
 -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/privacy_settings_title">
 
     <PreferenceCategory android:key="backup_category"
             android:title="@string/backup_section_title">
diff --git a/res/xml/security_settings.xml b/res/xml/security_settings.xml
index 29244f7..d0e200a5 100644
--- a/res/xml/security_settings.xml
+++ b/res/xml/security_settings.xml
@@ -14,7 +14,8 @@
      limitations under the License.
 -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/location_security_settings_title">
 
     <PreferenceCategory
         android:key="location_category"
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 326c494..7ec40ec 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -34,15 +34,16 @@
             <intent android:action="com.android.settings.MANUFACTURER_APPLICATION_SETTING" />
         </com.android.settings.IconPreferenceScreen>
 
+        <!-- Wireless controls -->
+
         <com.android.settings.IconPreferenceScreen
             android:title="@string/radio_controls_title"
+            android:fragment="com.android.settings.WirelessSettings"
             settings:icon="@drawable/ic_settings_wireless">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.WirelessSettings" />
         </com.android.settings.IconPreferenceScreen>
 
+        <!-- Call settings - this is in the phone process -->
+
         <com.android.settings.IconPreferenceScreen
             android:key="call_settings"
             settings:icon="@drawable/ic_settings_call"
@@ -57,46 +58,34 @@
 
         <com.android.settings.IconPreferenceScreen
             settings:icon="@drawable/ic_settings_sound"
+            android:fragment="com.android.settings.SoundSettings"
             android:title="@string/sound_settings_title">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.SoundSettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Display -->
 
         <com.android.settings.IconPreferenceScreen
             settings:icon="@drawable/ic_settings_display"
+            android:fragment="com.android.settings.DisplaySettings"
             android:title="@string/display_settings_title">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.DisplaySettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Security & Location -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.SecuritySettings"
             settings:icon="@drawable/ic_settings_security"
             android:title="@string/security_settings_title"
             android:key="security_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.SecuritySettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Application Settings -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.ApplicationSettings"
             settings:icon="@drawable/ic_settings_applications"
             android:title="@string/applications_settings"
             android:key="applications_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.ApplicationSettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Data Sync. The settings activity will ensure this is resolved to an
@@ -113,23 +102,18 @@
         <!-- Privacy -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.PrivacySettings"
             settings:icon="@drawable/ic_settings_privacy"
             android:title="@string/privacy_settings"
             android:key="privacy_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.PrivacySettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Storage -->
 
         <com.android.settings.IconPreferenceScreen 
+            android:fragment="com.android.settings.deviceinfo.Memory"
             settings:icon="@drawable/ic_settings_storage"
             android:title="@string/storage_settings">
-            <intent android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.deviceinfo.Memory" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Search. 
@@ -150,68 +134,50 @@
         <!-- Language -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.LanguageSettings"
             settings:icon="@drawable/ic_settings_language"
             android:title="@string/language_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.LanguageSettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Voice input & output -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.VoiceInputOutputSettings"
             settings:icon="@drawable/ic_settings_speech"
             android:title="@string/voice_input_output_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.VoiceInputOutputSettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Accessibility feedback -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.AccessibilitySettings"
             settings:icon="@drawable/ic_settings_accessibility"
             android:title="@string/accessibility_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.AccessibilitySettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Dock -->
 
         <com.android.settings.IconPreferenceScreen
             android:key="dock_settings"
+            android:fragment="com.android.settings.DockSettings"
             settings:icon="@drawable/ic_settings_dock"
             android:title="@string/dock_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.DockSettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- Date & Time -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.DateTimeSettings"
             settings:icon="@drawable/ic_settings_date_time"
             android:title="@string/date_and_time_settings_title">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.DateTimeSettings" />
         </com.android.settings.IconPreferenceScreen>
 
         <!-- About Device -->
 
         <com.android.settings.IconPreferenceScreen
+            android:fragment="com.android.settings.DeviceInfoSettings"
             settings:icon="@drawable/ic_settings_about"
             android:title="@string/about_settings">
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.DeviceInfoSettings" />
         </com.android.settings.IconPreferenceScreen>
 
 </PreferenceScreen>
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index 8573ed0..66508e7 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -14,7 +14,8 @@
      limitations under the License.
 -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/wireless_networks_settings_title">
 
     <CheckBoxPreference
         android:key="toggle_airplane"
@@ -36,7 +37,7 @@
         android:summary="@string/wifi_settings_summary" >
         <intent
             android:action="android.intent.action.MAIN"
-            android:targetPackage="com.android.settings"
+            android:targetPackage="com.android.settings"                
             android:targetClass="com.android.settings.wifi.WifiSettings" />
     </PreferenceScreen>