Skip to content

Commit b8e6502

Browse files
committed
Merge branch 'feature/1818-deprecate-gui-keyboard' into develop
2 parents 7e3c6ed + 57bf8da commit b8e6502

File tree

81 files changed

+1906
-1095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1906
-1095
lines changed

.cursor/rules/jetpack-compose.mdc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
---
2-
description:
3-
globs:
4-
alwaysApply: false
2+
alwaysApply: true
53
---
6-
74
# Android Native (Jetpack Compose)
85

96
# Android Jetpack Compose .cursorrules
@@ -58,6 +55,9 @@ app/
5855
8. Use proper theming with `MaterialTheme`
5956
9. Follow accessibility guidelines
6057
10. Implement proper animation patterns
58+
11. Modifier is always the first parameter
59+
12. Use io.github.sds100.keymapper.base.compose.LocalCustomColorsPalette for non-standard colors that are not in MaterialTheme.colorScheme
60+
13. Check icons in io.github.sds100.keymapper.base.utils.ui.compose.icons.KeyMapperIcons.
6161

6262
## Performance Guidelines
6363
1. Minimize recomposition using proper keys

CHANGELOG.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
- Restoring subgroups works and does not freeze Key Mapper.
2828
- Do not show duplicate constraint shortcuts.
2929
- Make WiFi connected constraints more reliable
30+
- #1818 auto switching of the Key Mapper keyboard when typing is more reliable and quicker on
31+
Android 13+
32+
- #1818 auto switching of the Key Mapper keyboard now requires Android 11+. On older versions it was
33+
only possible with WRITE_SECURE_SETTINGS but very few users are on these old Android versions so
34+
it is not worth the extra maintenance effort.
35+
- #1818 the Key Mapper GUI Keyboard is no longer mentioned in the app. It still works but PRO mode
36+
and the auto switching feature are the preferred way to work around the limitations of the Key
37+
Mapper keyboard.
3038

3139
## [3.2.1](https://github.com/sds100/KeyMapper/releases/tag/v3.2.1)
3240

@@ -1362,26 +1370,26 @@ This summarises the changes since 2.0.2.
13621370
- Dark mode! 🕶
13631371
- A keymap can have multiple actions.
13641372
- Triggers
1365-
- 2 modes. The keys can all be pressed at the same time or one after another in a sequence.
1366-
- Keys can be limited to a specific external device, any device or the device the app is
1367-
installed on.
1368-
- Double press support.
1373+
- 2 modes. The keys can all be pressed at the same time or one after another in a sequence.
1374+
- Keys can be limited to a specific external device, any device or the device the app is
1375+
installed on.
1376+
- Double press support.
13691377
- Constraints. Keymaps can be restricted to only work in certain situations. Constraints can be
13701378
mixed in OR mode or AND mode.
1371-
- App in foreground
1372-
- App not in foreground
1373-
- Bluetooth device connected
1374-
- Bluetooth device not connected
1375-
- Screen on/off (ROOT only).
1379+
- App in foreground
1380+
- App not in foreground
1381+
- Bluetooth device connected
1382+
- Bluetooth device not connected
1383+
- Screen on/off (ROOT only).
13761384

13771385
- Actions
1378-
- Toggle/enable/disable a Do Not Disturb mode (Android 6.0+).
1379-
- Toggle/enable/disable airplane mode (ROOT only).
1380-
- Switch between vibrate and ring.
1381-
- Launch the device assistant rather than the voice assistant.
1382-
- Take screenshots on rooted devices older than Pie.
1383-
- Can now have unique repeat options and any action is allowed to be repeated now.
1384-
- Show the keycode number when picking a Keycode action.
1386+
- Toggle/enable/disable a Do Not Disturb mode (Android 6.0+).
1387+
- Toggle/enable/disable airplane mode (ROOT only).
1388+
- Switch between vibrate and ring.
1389+
- Launch the device assistant rather than the voice assistant.
1390+
- Take screenshots on rooted devices older than Pie.
1391+
- Can now have unique repeat options and any action is allowed to be repeated now.
1392+
- Show the keycode number when picking a Keycode action.
13851393

13861394
- Renamed "Repeat Delay" to "Repeat Rate".
13871395
- Renamed "Hold Down Delay" to "Repeat Delay"
@@ -1512,16 +1520,16 @@ Significantly improved the input latency.
15121520

