Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Changed

- #1369 Add content descriptions to drag handles and custom "Move up"/"Move down" accessibility actions for trigger and action list items, improving TalkBack support for reordering.
- #262 Add "TalkBack gesture" action to simulate TalkBack navigation gestures (swipes, multi-finger taps, and multi-directional swipes).

## [4.1.1](https://github.com/sds100/KeyMapper/releases/tag/v4.1.1)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.sds100.keymapper.base.actions

import io.github.sds100.keymapper.base.actions.talkback.TalkBackGestureType
import io.github.sds100.keymapper.common.models.ShellExecutionMode
import io.github.sds100.keymapper.common.utils.NodeInteractionType
import io.github.sds100.keymapper.common.utils.Orientation
Expand Down Expand Up @@ -95,6 +96,7 @@ sealed class ActionData : Comparable<ActionData> {
{ it.showVolumeUi },
{ it.volumeStream },
)

else -> super.compareTo(other)
}
}
Expand All @@ -111,6 +113,7 @@ sealed class ActionData : Comparable<ActionData> {
{ it.showVolumeUi },
{ it.volumeStream },
)

else -> super.compareTo(other)
}
}
Expand Down Expand Up @@ -1040,6 +1043,17 @@ sealed class ActionData : Comparable<ActionData> {
{ it.settingKey },
{ it.value },
)

else -> super.compareTo(other)
}
}

@Serializable
data class TalkBackGesture(val gesture: TalkBackGestureType) : ActionData() {
override val id: ActionId = ActionId.TALKBACK_GESTURE

override fun compareTo(other: ActionData) = when (other) {
is TalkBackGesture -> gesture.compareTo(other.gesture)
else -> super.compareTo(other)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.github.sds100.keymapper.base.actions

import android.util.Base64
import androidx.core.net.toUri
import io.github.sds100.keymapper.base.actions.talkback.TalkBackGestureType
import io.github.sds100.keymapper.common.models.ShellExecutionMode
import io.github.sds100.keymapper.common.utils.KMError
import io.github.sds100.keymapper.common.utils.KMResult
Expand Down Expand Up @@ -69,6 +70,7 @@ object ActionDataEntityMapper {
ActionEntity.Type.MODIFY_SETTING -> ActionId.MODIFY_SETTING

ActionEntity.Type.CREATE_NOTIFICATION -> ActionId.CREATE_NOTIFICATION

ActionEntity.Type.TOAST -> ActionId.TOAST
}

Expand Down Expand Up @@ -874,6 +876,20 @@ object ActionDataEntityMapper {

ActionId.CLEAR_RECENT_APP -> ActionData.ClearRecentApp

ActionId.TALKBACK_GESTURE -> {
val gestureTypeString =
entity.extras.getData(ActionEntity.EXTRA_TALKBACK_GESTURE_TYPE)
.valueOrNull() ?: return null

val gestureType = try {
TalkBackGestureType.valueOf(gestureTypeString)
} catch (_: IllegalArgumentException) {
return null
}

ActionData.TalkBackGesture(gesture = gestureType)
}

ActionId.MODIFY_SETTING -> {
val value = entity.extras.getData(ActionEntity.EXTRA_SETTING_VALUE)
.valueOrNull() ?: return null
Expand Down Expand Up @@ -1324,6 +1340,10 @@ object ActionDataEntityMapper {
EntityExtra(ActionEntity.EXTRA_TOAST_DURATION, data.duration.name),
)

is ActionData.TalkBackGesture -> listOf(
EntityExtra(ActionEntity.EXTRA_TALKBACK_GESTURE_TYPE, data.gesture.name),
)

else -> emptyList()
}

Expand Down Expand Up @@ -1510,5 +1530,7 @@ object ActionDataEntityMapper {
ActionId.CLEAR_RECENT_APP to "clear_recent_app",

ActionId.MODIFY_SETTING to "modify_setting",

ActionId.TALKBACK_GESTURE to "talkback_gesture",
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ class LazyActionErrorSnapshot(
}
}

is ActionData.TalkBackGesture -> {
return getAppError(TALKBACK_PACKAGE_NAME)
}

else -> {}
}

Expand Down Expand Up @@ -317,3 +321,5 @@ interface ActionErrorSnapshot {
fun getError(action: ActionData): KMError?
fun getErrors(actions: List<ActionData>): Map<ActionData, KMError?>
}

private const val TALKBACK_PACKAGE_NAME = "com.google.android.marvin.talkback"
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,6 @@ enum class ActionId {
CLEAR_RECENT_APP,

MODIFY_SETTING,

TALKBACK_GESTURE,
}
Loading
Loading