Convert the browser settings to be fragments.

This also makes the settings panel 2 pane.

Change-Id: Ifccfdc145065fc51f12b74160c797749063b403d
diff --git a/res/xml/advanced_preferences.xml b/res/xml/advanced_preferences.xml
new file mode 100644
index 0000000..075232d
--- /dev/null
+++ b/res/xml/advanced_preferences.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<PreferenceScreen
+        xmlns:android="http://schemas.android.com/apk/res/android">
+
+        <!-- Entries and values in this list are set dynamically. -->
+        <com.android.browser.search.SearchEnginePreference
+                android:key="search_engine"
+                android:title="@string/pref_content_search_engine"
+                android:defaultValue="google"
+                android:summary="@string/pref_content_search_engine_summary"
+                android:dialogTitle="@string/pref_content_search_engine" />
+
+        <PreferenceScreen
+              android:key="website_settings"
+              android:title="@string/pref_extras_website_settings"
+              android:summary="@string/pref_extras_website_settings_summary" />
+
+        <com.android.browser.BrowserYesNoPreference
+                android:key="reset_default_preferences"
+                android:title="@string/pref_extras_reset_default"
+                android:summary="@string/pref_extras_reset_default_summary"
+                android:dialogMessage="@string/pref_extras_reset_default_dlg" 
+                android:dialogTitle="@string/pref_extras_reset_default_dlg_title" 
+                android:dialogIcon="@android:drawable/ic_dialog_alert" />
+
+</PreferenceScreen>
diff --git a/res/xml/debug_preferences.xml b/res/xml/debug_preferences.xml
index c1ed1e6..54b2bd5 100644
--- a/res/xml/debug_preferences.xml
+++ b/res/xml/debug_preferences.xml
@@ -16,59 +16,54 @@
 
 <PreferenceScreen 
         xmlns:android="http://schemas.android.com/apk/res/android" >
-    <PreferenceCategory
-        android:title="@string/pref_development_title" 
-        android:key="debug_menu" >
 
-        <!-- The javascript console is enabled by default when the user has
-             also enabled debug mode by navigating to about:debug. -->
-        <CheckBoxPreference
-            android:key="javascript_console"
-            android:defaultValue="true"
-            android:title="@string/pref_development_error_console" />
-                        
-        <CheckBoxPreference
-            android:key="small_screen"
-            android:defaultValue="false"
-            android:title="@string/pref_development_single_column_rendering" />   
-
-        <CheckBoxPreference
-            android:key="wide_viewport"
-            android:defaultValue="true"
-            android:title="@string/pref_development_viewport" />
+    <!-- The javascript console is enabled by default when the user has
+         also enabled debug mode by navigating to about:debug. -->
+    <CheckBoxPreference
+        android:key="javascript_console"
+        android:defaultValue="true"
+        android:title="@string/pref_development_error_console" />
                     
-        <CheckBoxPreference
-            android:key="normal_layout"
-            android:defaultValue="false"
-            android:title="@string/pref_development_normal_rendering" />       
-        
-        <CheckBoxPreference
-            android:key="enable_tracing"
-            android:defaultValue="false"
-            android:title="@string/pref_development_trace" />
+    <CheckBoxPreference
+        android:key="small_screen"
+        android:defaultValue="false"
+        android:title="@string/pref_development_single_column_rendering" />   
+
+    <CheckBoxPreference
+        android:key="wide_viewport"
+        android:defaultValue="true"
+        android:title="@string/pref_development_viewport" />
+                
+    <CheckBoxPreference
+        android:key="normal_layout"
+        android:defaultValue="false"
+        android:title="@string/pref_development_normal_rendering" />       
     
-        <CheckBoxPreference
-            android:key="enable_light_touch"
-            android:defaultValue="false"
-            android:title="Enable light touch" />
+    <CheckBoxPreference
+        android:key="enable_tracing"
+        android:defaultValue="false"
+        android:title="@string/pref_development_trace" />
 
-        <CheckBoxPreference
-            android:key="enable_nav_dump"
-            android:defaultValue="false"
-            android:title="@string/pref_development_nav_dump" />
+    <CheckBoxPreference
+        android:key="enable_light_touch"
+        android:defaultValue="false"
+        android:title="Enable light touch" />
 
-        <EditTextPreference
-            android:key="js_engine_flags"
-            android:title="@string/js_engine_flags"
-            android:singleLine="true" />
+    <CheckBoxPreference
+        android:key="enable_nav_dump"
+        android:defaultValue="false"
+        android:title="@string/pref_development_nav_dump" />
 
-        <ListPreference
-            android:key="user_agent"
-            android:title="@string/pref_development_uastring"
-            android:entries="@array/pref_development_ua_choices"
-            android:entryValues="@array/pref_development_ua_values"
-            android:defaultValue="0"/>
+    <EditTextPreference
+        android:key="js_engine_flags"
+        android:title="@string/js_engine_flags"
+        android:singleLine="true" />
 
