Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Interaction with screen element #1168

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8bfbd80
feat: Add Swipe Support - Add multi-touch Swipe support
pixel-shock Aug 31, 2023
b259967
Merge pull request #1158 from pixel-shock/feature/swipe-gestures
sds100 Sep 9, 2023
e1a43a0
Merge pull request #1 from keymapperorg/master
pixel-shock Sep 11, 2023
3afc5e5
WIP - Add "Tap" Element on Screen Action
pixel-shock Sep 14, 2023
4f2a8e7
WIP - Add "Tap" Element on Screen Action
pixel-shock Sep 19, 2023
42e0615
WIP - Add "Tap" Element on Screen Action
pixel-shock Sep 19, 2023
a4b83e5
WIP - Refactor "should record"
pixel-shock Sep 20, 2023
7812034
WIP - Add "Tap" Element on Screen Action
pixel-shock Sep 20, 2023
0250dcc
WIP - Add "Tap" Element on Screen Action
pixel-shock Sep 21, 2023
d0ceff0
WIP - RENAME to "Interact with screen element"
pixel-shock Sep 21, 2023
83cb618
WIP - Further improvements, bugfixes
pixel-shock Sep 21, 2023
29c5c5e
WIP - fix checkbox change not affecting model state
pixel-shock Sep 21, 2023
9d2b769
WIP - add clear list button to empty DB
pixel-shock Sep 21, 2023
ed89101
WIP - Code cleanup, add proper call on node, add more actions
pixel-shock Sep 21, 2023
6ca68db
Bug fixes for Spinner values, more elegant action type to display val…
pixel-shock Sep 22, 2023
d0816e6
Add AppIcon, AppName, fix bug where node could not be found, fix "onl…
pixel-shock Sep 22, 2023
09170fe
View and Layout improvements, remove some accessiblity event types wh…
pixel-shock Sep 22, 2023
24c2581
Change "getSearchableString" to "id" for new List item "UiElementList…
pixel-shock Sep 23, 2023
0b278e2
Merge branch 'develop' into feature/interaction-with-screen-element
pixel-shock Sep 26, 2023
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
214 changes: 214 additions & 0 deletions app/schemas/io.github.sds100.keymapper.data.db.AppDatabase/14.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
{
"formatVersion": 1,
"database": {
"version": 14,
"identityHash": "ea7690c067f077386e05257595ff45bb",
"entities": [
{
"tableName": "keymaps",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `trigger` TEXT NOT NULL, `action_list` TEXT NOT NULL, `constraint_list` TEXT NOT NULL, `constraint_mode` INTEGER NOT NULL, `flags` INTEGER NOT NULL, `folder_name` TEXT, `is_enabled` INTEGER NOT NULL, `uid` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "trigger",
"columnName": "trigger",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "actionList",
"columnName": "action_list",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "constraintList",
"columnName": "constraint_list",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "constraintMode",
"columnName": "constraint_mode",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "flags",
"columnName": "flags",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "folderName",
"columnName": "folder_name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "isEnabled",
"columnName": "is_enabled",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "uid",
"columnName": "uid",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "fingerprintmaps",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `action_list` TEXT NOT NULL, `constraint_list` TEXT NOT NULL, `constraint_mode` INTEGER NOT NULL, `extras` TEXT NOT NULL, `flags` INTEGER NOT NULL, `is_enabled` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "actionList",
"columnName": "action_list",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "constraintList",
"columnName": "constraint_list",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "constraintMode",
"columnName": "constraint_mode",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "extras",
"columnName": "extras",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "flags",
"columnName": "flags",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isEnabled",
"columnName": "is_enabled",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "log",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `time` INTEGER NOT NULL, `severity` INTEGER NOT NULL, `message` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "severity",
"columnName": "severity",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "message",
"columnName": "message",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "viewids",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `view_id` TEXT NOT NULL, `package_name` TEXT NOT NULL, `full_name` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "viewId",
"columnName": "view_id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "packageName",
"columnName": "package_name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "fullName",
"columnName": "full_name",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ea7690c067f077386e05257595ff45bb')"
]
}
}
5 changes: 5 additions & 0 deletions app/src/main/java/io/github/sds100/keymapper/KeyMapperApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.lifecycle.OnLifecycleEvent
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.multidex.MultiDexApplication
import com.google.android.material.color.DynamicColors
import io.github.sds100.keymapper.system.ui.RecordUiElementsController
import io.github.sds100.keymapper.data.Keys
import io.github.sds100.keymapper.data.entities.LogEntryEntity
import io.github.sds100.keymapper.logging.KeyMapperLoggingTree
Expand Down Expand Up @@ -142,6 +143,10 @@ class KeyMapperApp : MultiDexApplication() {
RecordTriggerController(appCoroutineScope, accessibilityServiceAdapter)
}

val recordUiElementsController by lazy {
RecordUiElementsController(appCoroutineScope, accessibilityServiceAdapter)
}

val autoGrantPermissionController by lazy {
AutoGrantPermissionController(
appCoroutineScope,
Expand Down
21 changes: 19 additions & 2 deletions app/src/main/java/io/github/sds100/keymapper/ServiceLocator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import io.github.sds100.keymapper.data.repositories.PreferenceRepository
import io.github.sds100.keymapper.data.repositories.RoomFingerprintMapRepository
import io.github.sds100.keymapper.data.repositories.RoomKeyMapRepository
import io.github.sds100.keymapper.data.repositories.RoomLogRepository
import io.github.sds100.keymapper.data.repositories.RoomViewIdRepository
import io.github.sds100.keymapper.data.repositories.SettingsPreferenceRepository
import io.github.sds100.keymapper.data.repositories.ViewIdRepository
import io.github.sds100.keymapper.logging.LogRepository
import io.github.sds100.keymapper.mappings.fingerprintmaps.FingerprintMapRepository
import io.github.sds100.keymapper.shizuku.ShizukuAdapter
Expand Down Expand Up @@ -122,6 +124,20 @@ object ServiceLocator {
}
}

@Volatile
private var IRoomViewIdRepository: ViewIdRepository? = null

fun viewIdRepository(context: Context): ViewIdRepository {
synchronized(this) {
return IRoomViewIdRepository ?: RoomViewIdRepository(
database(context).viewIdDao(),
(context.applicationContext as KeyMapperApp).appCoroutineScope,
).also {
this.IRoomViewIdRepository = it
}
}
}

@Volatile
private var backupManager: BackupManager? = null

Expand All @@ -138,7 +154,7 @@ object ServiceLocator {
roomKeymapRepository(context),
settingsRepository(context),
fingerprintMapRepository(context),
soundsManager(context)
soundsManager(context),
).also {
this.backupManager = it
}
Expand Down Expand Up @@ -299,7 +315,8 @@ object ServiceLocator {
AppDatabase.MIGRATION_9_10,
AppDatabase.MIGRATION_10_11,
AppDatabase.RoomMigration_11_12(context.applicationContext.legacyFingerprintMapDataStore),
AppDatabase.MIGRATION_12_13
AppDatabase.MIGRATION_12_13,
AppDatabase.MIGRATION_13_14
).build()
}
}
9 changes: 9 additions & 0 deletions app/src/main/java/io/github/sds100/keymapper/UseCases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import io.github.sds100.keymapper.system.inputmethod.KeyMapperImeMessengerImpl
import io.github.sds100.keymapper.system.inputmethod.ShowInputMethodPickerUseCase
import io.github.sds100.keymapper.system.inputmethod.ShowInputMethodPickerUseCaseImpl
import io.github.sds100.keymapper.system.inputmethod.ToggleCompatibleImeUseCaseImpl
import io.github.sds100.keymapper.system.ui.DisplayUiElementsUseCase
import io.github.sds100.keymapper.system.ui.DisplayUiElementsUseCaseImpl