15131521
- A keymap can have multiple actions.
15141522
- Triggers
1515-
- 2 modes. The keys can all be pressed at the same time or one after another in a sequence.
1516-
- Keys can be limited to a specific external device, any device or the device the app is
1517-
installed on.
1518-
- Double press support.
1523+
- 2 modes. The keys can all be pressed at the same time or one after another in a sequence.
1524+
- Keys can be limited to a specific external device, any device or the device the app is
1525+
installed on.
1526+
- Double press support.
15191527
- Constraints. Keymaps can be restricted to only work in certain situations. Constraints can be
15201528
mixed in OR mode or AND mode.
1521-
- App in foreground
1522-
- App not in foreground
1523-
- Bluetooth device connected
1524-
- Bluetooth device not connected
1529+
- App in foreground
1530+
- App not in foreground
1531+
- Bluetooth device connected
1532+
- Bluetooth device not connected
15251533
- The option to show the "performing action" toast has been moved to a toggle in each keymap.
15261534
- The long press delay, double press timeout, sequence trigger timeout, action repeat delay,
15271535
hold-down delay until actions are repeated and vibrate delay can be changed per keymap.

app/src/ci/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<string name="app_name">Key Mapper CI</string>
4-
<string name="ime_service_label" translatable="false">Key Mapper CI Basic Input Method</string>
4+
<string name="ime_service_label" translatable="false">Key Mapper CI Input Method</string>
55
</resources>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<string name="app_name" translatable="false">Key Mapper Debug</string>
4-
<string name="ime_service_label" translatable="false">Key Mapper Debug Basic Input Method</string>
4+
<string name="ime_service_label" translatable="false">Key Mapper Debug Input Method</string>
55
</resources>

app/src/main/java/io/github/sds100/keymapper/AppHiltModule.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class AppHiltModule {
4040
get() = BuildConfig.VERSION_NAME
4141
override val versionCode: Int
4242
get() = BuildConfig.VERSION_CODE
43+
override val sdkInt: Int
44+
get() = Build.VERSION.SDK_INT
4345
}
4446

4547
@Singleton

app/src/main/java/io/github/sds100/keymapper/home/HomeViewModel.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.sds100.keymapper.home
22

