Compare commits

..

8 commits

Author SHA1 Message Date
Too Late (bot)
87675b717a
Merge 232046e986 into 72f9c0595f 2025-03-16 00:07:23 +00:00
toolatebot
232046e986 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: jrpie-Launcher/Launcher
Translate-URL: https://toolate.othing.xyz/projects/jrpie-launcher/launcher/
2025-03-16 00:07:18 +00:00
toolatebot
ff108ee323 Update translation files
Updated by "Cleanup translation files" add-on in Weblate.

Translation: jrpie-Launcher/Launcher
Translate-URL: https://toolate.othing.xyz/projects/jrpie-launcher/launcher/
2025-03-16 00:07:18 +00:00
anmoti
943867d938 Translated using Weblate (Japanese)
Currently translated at 78.4% (200 of 255 strings)

Translation: jrpie-Launcher/Launcher
Translate-URL: https://toolate.othing.xyz/projects/jrpie-launcher/launcher/ja/
2025-03-16 00:07:18 +00:00
anmoti
59f4a29044 Translated using Weblate (Japanese)
Currently translated at 17.6% (3 of 17 strings)

Translation: jrpie-Launcher/metadata
Translate-URL: https://toolate.othing.xyz/projects/jrpie-launcher/metadata/ja/
2025-03-16 00:07:18 +00:00
class0068
bd70b822cf Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 98.4% (251 of 255 strings)

Translation: jrpie-Launcher/Launcher
Translate-URL: https://toolate.othing.xyz/projects/jrpie-launcher/launcher/zh_Hans/
2025-03-16 00:07:18 +00:00
72f9c0595f
handle MotionEvent.ACTION_CANCEL in TouchGestureDetector (see #126)
Some checks are pending
Android CI / build (push) Waiting to run
2025-03-15 19:23:51 +01:00
75b22400c5
try to fix #125 2025-03-15 17:24:19 +01:00
4 changed files with 28 additions and 8 deletions

View file

@ -87,24 +87,40 @@ class TouchGestureDetector(
} }
private var paths = HashMap<Int, PointerPath>() private var paths = HashMap<Int, PointerPath>()
private var gestureIsLongClick = false
/* Set when
* - the longPressHandler has detected this gesture as a long press
* - the gesture was cancelled by MotionEvent.ACTION_CANCEL
* In any case, the current gesture should be ignored by further detection logic.
*/
private var cancelled = false
private var lastTappedTime = 0L private var lastTappedTime = 0L
private var lastTappedLocation: Vector? = null private var lastTappedLocation: Vector? = null
fun onTouchEvent(event: MotionEvent) { fun onTouchEvent(event: MotionEvent) {
if (event.actionMasked == MotionEvent.ACTION_CANCEL) {
synchronized(this@TouchGestureDetector) {
cancelled = true
}
}
val pointerIdToIndex = val pointerIdToIndex =
(0..<event.pointerCount).associateBy { event.getPointerId(it) } (0..<event.pointerCount).associateBy { event.getPointerId(it) }
if (event.actionMasked == MotionEvent.ACTION_DOWN) { if (event.actionMasked == MotionEvent.ACTION_DOWN) {
synchronized(this@TouchGestureDetector) { synchronized(this@TouchGestureDetector) {
paths = HashMap() paths = HashMap()
gestureIsLongClick = false cancelled = false
} }
longPressHandler.postDelayed({ longPressHandler.postDelayed({
synchronized(this@TouchGestureDetector) { synchronized(this@TouchGestureDetector) {
if (cancelled) {
return@postDelayed
}
if (paths.entries.size == 1 && paths.entries.firstOrNull()?.value?.isTap() == true) { if (paths.entries.size == 1 && paths.entries.firstOrNull()?.value?.isTap() == true) {
gestureIsLongClick = true cancelled = true
Gesture.LONG_CLICK.invoke(context) Gesture.LONG_CLICK.invoke(context)
} }
} }
@ -142,7 +158,7 @@ class TouchGestureDetector(
// if the long press handler is still running, kill it // if the long press handler is still running, kill it
longPressHandler.removeCallbacksAndMessages(null) longPressHandler.removeCallbacksAndMessages(null)
// if the gesture was already detected as a long click, there is nothing to do // if the gesture was already detected as a long click, there is nothing to do
if (gestureIsLongClick) { if (cancelled) {
return return
} }
} }

View file

@ -15,18 +15,21 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@mipmap/ic_launcher_round"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView <TextView
android:id="@+id/list_apps_row_name" android:id="@+id/list_apps_row_name"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="60sp" android:layout_marginStart="20sp"
android:gravity="start" android:gravity="start"
android:text="" android:text=""
android:textSize="20sp" android:textSize="20sp"
tools:text="@string/app_name"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toEndOf="@id/list_apps_row_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -15,6 +15,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
tools:src="@mipmap/ic_launcher_round"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView <TextView
@ -25,7 +26,7 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:text="" android:text=""
android:textSize="11sp" android:textSize="11sp"
tools:text="some app" tools:text="@string/app_name"
app:layout_constraintTop_toBottomOf="@id/list_apps_row_icon" app:layout_constraintTop_toBottomOf="@id/list_apps_row_icon"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -32,6 +32,6 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="some app" /> tools:text="@string/app_name" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>