add tap-swipe combo gestures (see #110)
Some checks failed
Android CI / build (push) Has been cancelled

This commit is contained in:
Josia Pietsch 2025-02-18 19:04:08 +01:00
parent 3aee137a3c
commit 86528f4e27
Signed by: jrpie
GPG key ID: E70B571D66986A2D
7 changed files with 59 additions and 7 deletions

View file

@ -59,6 +59,7 @@ The following gestures are available:
- swipe up / down / left / right,
- swipe with two fingers,
- swipe on the left / right resp. top / bottom edge,
- tap, then swipe up / down / left / right,
- draw < / > / V / Λ
- click on date / time,
- double click,

View file

@ -79,6 +79,13 @@ enum class Gesture(
R.array.default_up_right,
R.anim.bottom_up
),
TAP_AND_SWIPE_UP(
"action.tap_up",
R.string.settings_gesture_tap_up,
R.string.settings_gesture_description_tap_up,
R.array.default_up,
R.anim.bottom_up
),
SWIPE_UP_DOUBLE(
"action.double_up",
R.string.settings_gesture_double_up,
@ -107,6 +114,13 @@ enum class Gesture(
R.array.default_down_right,
R.anim.top_down
),
TAP_AND_SWIPE_DOWN(
"action.tap_down",
R.string.settings_gesture_tap_down,
R.string.settings_gesture_description_tap_down,
R.array.default_down,
R.anim.bottom_up
),
SWIPE_DOWN_DOUBLE(
"action.double_down",
R.string.settings_gesture_double_down,
@ -135,6 +149,13 @@ enum class Gesture(
R.array.default_messengers,
R.anim.right_left
),
TAP_AND_SWIPE_LEFT(
"action.tap_left",
R.string.settings_gesture_tap_left,
R.string.settings_gesture_description_tap_left,
R.array.default_messengers,
R.anim.right_left
),
SWIPE_LEFT_DOUBLE(
"action.double_left",
R.string.settings_gesture_double_left,
@ -163,6 +184,13 @@ enum class Gesture(
R.array.default_right_bottom,
R.anim.left_right
),
TAP_AND_SWIPE_RIGHT(
"action.tap_right",
R.string.settings_gesture_tap_right,
R.string.settings_gesture_description_tap_right,
R.array.default_right,
R.anim.left_right
),
SWIPE_RIGHT_DOUBLE(
"action.double_right",
R.string.settings_gesture_double_right,
@ -279,6 +307,17 @@ enum class Gesture(
}
}
fun getTapComboVariant(): Gesture {
return when (this) {
SWIPE_UP -> TAP_AND_SWIPE_UP
SWIPE_DOWN -> TAP_AND_SWIPE_DOWN
SWIPE_LEFT -> TAP_AND_SWIPE_LEFT
SWIPE_RIGHT -> TAP_AND_SWIPE_RIGHT
else -> this
}
}
fun isDoubleVariant(): Boolean {
return when (this) {
SWIPE_UP_DOUBLE,

View file

@ -240,6 +240,10 @@ class TouchGestureDetector(
gesture = gesture?.getEdgeVariant(Gesture.Edge.BOTTOM)
}
}
if (timeStart - lastTappedTime < 2 * DOUBLE_TAP_TIMEOUT) {
gesture = gesture?.getTapComboVariant()
}
gesture?.invoke(context)
}
}

View file

@ -29,18 +29,26 @@
<string name="settings_gesture_description_back">Back button / back gesture</string>
<string name="settings_gesture_up">Up</string>
<string name="settings_gesture_description_up">Swipe up</string>
<string name="settings_gesture_tap_up">Tap + Up</string>
<string name="settings_gesture_description_tap_up">Tap and swipe up</string>
<string name="settings_gesture_double_up">Double Up</string>
<string name="settings_gesture_description_double_up">Swipe up with two fingers</string>
<string name="settings_gesture_down">Down</string>
<string name="settings_gesture_description_down">Swipe down</string>
<string name="settings_gesture_tap_down">Tap + Down</string>
<string name="settings_gesture_description_tap_down">Tap and swipe down</string>
<string name="settings_gesture_double_down">Double Down</string>
<string name="settings_gesture_description_double_down">Swipe down with two fingers</string>
<string name="settings_gesture_left">Left</string>
<string name="settings_gesture_description_left">Swipe left</string>
<string name="settings_gesture_tap_left">Tap + Left</string>
<string name="settings_gesture_description_tap_left">Tap and swipe left</string>
<string name="settings_gesture_double_left">Double Left</string>
<string name="settings_gesture_description_double_left">Swipe left with two fingers</string>
<string name="settings_gesture_right">Right</string>
<string name="settings_gesture_description_right">Swipe right</string>
<string name="settings_gesture_tap_right">Tap + Right</string>
<string name="settings_gesture_description_tap_right">Tap and swipe right</string>
<string name="settings_gesture_double_right">Double Right</string>
<string name="settings_gesture_description_double_right">Swipe right with two fingers</string>
<string name="settings_gesture_right_top_edge">Right (Top)</string>
@ -62,19 +70,19 @@
<string name="settings_gesture_swipe_larger"><![CDATA[>]]></string>
<string name="settings_gesture_description_swipe_larger">Top left -> mid right -> bottom left</string>
<string name="settings_gesture_swipe_larger_reverse"><![CDATA[> (reverse)]]></string>
<string name="settings_gesture_swipe_larger_reverse"><![CDATA[> (Reverse)]]></string>
<string name="settings_gesture_description_swipe_larger_reverse">Bottom left -> mid right -> top left</string>
<string name="settings_gesture_swipe_smaller"><![CDATA[<]]></string>
<string name="settings_gesture_description_swipe_smaller">Top right -> mid left -> bottom right</string>
<string name="settings_gesture_swipe_smaller_reverse"><![CDATA[< (reverse)]]></string>
<string name="settings_gesture_swipe_smaller_reverse"><![CDATA[< (Reverse)]]></string>
<string name="settings_gesture_description_swipe_smaller_reverse">Bottom right -> mid left -> top right</string>
<string name="settings_gesture_swipe_v">V</string>
<string name="settings_gesture_description_swipe_v">Top left -> bottom mid -> top right</string>
<string name="settings_gesture_swipe_v_reverse">V (reverse)</string>
<string name="settings_gesture_swipe_v_reverse">V (Reverse)</string>
<string name="settings_gesture_description_swipe_v_reverse">Top right -> bottom mid -> top left</string>
<string name="settings_gesture_swipe_lambda">Λ</string>
<string name="settings_gesture_description_swipe_lambda">Bottom left -> top mid -> bottom right</string>
<string name="settings_gesture_swipe_lambda_reverse">Λ (reverse)</string>
<string name="settings_gesture_swipe_lambda_reverse">Λ (Reverse)</string>
<string name="settings_gesture_description_swipe_lambda_reverse">Bottom right -> top mid -> bottom left</string>
<string name="settings_gesture_vol_up">Volume Up</string>

View file

@ -11,7 +11,7 @@ Es handelt sich um einen Fork von <a href="https://f-droid.org/packages/com.finn
App Launcher</a>.
<b>Funktionen:</b>
* Aktionen können an 22 verschiedene Gesten gebunden werden.
* Aktionen können an 35 verschiedene Gesten gebunden werden.
* Die folgenden Aktionen stehen zur Verfügung:
- Eine App starten
- Alle Apps auflisten

View file

@ -10,7 +10,7 @@ This is a fork of the app <a href="https://f-droid.org/packages/com.finnmglas.la
by Finn M Glas.
Features:
* You can bind actions to 22 different gestures.
* You can bind actions to 35 different gestures.
* An action can be one of the following:
- Launch an app
- List all apps

View file

@ -10,7 +10,7 @@ O app é uma modificação do <a href="https://f-droid.org/packages/com.finnmgla
feito por Finn M Glas.
Funcionalidades:
* Você pode associar várias ações a 22 gestos diferentes.
* Você pode associar várias ações a 35 gestos diferentes.
* Pode definir algumas das seguintes ações:
- Iniciar vários apps
- Listar todos aplicativos