[2/2] OmniGears: easy switch to soft keys

make it easier to switch to soft keys for devices
with hw keys. this is already possible now but the
settings are spread in different categories and require
multiple steps and using the property qemu.hw.mainkeys

this adds two new settings
1) allow enabling navigation bar during runtime on devices
that dont have it already enabled in the config.
This replaces the usage of the property qemu.hq.mainkeys

2) allow disabling hw keys (actions, brightness, haptic feedback)
with a single setting. This requires that the device supports
config_button_brightness_support config_has_hardware_buttons
and config_deviceHardwareKeys

as part of this the button brightness settings screen
has been moved to a separate screen

TODO: disable google search on long press menu

Change-Id: I06eedf26abd2885b711321193e9a486c08a5e192
diff --git a/res/xml/bars_settings.xml b/res/xml/bars_settings.xml
index 7c873e2..2dba831 100644
--- a/res/xml/bars_settings.xml
+++ b/res/xml/bars_settings.xml
@@ -114,16 +114,19 @@
         <PreferenceScreen
             android:key="navigation_bar"
             android:fragment="org.omnirom.omnigears.interfacesettings.NavBar"
+            android:summary="@string/navigation_bar_summary"
             android:title="@string/navigation_bar_title" />
 
         <PreferenceScreen
             android:key="navigation_bar_dimen"
             android:fragment="org.omnirom.omnigears.interfacesettings.NavBarDimen"
+            android:summary="@string/navbar_dimen_summary"
             android:title="@string/navbar_dimen_title" />
 
         <PreferenceScreen
             android:key="navigation_ring"
             android:fragment="org.omnirom.omnigears.interfacesettings.NavRing"
+            android:summary="@string/navigation_ring_summary"
             android:title="@string/navigation_ring_title" />
 
         <CheckBoxPreference
diff --git a/res/xml/brightness_settings.xml b/res/xml/brightness_settings.xml
index 6c8d0a7..d0124db 100644
--- a/res/xml/brightness_settings.xml
+++ b/res/xml/brightness_settings.xml
@@ -17,7 +17,6 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
         android:title="@string/brightness"
-        android:key="backlight_settings"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
 
         <PreferenceCategory
@@ -28,7 +27,7 @@
                         android:title="@string/brightness"
                         android:persistent="false"/>
 
-                <Preference
+                <PreferenceScreen
                         android:key="screen_auto_brightness"
                         android:title="@string/screen_auto_brightness"
                         android:summary="@string/screen_auto_brighness_summary"/>
@@ -38,33 +37,12 @@
                 android:key="button_brightness_category"
                 android:title="@string/button_brightness_category">
 
-                <Preference
-                        android:key="button_auto_brightness"
-                        android:title="@string/button_auto_brightness"
-                        android:summary="@string/button_auto_brighness_summary"/>
-                <Preference
-                        android:key="button_manual_brightness"
-                        android:title="@string/button_manual_brightness"
-                        android:summary="@string/button_manual_brightness_summary"/>
-                <CheckBoxPreference
-                        android:key="button_no_brightness"
-                        android:title="@string/button_no_brightness"
-                        android:summary="@string/button_no_brightness_summary"
-                        android:persistent="false"/>
-                <CheckBoxPreference
-                        android:key="button_link_brightness"
-                        android:title="@string/button_link_brightness"
-                        android:summary="@string/button_link_brightness_summary"
-                        android:persistent="false"/>
-                <org.omnirom.omnigears.chameleonos.SeekBarPreference
-                        android:key="button_timeout"
-                        android:title="@string/button_timeout_title"
-                        android:summary="@string/button_timeout_summary"
-                        android:max="30"
-                        settings:min="0"
-                        settings:unitsLeft=""
-                        settings:unitsRight="@string/unit_sec"
-                        android:persistent="false" />
+                <PreferenceScreen
+                        android:key="button_brightness"
+                        android:title="@string/brightness"
+                        android:summary="@string/button_brightness_summary"
+                        android:fragment="org.omnirom.omnigears.brightness.ButtonBrightnessSettings" />
+
         </PreferenceCategory>
 
         <PreferenceCategory
diff --git a/res/xml/button_brightness_settings.xml b/res/xml/button_brightness_settings.xml
new file mode 100644
index 0000000..60d0095
--- /dev/null
+++ b/res/xml/button_brightness_settings.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--  Copyright (C) 2014 The OmniROM Project
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ -->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/button_brightness_title"
+        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+
+        <Preference
+                android:key="button_auto_brightness"
+                android:title="@string/button_auto_brightness"
+                android:summary="@string/button_auto_brighness_summary"/>
+        <Preference
+                android:key="button_manual_brightness"
+                android:title="@string/button_manual_brightness"
+                android:summary="@string/button_manual_brightness_summary"/>
+        <CheckBoxPreference
+                android:key="button_no_brightness"
+                android:title="@string/button_no_brightness"
+                android:summary="@string/button_no_brightness_summary"
+                android:persistent="false"/>
+        <CheckBoxPreference
+                android:key="button_link_brightness"
+                android:title="@string/button_link_brightness"
+                android:summary="@string/button_link_brightness_summary"
+                android:persistent="false"/>
+        <org.omnirom.omnigears.chameleonos.SeekBarPreference
+                android:key="button_timeout"
+                android:title="@string/button_timeout_title"
+                android:summary="@string/button_timeout_summary"
+                android:max="30"
+                settings:min="0"
+                settings:unitsLeft=""
+                settings:unitsRight="@string/unit_sec"
+                android:persistent="false" />
+</PreferenceScreen>
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index 8e3b781..c3396e2 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -69,6 +69,17 @@
         android:key="button_keys"
         android:title="@string/button_keys_title" >
 
+        <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+            android:key="navigation_bar_show"
+            android:title="@string/navigation_bar_show_title"
+            android:summary="@string/navigation_bar_show_summary" />
+
+        <CheckBoxPreference
+            android:key="hardware_keys_disable"
+            android:title="@string/hardware_keys_disable_title"
+            android:summary="@string/hardware_keys_disable_summary"
+            android:persistent="false"/>
+
         <CheckBoxPreference
             android:key="virtual_key_haptic_feedback"
             android:title="@string/virtual_key_haptic_feedback_title"
@@ -81,6 +92,12 @@
             android:summary="@string/force_show_overflow_menu_summary"
             android:persistent="false"/>
 
+        <PreferenceScreen
+            android:key="button_brightness"
+            android:title="@string/brightness"
+            android:summary="@string/button_brightness_summary"
+            android:fragment="org.omnirom.omnigears.brightness.ButtonBrightnessSettings" />
+
         <SwitchPreference
             android:key="keys_enable_custom"
             android:title="@string/keys_enable_custom_title"