[2/2] OmniGears: Option to use volume keys to control media volume anytime

Change-Id: I1213a25bdbc5b5f4a81fc17f50a05761bbbf6614
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index 3d0c992..3e884aa 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -453,7 +453,6 @@
     <string name="app_details">App details</string>
     <string name="no_stat_because_reset">Create reset</string>
     <string name="no_stat_because_plugged">Unplug power</string>
-    <string name="no_stat_because_error">Error loading battery stats</string>
     <string name="no_states_file_found">No states file found. Are you sure your phone is
         compatible?\n\nIf you are running a custom ROM or kernel, try
         contacting its developer to inform him that the states file is not
@@ -481,4 +480,7 @@
     <string name="display_rotation_180_title">180 degrees</string>
     <string name="display_rotation_270_title">270 degrees</string>
     <string name="display_lockscreen_rotation_title">Lock screen</string>
+
+    <string name="volume_button_force_media_title">Force media volume</string>
+    <string name="volume_button_force_media_summary">Media volume will be changed by default</string>
 </resources>
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index 081dbbe..0c98ff3 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -65,11 +65,15 @@
             android:entries="@array/volume_key_cursor_control_entries"
             android:entryValues="@array/volume_key_cursor_control_values" /> -->
 
-        <CheckBoxPreference
+        <org.omnirom.omnigears.preference.SystemCheckBoxPreference
             android:key="swap_volume_buttons"
             android:title="@string/swap_volume_buttons_title"
-            android:summary="@string/swap_volume_buttons_summary"
-            android:persistent="false"/>
+            android:summary="@string/swap_volume_buttons_summary" />
+
+        <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+            android:key="volume_button_force_media"
+            android:title="@string/volume_button_force_media_title"
+            android:summary="@string/volume_button_force_media_summary" />
 
     </PreferenceCategory>
 
diff --git a/src/org/omnirom/omnigears/ButtonSettings.java b/src/org/omnirom/omnigears/ButtonSettings.java
index 4f69fdd..693b53c 100644
--- a/src/org/omnirom/omnigears/ButtonSettings.java
+++ b/src/org/omnirom/omnigears/ButtonSettings.java
@@ -73,7 +73,6 @@
 //    private static final String BUTTON_HOME_ANSWERS_CALL = "button_home_answers_call";
 //    private static final String BUTTON_VOLUME_DEFAULT = "button_volume_default_screen";
 //    private static final String VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control";
-    private static final String SWAP_VOLUME_BUTTONS = "swap_volume_buttons";
 //    private static final String CATEGORY_HEADSETHOOK = "button_headsethook";
 //    private static final String BUTTON_HEADSETHOOK_LAUNCH_VOICE = "button_headsethook_launch_voice";
 
@@ -123,7 +122,6 @@
     private CheckBoxPreference mVolumeWake;
 //    private CheckBoxPreference mHomeWake;
 //    private CheckBoxPreference mHomeAnswerCall;
-    private CheckBoxPreference mSwapVolumeButtons;
 //    private ListPreference mVolumeKeyCursorControl;
     private SwitchPreference mEnableCustomBindings;
 //    private ListPreference mBackPressAction;
@@ -196,9 +194,6 @@
 //          mVolumeDefault.setValue(Integer.toString(currentDefault));
 //          mVolumeDefault.setOnPreferenceChangeListener(this);
 */
-            mSwapVolumeButtons = (CheckBoxPreference) findPreference(SWAP_VOLUME_BUTTONS);
-            mSwapVolumeButtons.setChecked(Settings.System.getInt(resolver,
-                   Settings.System.SWAP_VOLUME_BUTTONS, 0) != 0);
 
 //          mVolumeKeyCursorControl = (ListPreference) findPreference(VOLUME_KEY_CURSOR_CONTROL);
 //          if (mVolumeKeyCursorControl != null) {
@@ -533,11 +528,6 @@
                     Settings.System.HARDWARE_KEYS_DISABLE, checked ? 1:0);
             //updateDisableHWKeyEnablement(checked);
             return true;
-         } else if (preference == mSwapVolumeButtons) {
-            boolean checked = ((CheckBoxPreference)preference).isChecked();
-            Settings.System.putInt(getContentResolver(),
-                    Settings.System.SWAP_VOLUME_BUTTONS, checked ? 1:0);
-            return true;
           }
 /*        } else if (preference == mHomeWake) {
             boolean checked = ((CheckBoxPreference)preference).isChecked();