diff --git a/res/drawable/ic_hardware_switch.xml b/res/drawable/ic_hardware_switch.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba19d31d4618c2a0452947b9ac589360aacf2b1a --- /dev/null +++ b/res/drawable/ic_hardware_switch.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/res/values/e_strings.xml b/res/values/e_strings.xml index 5c078ca778af67c8f9c893d3fe761a93caee516c..1363df3a88d82d4e130b0b82261b0a2f8865dd87 100644 --- a/res/values/e_strings.xml +++ b/res/values/e_strings.xml @@ -27,4 +27,9 @@ OpenKeychain + + + Hardware switch + Hardware switch + Configure the hardware switch diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml index 1e49cb982b5adb7f1f5b38a9176ef61aff1edc4e..de6f3391455b82e85555538d5c5ac04089ef7b5a 100644 --- a/res/xml/button_settings.xml +++ b/res/xml/button_settings.xml @@ -90,6 +90,21 @@ + + + + + + + + diff --git a/src/org/lineageos/lineageparts/input/ButtonSettings.java b/src/org/lineageos/lineageparts/input/ButtonSettings.java index d340836d6f0a076d346b384ab6dbcdbd3e5fc461..a37d6f7f748ac7fa4dcdf25f8728ca4f321d1dcd 100644 --- a/src/org/lineageos/lineageparts/input/ButtonSettings.java +++ b/src/org/lineageos/lineageparts/input/ButtonSettings.java @@ -101,6 +101,7 @@ public class ButtonSettings extends SettingsPreferenceFragment private static final String KEY_SWAP_CAPACITIVE_KEYS = "swap_capacitive_keys"; private static final String KEY_NAV_BAR_INVERSE = "sysui_nav_bar_inverse"; private static final String KEY_ENABLE_TASKBAR = "enable_taskbar"; + private static final String KEY_HARDWARE_SWITCH = "hardware_switch"; private static final String CATEGORY_POWER = "power_key"; private static final String CATEGORY_HOME = "home_key"; @@ -112,6 +113,7 @@ public class ButtonSettings extends SettingsPreferenceFragment private static final String CATEGORY_VOLUME = "volume_keys"; private static final String CATEGORY_NAVBAR = "navigation_bar_category"; private static final String CATEGORY_EXTRAS = "extras_category"; + private static final String CATEGORY_HARDWARE_SWITCH = "hardware_switch_category"; private ListPreference mBackLongPressAction; private ListPreference mHomeLongPressAction; @@ -185,6 +187,7 @@ public class ButtonSettings extends SettingsPreferenceFragment final PreferenceCategory volumeCategory = prefScreen.findPreference(CATEGORY_VOLUME); final PreferenceCategory cameraCategory = prefScreen.findPreference(CATEGORY_CAMERA); final PreferenceCategory extrasCategory = prefScreen.findPreference(CATEGORY_EXTRAS); + final PreferenceCategory hardwareSwitchCategory = prefScreen.findPreference(CATEGORY_HARDWARE_SWITCH); // Power button ends calls. mPowerEndCall = findPreference(KEY_POWER_END_CALL); @@ -207,6 +210,12 @@ public class ButtonSettings extends SettingsPreferenceFragment mNavigationPreferencesCat = findPreference(CATEGORY_NAVBAR); + Preference hardwareSwitchPref = findPreference(KEY_HARDWARE_SWITCH); + if (hardwareSwitchCategory != null + && (hardwareSwitchPref == null || !hardwareSwitchPref.isVisible())) { + prefScreen.removePreference(hardwareSwitchCategory); + } + Action defaultBackLongPressAction = Action.fromIntSafe(res.getInteger( org.lineageos.platform.internal.R.integer.config_longPressOnBackBehavior)); Action defaultHomeLongPressAction = Action.fromIntSafe(res.getInteger(