CMParts: Add volume button call answer switch
Change-Id: I1231a2f13360ed8ba1f2ab929c7791dd4d32522f
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a9a23da..1f20c87 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -197,6 +197,8 @@
<string name="swap_volume_buttons_title">Reorient</string>
<string name="swap_volume_buttons_summary">Swap volume buttons when the screen is rotated</string>
<string name="button_wake_title">Wake up device</string>
+ <string name="volume_answer_call_title">Answer call</string>
+ <string name="volume_answer_call_summary">Answer incoming calls by pressing the volume buttons</string>
<string name="home_answer_call_title">Answer call</string>
<string name="home_answer_call_summary">Pressing the home button will answer the current incoming call</string>
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index c587fca..a4b4c9f 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -257,6 +257,12 @@
android:defaultValue="false" />
<cyanogenmod.preference.CMSystemSettingSwitchPreference
+ android:key="volume_answer_call"
+ android:title="@string/volume_answer_call_title"
+ android:summary="@string/volume_answer_call_summary"
+ android:defaultValue="false" />
+
+ <cyanogenmod.preference.CMSystemSettingSwitchPreference
android:key="volbtn_music_controls"
android:title="@string/volbtn_music_controls_title"
android:summary="@string/volbtn_music_controls_summary"
diff --git a/src/org/cyanogenmod/cmparts/input/ButtonSettings.java b/src/org/cyanogenmod/cmparts/input/ButtonSettings.java
index 9dd4a9c..5c8b9de 100644
--- a/src/org/cyanogenmod/cmparts/input/ButtonSettings.java
+++ b/src/org/cyanogenmod/cmparts/input/ButtonSettings.java
@@ -403,6 +403,11 @@
volumeCategory.removePreference(findPreference(CMSettings.System.VOLUME_WAKE_SCREEN));
}
+ if (!TelephonyUtils.isVoiceCapable(getActivity())) {
+ volumeCategory.removePreference(
+ findPreference(CMSettings.System.VOLUME_ANSWER_CALL));
+ }
+
int cursorControlAction = Settings.System.getInt(resolver,
Settings.System.VOLUME_KEY_CURSOR_CONTROL, 0);
mVolumeKeyCursorControl = initActionList(KEY_VOLUME_KEY_CURSOR_CONTROL,