-    </PreferenceCategory>
+    <ListPreference
+        android:key="user_agent"
+        android:title="@string/pref_development_uastring"
+        android:entries="@array/pref_development_ua_choices"
+        android:entryValues="@array/pref_development_ua_values"
+        android:defaultValue="0"/>
 
 </PreferenceScreen>
diff --git a/res/xml/page_content_preferences.xml b/res/xml/page_content_preferences.xml
new file mode 100644
index 0000000..84497dc
--- /dev/null
+++ b/res/xml/page_content_preferences.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<PreferenceScreen
+        xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <ListPreference
+            android:key="text_size"
+            android:title="@string/pref_text_size"
+            android:defaultValue="NORMAL"
+            android:entries="@array/pref_text_size_choices"
+            android:entryValues="@array/pref_text_size_values"
+            android:dialogTitle="@string/pref_text_size_dialogtitle" />
+
+    <ListPreference
+            android:key="default_zoom"
+            android:title="@string/pref_default_zoom"
+            android:defaultValue="MEDIUM"
+            android:entries="@array/pref_default_zoom_choices"
+            android:entryValues="@array/pref_default_zoom_values"
+            android:dialogTitle="@string/pref_default_zoom_dialogtitle" />
+
+    <CheckBoxPreference
+            android:key="load_page"
+            android:defaultValue="true"
+            android:title="@string/pref_content_load_page"
+            android:summary="@string/pref_content_load_page_summary" />
+
+    <ListPreference
+            android:key="default_text_encoding"
+            android:title="@string/pref_default_text_encoding"
+            android:defaultValue="@string/pref_default_text_encoding_default"
+            android:entries="@array/pref_default_text_encoding_choices"
+            android:entryValues="@array/pref_default_text_encoding_values"
+            android:dialogTitle="@string/pref_default_text_encoding_dialogtitle" />
+
+    <CheckBoxPreference
+            android:key="block_popup_windows"
+            android:defaultValue="true"
+            android:title="@string/pref_content_block_popups" /> 
+
+    <CheckBoxPreference
+            android:key="load_images"
+            android:defaultValue="true"
+            android:title="@string/pref_content_load_images"
+            android:summary="@string/pref_content_load_images_summary" />   
+
+    <CheckBoxPreference
+            android:key="autofit_pages"
+            android:defaultValue="true"
+            android:title="@string/pref_content_autofit"
+            android:summary="@string/pref_content_autofit_summary" />  
+
+    <CheckBoxPreference
+            android:key="landscape_only"
+            android:defaultValue="false"
+            android:title="@string/pref_content_landscape_only"
+            android:summary="@string/pref_content_landscape_only_summary" />
+
+    <CheckBoxPreference
+            android:key="enable_javascript"
+            android:defaultValue="true"
+            android:title="@string/pref_content_javascript" />     
+
+    <ListPreference
+            android:key="plugin_state"
+            android:title="@string/pref_content_plugins"
+            android:defaultValue="ON"
+            android:entries="@array/pref_content_plugins_choices"
+            android:entryValues="@array/pref_content_plugins_values"
+            android:dialogTitle="@string/pref_content_plugins" />
+
+    <CheckBoxPreference
+            android:key="open_in_background"
+            android:defaultValue="false"
+            android:title="@string/pref_content_open_in_background"
+            android:summary="@string/pref_content_open_in_background_summary" />
+
+    <com.android.browser.BrowserHomepagePreference
+            android:key="homepage" 
+            android:title="@string/pref_content_homepage"
+            android:hint="@string/http"
+            android:inputType="textUri|textMultiLine" />
+
+</PreferenceScreen>
diff --git a/res/xml/preference_headers.xml b/res/xml/preference_headers.xml
new file mode 100644
index 0000000..54660b4
--- /dev/null
+++ b/res/xml/preference_headers.xml
@@ -0,0 +1,38 @@
+<?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.
+-->
+
+<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <header android:fragment="com.android.browser.preferences.PageContentPreferencesFragment"
+        android:title="@string/pref_content_title"
+    />
+<!--
+    <header android:fragment="com.example.android.apis.preference.PreferenceWithHeaders$Prefs2Fragment"
+        android:title="Personal settings"
+    </header>
+-->
+    <header android:fragment="com.android.browser.preferences.PrivacyPreferencesFragment"
+        android:title="@string/pref_privacy_title"
+    />
+    
+    <header android:fragment="com.android.browser.preferences.SecurityPreferencesFragment"
+        android:title="@string/pref_security_title"
+    />
+
+    <header android:fragment="com.android.browser.preferences.AdvancedPreferencesFragment"
+        android:title="@string/pref_extras_title"
+    />
+</preference-headers>
diff --git a/res/xml/privacy_preferences.xml b/res/xml/privacy_preferences.xml
new file mode 100644
index 0000000..f8a8d91
--- /dev/null
+++ b/res/xml/privacy_preferences.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<PreferenceScreen
+        xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <com.android.browser.BrowserYesNoPreference
+            android:key="privacy_clear_cache"
+            android:title="@string/pref_privacy_clear_cache"
+            android:summary="@string/pref_privacy_clear_cache_summary"
+            android:dialogMessage="@string/pref_privacy_clear_cache_dlg" 
+            android:dialogTitle="@string/clear" 
+            android:dialogIcon="@android:drawable/ic_dialog_alert" />
+            
+    <com.android.browser.BrowserYesNoPreference
+            android:key="privacy_clear_history"
+            android:title="@string/pref_privacy_clear_history"
+            android:summary="@string/pref_privacy_clear_history_summary"
+            android:dialogMessage="@string/pref_privacy_clear_history_dlg" 
+            android:dialogTitle="@string/clear" 
+            android:dialogIcon="@android:drawable/ic_dialog_alert"/>
+
+    <CheckBoxPreference
+            android:key="accept_cookies"
+            android:defaultValue="true"
+            android:title="@string/pref_security_accept_cookies"
+            android:summary="@string/pref_security_accept_cookies_summary" />
+            
+    <com.android.browser.BrowserYesNoPreference
+            android:key="privacy_clear_cookies"
+            android:title="@string/pref_privacy_clear_cookies"
+            android:summary="@string/pref_privacy_clear_cookies_summary"
+            android:dialogMessage="@string/pref_privacy_clear_cookies_dlg" 
+            android:dialogTitle="@string/clear" 
+            android:dialogIcon="@android:drawable/ic_dialog_alert"/>
+
+    <CheckBoxPreference
+            android:key="save_formdata"
+            android:defaultValue="true"
+            android:title="@string/pref_security_save_form_data"
+            android:summary="@string/pref_security_save_form_data_summary" />
+
+    <CheckBoxPreference
+            android:key="autoFill_enabled"
+            android:defaultValue="false"
+            android:title="@string/pref_autoFill_enabled"
+            android:summary="@string/pref_autoFill_enabled_summary" />
+
+    <com.android.browser.BrowserYesNoPreference
+            android:key="privacy_clear_form_data"
+            android:title="@string/pref_privacy_clear_form_data"
+            android:summary="@string/pref_privacy_clear_form_data_summary"
+            android:dialogMessage="@string/pref_privacy_clear_form_data_dlg" 
+            android:dialogTitle="@string/clear" 
+            android:dialogIcon="@android:drawable/ic_dialog_alert"/>
+
+    <CheckBoxPreference
+            android:key="enable_geolocation"
+            android:defaultValue="true"
+            android:title="@string/pref_privacy_enable_geolocation"
+            android:summary="@string/pref_privacy_enable_geolocation_summary" />
+
+    <com.android.browser.BrowserYesNoPreference
+            android:key="privacy_clear_geolocation_access"
+            android:dependency="enable_geolocation"
+            android:title="@string/pref_privacy_clear_geolocation_access"
+            android:summary="@string/pref_privacy_clear_geolocation_access_summary"
+            android:dialogMessage="@string/pref_privacy_clear_geolocation_access_dlg"
+            android:dialogTitle="@string/clear"
+            android:dialogIcon="@android:drawable/ic_dialog_alert"/>
+
+</PreferenceScreen>
diff --git a/res/xml/security_preferences.xml b/res/xml/security_preferences.xml
new file mode 100644
index 0000000..8d4464b
--- /dev/null
+++ b/res/xml/security_preferences.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 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.
+-->
+
+<PreferenceScreen
+        xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <CheckBoxPreference
+            android:key="remember_passwords"
+            android:defaultValue="true"
+            android:title="@string/pref_security_remember_passwords"
+            android:summary="@string/pref_security_remember_passwords_summary" />
+
+    <com.android.browser.BrowserYesNoPreference
+            android:key="privacy_clear_passwords"
+            android:title="@string/pref_privacy_clear_passwords"
+            android:summary="@string/pref_privacy_clear_passwords_summary"
+            android:dialogMessage="@string/pref_privacy_clear_passwords_dlg" 
+            android:dialogTitle="@string/clear" 
+            android:dialogIcon="@android:drawable/ic_dialog_alert"/>
+            
+    <CheckBoxPreference
+            android:key="show_security_warnings"
+            android:defaultValue="true"
+            android:title="@string/pref_security_show_security_warning"
+            android:summary="@string/pref_security_show_security_warning_summary" />
+
+</PreferenceScreen>