33
import dagger.hilt.android.lifecycle.HiltViewModel
4+
import io.github.sds100.keymapper.base.actions.keyevent.FixKeyEventActionDelegate
45
import io.github.sds100.keymapper.base.backup.BackupRestoreMappingsUseCase
56
import io.github.sds100.keymapper.base.home.BaseHomeViewModel
67
import io.github.sds100.keymapper.base.home.ListKeyMapsUseCase
@@ -24,6 +25,7 @@ class HomeViewModel @Inject constructor(
2425
resourceProvider: ResourceProvider,
2526
private val sortKeyMaps: SortKeyMapsUseCase,
2627
private val showInputMethodPickerUseCase: ShowInputMethodPickerUseCase,
28+
fixKeyEventActionDelegate: FixKeyEventActionDelegate,
2729
navigationProvider: NavigationProvider,
2830
dialogProvider: DialogProvider,
2931
) : BaseHomeViewModel(
@@ -35,6 +37,7 @@ class HomeViewModel @Inject constructor(
3537
resourceProvider,
3638
sortKeyMaps,
3739
showInputMethodPickerUseCase,
40+
fixKeyEventActionDelegate,
3841
navigationProvider,
3942
dialogProvider,
4043
)

app/src/main/java/io/github/sds100/keymapper/system/accessibility/AccessibilityServiceController.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import io.github.sds100.keymapper.base.keymaps.PauseKeyMapsUseCase
1212
import io.github.sds100.keymapper.base.promode.SystemBridgeSetupAssistantController
1313
import io.github.sds100.keymapper.base.system.accessibility.AccessibilityNodeRecorder
1414
import io.github.sds100.keymapper.base.system.accessibility.BaseAccessibilityServiceController
15+
import io.github.sds100.keymapper.base.system.inputmethod.AutoSwitchImeController
1516
import io.github.sds100.keymapper.base.trigger.RecordTriggerController
1617
import io.github.sds100.keymapper.data.repositories.PreferenceRepository
1718
import io.github.sds100.keymapper.system.inputmethod.KeyEventRelayServiceWrapper
@@ -30,6 +31,7 @@ class AccessibilityServiceController @AssistedInject constructor(
3031
inputEventHub: InputEventHub,
3132
recordTriggerController: RecordTriggerController,
3233
setupAssistantControllerFactory: SystemBridgeSetupAssistantController.Factory,
34+
autoSwitchImeControllerFactory: AutoSwitchImeController.Factory,
3335
) : BaseAccessibilityServiceController(
3436
service = service,
3537
accessibilityNodeRecorderFactory = accessibilityNodeRecorderFactory,
@@ -43,6 +45,7 @@ class AccessibilityServiceController @AssistedInject constructor(
4345
inputEventHub = inputEventHub,
4446
recordTriggerController = recordTriggerController,
4547
setupAssistantControllerFactory = setupAssistantControllerFactory,
48+
autoSwitchImeControllerFactory = autoSwitchImeControllerFactory,
4649
) {
4750
@AssistedFactory
4851
interface Factory {

app/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
VERSION_NAME=4.0.0-beta.1
2-
VERSION_CODE=158
2+
VERSION_CODE=161
33
VERSION_NUM=0

base/src/main/java/io/github/sds100/keymapper/base/BaseKeyMapperApp.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import io.github.sds100.keymapper.base.logging.KeyMapperLoggingTree
2020
import io.github.sds100.keymapper.base.promode.SystemBridgeAutoStarter
2121
import io.github.sds100.keymapper.base.settings.Theme
2222
import io.github.sds100.keymapper.base.system.accessibility.AccessibilityServiceAdapterImpl
23-
import io.github.sds100.keymapper.base.system.inputmethod.AutoSwitchImeController
2423
import io.github.sds100.keymapper.base.system.notifications.NotificationController
2524
import io.github.sds100.keymapper.base.system.permissions.AutoGrantPermissionController
2625
import io.github.sds100.keymapper.common.utils.Constants
@@ -58,9 +57,6 @@ abstract class BaseKeyMapperApp : MultiDexApplication() {
5857
@Inject
5958
lateinit var notificationController: NotificationController
6059

61-
@Inject
62-
lateinit var autoSwitchImeController: AutoSwitchImeController
63-
6460
@Inject
6561
lateinit var packageManagerAdapter: AndroidPackageManagerAdapter
6662

@@ -199,8 +195,6 @@ abstract class BaseKeyMapperApp : MultiDexApplication() {
199195

200196
notificationController.init()
201197

202-
autoSwitchImeController.init()
203-
204198
processLifecycleOwner.lifecycle.addObserver(object : LifecycleObserver {
205199
@Suppress("DEPRECATION")
206200
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
@@ -238,6 +232,14 @@ abstract class BaseKeyMapperApp : MultiDexApplication() {
238232
appCoroutineScope.launch {
239233
systemBridgeConnectionManager.connectionState.collect { state ->
240234
if (state is SystemBridgeConnectionState.Connected) {
235+
val isUsed =
236+
settingsRepository.get(Keys.isSystemBridgeUsed).first() ?: false
237+
238+
// Enable the setting to use PRO mode for key event actions the first time they use PRO mode.
239+
if (!isUsed) {
240+
settingsRepository.set(Keys.keyEventActionsUseSystemBridge, true)
241+
}
242+
241243
settingsRepository.set(Keys.isSystemBridgeUsed, true)
242244
}
243245
}

base/src/main/java/io/github/sds100/keymapper/base/BaseSingletonHiltModule.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import io.github.sds100.keymapper.base.system.inputmethod.ShowHideInputMethodUse
3535
import io.github.sds100.keymapper.base.system.inputmethod.ShowHideInputMethodUseCaseImpl
3636
import io.github.sds100.keymapper.base.system.inputmethod.ShowInputMethodPickerUseCase
3737
import io.github.sds100.keymapper.base.system.inputmethod.ShowInputMethodPickerUseCaseImpl
38+
import io.github.sds100.keymapper.base.system.inputmethod.SwitchImeAsyncImpl
39+
import io.github.sds100.keymapper.base.system.inputmethod.SwitchImeInterface
3840
import io.github.sds100.keymapper.base.system.inputmethod.ToggleCompatibleImeUseCase
3941
import io.github.sds100.keymapper.base.system.inputmethod.ToggleCompatibleImeUseCaseImpl
4042
import io.github.sds100.keymapper.base.system.notifications.AndroidNotificationAdapter
@@ -158,4 +160,8 @@ abstract class BaseSingletonHiltModule {
158160
@Binds
159161
@Singleton
160162
abstract fun bindGetDefaultKeyMapOptionsUseCas(impl: GetDefaultKeyMapOptionsUseCaseImpl): GetDefaultKeyMapOptionsUseCase
163+
164+
@Binds
165+
@Singleton
166+
abstract fun bindSwitchImeInterface(impl: SwitchImeAsyncImpl): SwitchImeInterface
161167
}

0 commit comments

Comments
 (0)