sanders: [SQUASHED] Refactor LineageActions and implement keyhandler

This adds support for FP and screen off gestures

Originally implemented in DU-MOD by @jhenrique09
Adapted to Oreo by @gregor160300 and @jhenrique09
This commit is contained in:
jhenrique09
2017-10-23 09:21:31 -03:00
committed by therootlord
parent 2741c07f99
commit c0c11cd323
31 changed files with 2084 additions and 381 deletions

View File

@@ -7,7 +7,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,157 +16,36 @@
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceCategory
android:key="actions_key"
android:title="@string/actions_title">
<SwitchPreference
android:key="gesture_camera_action"
android:defaultValue="true"
android:title="@string/camera_gesture_title"
android:summary="@string/camera_gesture_summary" />
<SwitchPreference
android:key="gesture_camera_action"
android:defaultValue="true"
android:title="@string/camera_gesture_title"
android:summary="@string/camera_gesture_summary" />
<SwitchPreference
android:key="gesture_chop_chop"
android:defaultValue="true"
android:title="@string/chop_chop_gesture_title"
android:summary="@string/chop_chop_gesture_summary" />
<SwitchPreference
android:key="gesture_chop_chop"
android:defaultValue="true"
android:title="@string/chop_chop_gesture_title"
android:summary="@string/chop_chop_gesture_summary" />
<SwitchPreference
android:key="gesture_ir_silencer"
android:defaultValue="false"
android:title="@string/hand_wave_silencer_title"
android:summary="@string/hand_wave_silencer_summary" />
<SwitchPreference
android:key="gesture_ir_silencer"
android:defaultValue="false"
android:title="@string/hand_wave_silencer_title"
android:summary="@string/hand_wave_silencer_summary" />
<SwitchPreference
android:key="gesture_flip_to_mute"
android:defaultValue="false"
android:title="@string/flip_to_mute_title"
android:summary="@string/flip_to_mute_summary" />
<SwitchPreference
android:key="gesture_flip_to_mute"
android:defaultValue="false"
android:title="@string/flip_to_mute_title"
android:summary="@string/flip_to_mute_summary" />
<SwitchPreference
android:key="gesture_lift_to_silence"
android:defaultValue="false"
android:title="@string/lift_to_silence_title"
android:summary="@string/lift_to_silence_summary" />
</PreferenceCategory>
<PreferenceCategory
android:key="fp_key"
android:title="@string/fingerprint_title" >
<SwitchPreference
android:key="fp_home"
android:title="Fingerprint Gestures"
android:summary="Use fingerprint gestures" />
<SwitchPreference
android:key="fp_home_scr_off"
android:dependency="fp_home"
android:title="Fingerprint Gestures when screen off"
android:summary="Use fingerprint gestures when screen off" />
<SwitchPreference
android:key="fp_haptic"
android:dependency="fp_home"
android:defaultValue="0"
android:title="Fingerprint Gestures Haptic Feedback"
android:summary="Vibrate on actions" />
</PreferenceCategory>
<PreferenceCategory
android:key="fp_keys_scr_on"
android:title="Screen On Gestures" >
<ListPreference
android:dependency="fp_home"
android:title="Fingerprint Tap"
android:summary="%s"
android:dialogTitle="Select action for single tap"
android:key="fp_keys"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="Fingerprint Long Press"
android:summary="%s"
android:dialogTitle="Select action for long press"
android:key="fp_key_hold"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="Fingerprint Swipe Left"
android:summary="%s"
android:dialogTitle="Select action for swipe left"
android:key="fp_key_left"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="Fingerprint Swipe Right"
android:summary="%s"
android:dialogTitle="Select action for swipe right"
android:key="fp_key_right"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
</PreferenceCategory>
<PreferenceCategory
android:key="fp_keys_scr_off"
android:title="Screen Off Gestures" >
<ListPreference
android:dependency="fp_home_scr_off"
android:title="Fingerprint Tap"
android:summary="%s"
android:dialogTitle="Select action for single tap"
android:key="fp_keys_off"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="Fingerprint Long Press"
android:summary="%s"
android:dialogTitle="Select action for long press"
android:key="fp_key_hold_off"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="Fingerprint Swipe Left"
android:summary="%s"
android:dialogTitle="Select action for swipe left"
android:key="fp_key_left_off"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="Fingerprint Swipe Right"
android:summary="%s"
android:dialogTitle="Select action for swipe right"
android:key="fp_key_right_off"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
</PreferenceCategory>
<SwitchPreference
android:key="gesture_lift_to_silence"
android:defaultValue="false"
android:title="@string/lift_to_silence_title"
android:summary="@string/lift_to_silence_summary" />
</PreferenceScreen>

