Skip to content

Commit 3d37ed8

Browse files
committed
Gestures: increase scroll distance
1 parent 4aa78c7 commit 3d37ed8

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

mobile/src/main/java/com/thewizrd/simplewear/helpers/AccessibilityServiceExtensions.kt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import android.accessibilityservice.AccessibilityService
44
import android.accessibilityservice.GestureDescription
55
import android.accessibilityservice.GestureDescription.StrokeDescription
66
import android.graphics.Path
7-
import kotlin.math.max
8-
import kotlin.math.min
97

108
fun AccessibilityService.dispatchScrollUp(ratio: Float? = null) {
119
val displayMetrics = this.applicationContext.resources.displayMetrics
@@ -17,7 +15,7 @@ fun AccessibilityService.dispatchScrollUp(ratio: Float? = null) {
1715

1816
val path = Path().apply {
1917
moveTo(centerX, centerY)
20-
lineTo(centerX, centerY + (ratio?.let { min(it * height, centerY) } ?: distance))
18+
lineTo(centerX, centerY + centerY)
2119
}
2220

2321
dispatchGesture(path)
@@ -33,9 +31,7 @@ fun AccessibilityService.dispatchScrollDown(ratio: Float? = null) {
3331

3432
val path = Path().apply {
3533
moveTo(centerX, centerY)
36-
lineTo(
37-
centerX,
38-
centerY + (ratio?.let { max(min(it * height, centerY), -centerY) } ?: -distance))
34+
lineTo(centerX, 0f)
3935
}
4036

4137
dispatchGesture(path)
@@ -51,7 +47,7 @@ fun AccessibilityService.dispatchScrollLeft(ratio: Float? = null) {
5147

5248
val path = Path().apply {
5349
moveTo(centerX, centerY)
54-
lineTo(centerX + (ratio?.let { min(it * width, centerX) } ?: distance), centerY)
50+
lineTo(centerX + centerX, centerY)
5551
}
5652

5753
dispatchGesture(path)
@@ -67,8 +63,7 @@ fun AccessibilityService.dispatchScrollRight(ratio: Float? = null) {
6763

6864
val path = Path().apply {
6965
moveTo(centerX, centerY)
70-
lineTo(centerX + (ratio?.let { max(min(it * width, centerX), -centerX) } ?: -distance),
71-
centerY)
66+
lineTo(centerX + -centerX, centerY)
7267
}
7368

7469
dispatchGesture(path)

wear/src/main/java/com/thewizrd/simplewear/ui/simplewear/GesturesUi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fun GesturesUi(
102102
val maxSquareEdge = (sqrt(((screenHeightDp * screenWidthDp) / 2).toDouble()))
103103
Dp(((screenHeightDp - maxSquareEdge) / 2).toFloat())
104104
} else {
105-
0.dp
105+
12.dp
106106
}
107107
}
108108

0 commit comments

Comments
 (0)