Implement click to take partial screenshot [2/3]
Change-Id: I187cb68947f6967e2993096108310648e1dc1b68
Signed-off-by: Jesse Chan <jc@lineageos.org>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c71739c..ad53e96 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -213,6 +213,8 @@
<string name="home_answer_call_summary">Answer incoming calls by pressing the home button</string>
<string name="extras_title">Extras</string>
<string name="additional_buttons_title">Additional buttons</string>
+ <string name="click_partial_screenshot_title">Click to partial screenshot</string>
+ <string name="click_partial_screenshot_summary">Short click Volume Down and Power to take partial screenshot</string>
<!-- Key backlight -->
<string name="button_backlight_title">Backlight</string>
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index d59e0ff..828c310 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -309,6 +309,12 @@
android:action="org.lineageos.settings.device.ADDITIONAL_BUTTONS_SETTINGS" />
</lineageos.preference.RemotePreference>
+ <lineageos.preference.LineageSystemSettingSwitchPreference
+ android:key="click_partial_screenshot"
+ android:title="@string/click_partial_screenshot_title"
+ android:summary="@string/click_partial_screenshot_summary"
+ android:defaultValue="false" />
+
</PreferenceCategory>
</PreferenceScreen>
diff --git a/src/org/lineageos/lineageparts/input/ButtonSettings.java b/src/org/lineageos/lineageparts/input/ButtonSettings.java
index 5d7ec41..b46a6f3 100644
--- a/src/org/lineageos/lineageparts/input/ButtonSettings.java
+++ b/src/org/lineageos/lineageparts/input/ButtonSettings.java
@@ -99,6 +99,8 @@
"torch_long_press_power_gesture";
private static final String KEY_TORCH_LONG_PRESS_POWER_TIMEOUT =
"torch_long_press_power_timeout";
+ private static final String KEY_CLICK_PARTIAL_SCREENSHOT =
+ "click_partial_screenshot";
private static final String CATEGORY_POWER = "power_key";
private static final String CATEGORY_HOME = "home_key";
@@ -110,6 +112,7 @@
private static final String CATEGORY_VOLUME = "volume_keys";
private static final String CATEGORY_BACKLIGHT = "key_backlight";
private static final String CATEGORY_NAVBAR = "navigation_bar_category";
+ private static final String CATEGORY_EXTRAS = "extras_category";
private ListPreference mHomeLongPressAction;
private ListPreference mHomeDoubleTapAction;
@@ -178,6 +181,7 @@
final PreferenceCategory appSwitchCategory = prefScreen.findPreference(CATEGORY_APPSWITCH);
final PreferenceCategory volumeCategory = prefScreen.findPreference(CATEGORY_VOLUME);
final PreferenceCategory cameraCategory = prefScreen.findPreference(CATEGORY_CAMERA);
+ final PreferenceCategory extrasCategory = prefScreen.findPreference(CATEGORY_EXTRAS);
// Power button ends calls.
mPowerEndCall = findPreference(KEY_POWER_END_CALL);
@@ -394,6 +398,8 @@
if (mVolumePanelOnLeft != null) {
mVolumePanelOnLeft.setChecked(volumePanelOnLeft);
}
+ } else {
+ extrasCategory.removePreference(findPreference(KEY_CLICK_PARTIAL_SCREENSHOT));
}
if (!hasVolumeKeys || volumeCategory.getPreferenceCount() == 0) {
prefScreen.removePreference(volumeCategory);
@@ -836,6 +842,7 @@
result.add(KEY_VOLUME_MUSIC_CONTROLS);
result.add(KEY_VOLUME_PANEL_ON_LEFT);
result.add(KEY_VOLUME_WAKE_SCREEN);
+ result.add(KEY_CLICK_PARTIAL_SCREENSHOT);
} else if (!DeviceUtils.canWakeUsingVolumeKeys(context)) {
result.add(KEY_VOLUME_WAKE_SCREEN);
}