/**
* Created by sds100 on 03/03/2021.
Expand Down Expand Up @@ -73,6 +75,13 @@ object UseCases {
)
}

fun displayUiElements(ctx: Context): DisplayUiElementsUseCase {
return DisplayUiElementsUseCaseImpl(
ServiceLocator.viewIdRepository(ctx),
displayPackages(ctx)
)
}

fun getActionError(ctx: Context) = GetActionErrorUseCaseImpl(
ServiceLocator.packageManagerAdapter(ctx),
ServiceLocator.inputMethodAdapter(ctx),
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/io/github/sds100/keymapper/actions/ActionData.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.sds100.keymapper.actions

import io.github.sds100.keymapper.actions.uielementinteraction.INTERACTIONTYPE
import io.github.sds100.keymapper.system.camera.CameraLens
import io.github.sds100.keymapper.system.display.Orientation
import io.github.sds100.keymapper.system.intents.IntentTarget
Expand Down Expand Up @@ -320,6 +321,19 @@ sealed class ActionData {
override val id = ActionId.SWIPE_SCREEN
}

@Serializable
data class InteractWithScreenElement(
val elementId: String,
val packageName: String,
val fullName: String,
val appName: String?,
val onlyIfVisible: Boolean,
val interactiontype: INTERACTIONTYPE,
val description: String?,
): ActionData() {
override val id = ActionId.INTERACT_WITH_SCREEN_ELEMENT
}

@Serializable
data class PhoneCall(
val number: String
Expand Down
Loading
Loading