View File

@@ -17,29 +17,24 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceCategory
android:key="ambient_display_key"
android:title="@string/ambient_display_title">
<SwitchPreference
android:key="doze_enabled"
android:defaultValue="true"
android:title="@string/ambient_display_enable_title"
android:summary="@string/ambient_display_enable_summary" />
<lineageos.preference.SecureSettingSwitchPreference
android:key="doze_enabled"
android:defaultValue="true"
android:title="@string/ambient_display_enable_title"
android:summary="@string/ambient_display_enable_summary" />
<SwitchPreference
android:key="gesture_pick_up"
android:defaultValue="true"
android:title="@string/pick_up_gesture_title"
android:summary="@string/pick_up_gesture_summary"
android:dependency="doze_enabled" />
<SwitchPreference
android:key="gesture_pick_up"
android:defaultValue="true"
android:title="@string/pick_up_gesture_title"
android:summary="@string/pick_up_gesture_summary"
android:dependency="doze_enabled" />
<SwitchPreference
android:key="gesture_hand_wave"
android:defaultValue="true"
android:title="@string/hand_wave_gesture_title"
android:summary="@string/hand_wave_gesture_summary"
android:dependency="doze_enabled" />
</PreferenceCategory>
<SwitchPreference
android:key="gesture_hand_wave"
android:defaultValue="true"
android:title="@string/hand_wave_gesture_title"
android:summary="@string/hand_wave_gesture_summary"
android:dependency="doze_enabled" />
</PreferenceScreen>

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 The CyanogenMod Project
Copyright (C) 2017 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License"
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<SwitchPreference
android:key="fp_home"
android:title="@string/fingerprint_gestures_title"
android:summary="@string/fingerprint_gestures_summary" />
<SwitchPreference
android:key="fp_home_scr_off"
android:dependency="fp_home"
android:enabled="false"
android:title="@string/fingerprint_gestures_screenoff_title"
android:summary="@string/fingerprint_gestures_screenoff_summary" />
<PreferenceCategory
android:key="fp_keys_scr_on"
android:title="@string/fingerprint_actions_screenon" >
<SwitchPreference
android:key="fp_haptic"
android:dependency="fp_home"
android:defaultValue="0"
android:title="@string/haptic_feedback"
android:summary="@string/haptic_feedback_summary" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_tap_dlg_title"
android:key="fp_keys"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_double_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_double_tap_dlg_title"
android:key="fp_key_dbltap"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_long_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_long_tap_dlg_title"
android:key="fp_key_hold"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_swipe_left_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_swipe_left_dlg_title"
android:key="fp_key_left"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
<ListPreference
android:dependency="fp_home"
android:title="@string/fingerprint_swipe_right_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_swipe_right_dlg_title"
android:key="fp_key_right"
android:defaultValue="0"
android:entries="@array/fp_keys_listArray"
android:entryValues="@array/fp_keys_listValues" />
</PreferenceCategory>
<PreferenceCategory
android:key="fp_keys_scr_off"
android:title="@string/fingerprint_actions_screenoff"
android:enabled="false" >
<SwitchPreference
android:key="fp_haptic_scr_off"
android:dependency="fp_home_scr_off"
android:defaultValue="0"
android:title="@string/haptic_feedback"
android:summary="@string/haptic_feedback_summary" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="@string/fingerprint_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_tap_dlg_title"
android:key="fp_keys_off"
android:defaultValue="0"
android:entries="@array/fp_keys_screen_off_listArray"
android:entryValues="@array/fp_keys_screen_off_listValues" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="@string/fingerprint_double_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_double_tap_dlg_title"
android:key="fp_key_dbltap_off"
android:defaultValue="0"
android:entries="@array/fp_keys_screen_off_listArray"
android:entryValues="@array/fp_keys_screen_off_listValues" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="@string/fingerprint_long_tap_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_long_tap_dlg_title"
android:key="fp_key_hold_off"
android:defaultValue="0"
android:entries="@array/fp_keys_screen_off_listArray"
android:entryValues="@array/fp_keys_screen_off_listValues" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="@string/fingerprint_swipe_left_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_swipe_left_dlg_title"
android:key="fp_key_left_off"
android:defaultValue="0"
android:entries="@array/fp_keys_screen_off_listArray"
android:entryValues="@array/fp_keys_screen_off_listValues" />
<ListPreference
android:dependency="fp_home_scr_off"
android:title="@string/fingerprint_swipe_right_title"
android:summary="%s"
android:dialogTitle="@string/fingerprint_swipe_right_dlg_title"
android:key="fp_key_right_off"
android:defaultValue="0"
android:entries="@array/fp_keys_screen_off_listArray"
android:entryValues="@array/fp_keys_screen_off_listValues" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 The CyanogenMod Project
Copyright (C) 2017 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License"
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceScreen
android:key="gestures"
android:title="@string/device_gestures_title"
android:summary="@string/device_gestures_summary"
android:icon="@drawable/ic_settings_gestures">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.GestureSettings" />
</PreferenceScreen>
<PreferenceScreen
android:key="doze"
android:title="@string/ambient_display_title"
android:summary="@string/ambient_display_manage_summary"
android:icon="@drawable/ic_settings_doze">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.DozeSettings" />
</PreferenceScreen>
<PreferenceScreen
android:key="fp_gestures"
android:title="@string/fingerprint_gestures_title"
android:summary="@string/fingerprint_gestures_manage_summary"
android:icon="@drawable/ic_settings_fingerprint">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.FPGestureSettings" />
</PreferenceScreen>
<PreferenceScreen
android:key="screen_off_gestures"
android:title="@string/screen_off_gestures_title"
android:summary="@string/screen_off_gestures_manage_summary"
android:icon="@drawable/ic_settings_screen_off_gestures">
<intent
android:targetPackage="org.lineageos.settings.device"
android:targetClass="org.lineageos.settings.device.ScreenOffGestureSettings" />
</PreferenceScreen>
</PreferenceScreen>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 The CyanogenMod Project
Copyright (C) 2017 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License"
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<SwitchPreference
android:key="tap_to_wake"
android:title="@string/tap_to_wake"
android:summary="@string/tap_to_wake_summary" />
<SwitchPreference
android:key="haptic_feedback"
android:title="@string/haptic_feedback"
android:summary="@string/haptic_feedback_summary" />
<ListPreference
android:title="@string/screen_off_gestures_swipe_left_title"
android:summary="%s"
android:dialogTitle="@string/screen_off_gestures_swipe_left_dlg_title"
android:key="screen_off_gestures_swipe_left"
android:defaultValue="0"
android:entries="@array/screen_off_listArray"
android:entryValues="@array/screen_off_listValues" />
<ListPreference
android:title="@string/screen_off_gestures_swipe_right_title"
android:summary="%s"
android:dialogTitle="@string/screen_off_gestures_swipe_right_dlg_title"
android:key="screen_off_gestures_swipe_right"
android:defaultValue="0"
android:entries="@array/screen_off_listArray"
android:entryValues="@array/screen_off_listValues" />
<ListPreference
android:title="@string/screen_off_gestures_swipe_up_title"
android:summary="%s"
android:dialogTitle="@string/screen_off_gestures_swipe_up_dlg_title"
android:key="screen_off_gestures_swipe_up"
android:defaultValue="0"
android:entries="@array/screen_off_listArray"
android:entryValues="@array/screen_off_listValues" />
<ListPreference
android:title="@string/screen_off_gestures_swipe_down_title"
android:summary="%s"
android:dialogTitle="@string/screen_off_gestures_swipe_down_dlg_title"
android:key="screen_off_gestures_swipe_down"
android:defaultValue="0"
android:entries="@array/screen_off_listArray"
android:entryValues="@array/screen_off_listValues" />
</PreferenceScreen>