Skip to content

Commit f425481

Browse files
committed
Merge branch 'develop' into feature/699-time-constraints
2 parents 67e1df1 + 5d95314 commit f425481

16 files changed

Lines changed: 251 additions & 46 deletions

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## [3.0.1](https://github.com/sds100/KeyMapper/releases/tag/v3.0.1)
22

3-
#### TO BE RELEASED
3+
#### 28 April 2025
44

55
## Added
66

@@ -11,6 +11,8 @@
1111

1212
- #1654 The Key Mapper keyboard is now required again for Text actions because the accessibility service API does not work in all situations.
1313
- #1653 Hide the export/import menu buttons in groups.
14+
- #1553 Hide double press option for side key and fingerprint gesture triggers because it is misleading. Double activations can be done with sequence triggers instead.
15+
- #1669 Change quick settings tile text.
1416

1517
## Bug fixes
1618

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
android:name=".system.tiles.ToggleMappingsTile"
255255
android:exported="true"
256256
android:icon="@drawable/ic_tile_pause"
257-
android:label="@string/tile_pause"
257+
android:label="@string/tile_pause_title"
258258
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
259259
tools:targetApi="24">
260260
<intent-filter>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Row
99
import androidx.compose.foundation.layout.Spacer
1010
import androidx.compose.foundation.layout.fillMaxWidth
1111
import androidx.compose.foundation.layout.height
12-
import androidx.compose.foundation.layout.navigationBarsPadding
1312
import androidx.compose.foundation.layout.padding
1413
import androidx.compose.foundation.layout.width
1514
import androidx.compose.foundation.layout.widthIn
@@ -67,8 +66,7 @@ fun SelectionBottomSheet(
6766
Surface(
6867
modifier = modifier
6968
.widthIn(max = BottomSheetDefaults.SheetMaxWidth)
70-
.fillMaxWidth()
71-
.navigationBarsPadding(),
69+
.fillMaxWidth(),
7270
shadowElevation = 5.dp,
7371
shape = BottomSheetDefaults.ExpandedShape,
7472
tonalElevation = BottomSheetDefaults.Elevation,

app/src/main/java/io/github/sds100/keymapper/mappings/keymaps/ConfigKeyMapUseCase.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class ConfigKeyMapUseCaseController(
304304

305305
val triggerKey = AssistantTriggerKey(type = type, clickType = clickType)
306306

307-
val newKeys = trigger.keys.plus(triggerKey)
307+
val newKeys = trigger.keys.plus(triggerKey).map { it.setClickType(ClickType.SHORT_PRESS) }
308308

309309
val newMode = when {
310310
trigger.mode != TriggerMode.Sequence && containsAssistantKey -> TriggerMode.Sequence
@@ -335,7 +335,7 @@ class ConfigKeyMapUseCaseController(
335335

336336
val triggerKey = FingerprintTriggerKey(type = type, clickType = clickType)
337337

338-
val newKeys = trigger.keys.plus(triggerKey)
338+
val newKeys = trigger.keys.plus(triggerKey).map { it.setClickType(ClickType.SHORT_PRESS) }
339339

340340
val newMode = when {
341341
trigger.mode != TriggerMode.Sequence && containsFingerprintGesture -> TriggerMode.Sequence
@@ -513,7 +513,7 @@ class ConfigKeyMapUseCaseController(
513513
// You can't set the trigger to a long press if it contains a key
514514
// that isn't detected with key codes. This is because there aren't
515515
// separate key events for the up and down press that can be timed.
516-
if (trigger.keys.any { it is AssistantTriggerKey }) {
516+
if (trigger.keys.any { !it.allowedLongPress }) {
517517
return@editTrigger trigger
518518
}
519519

@@ -534,6 +534,10 @@ class ConfigKeyMapUseCaseController(
534534
return@editTrigger trigger
535535
}
536536

537+
if (trigger.keys.any { !it.allowedDoublePress }) {
538+
return@editTrigger trigger
539+
}
540+
537541
val newKeys = trigger.keys.map { it.setClickType(clickType = ClickType.DOUBLE_PRESS) }
538542
val newMode = TriggerMode.Undefined
539543

app/src/main/java/io/github/sds100/keymapper/mappings/keymaps/KeyMapListItemCreator.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,21 +267,25 @@ class KeyMapListItemCreator(
267267
}
268268
}
269269

270-
if (deviceName != null || key.detectionSource == KeyEventDetectionSource.INPUT_METHOD || !key.consumeEvent) {
271-
append(" (")
270+
val parts = mutableListOf<String>()
272271

272+
if (deviceName != null || key.detectionSource == KeyEventDetectionSource.INPUT_METHOD || !key.consumeEvent) {
273273
if (key.detectionSource == KeyEventDetectionSource.INPUT_METHOD) {
274-
append("${getString(R.string.flag_detect_from_input_method)} $midDot ")
274+
parts.add(getString(R.string.flag_detect_from_input_method))
275275
}
276276

277277
if (deviceName != null) {
278-
append(deviceName)
278+
parts.add(deviceName)
279279
}
280280

281281
if (!key.consumeEvent) {
282-
append(" $midDot ${getString(R.string.flag_dont_override_default_action)}")
282+
parts.add(getString(R.string.flag_dont_override_default_action))
283283
}
284+
}
284285

286+
if (parts.isNotEmpty()) {
287+
append(" (")
288+
append(parts.joinToString(separator = " $midDot "))
285289
append(")")
286290
}
287291
}

app/src/main/java/io/github/sds100/keymapper/mappings/keymaps/trigger/AssistantTriggerKey.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ data class AssistantTriggerKey(
2323
override val consumeEvent: Boolean = true
2424

2525
override val allowedLongPress: Boolean = false
26+
override val allowedDoublePress: Boolean = false
2627

2728
override fun compareTo(other: TriggerKey) = when (other) {
2829
is AssistantTriggerKey -> compareValuesBy(

app/src/main/java/io/github/sds100/keymapper/mappings/keymaps/trigger/BaseConfigTriggerViewModel.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ abstract class BaseConfigTriggerViewModel(
291291
* or there are only key code keys in the trigger. It is not possible to do a long press of
292292
* non-key code keys in a parallel trigger.
293293
*/
294-
if (trigger.keys.size == 1) {
294+
if (trigger.keys.size == 1 && trigger.keys.all { it.allowedDoublePress }) {
295295
clickTypeButtons.add(ClickType.SHORT_PRESS)
296296
clickTypeButtons.add(ClickType.DOUBLE_PRESS)
297297
}
@@ -363,7 +363,6 @@ abstract class BaseConfigTriggerViewModel(
363363
return TriggerKeyOptionsState.Assistant(
364364
assistantType = key.type,
365365
clickType = key.clickType,
366-
showClickTypes = showClickTypes,
367366
)
368367
}
369368

@@ -379,7 +378,6 @@ abstract class BaseConfigTriggerViewModel(
379378
return TriggerKeyOptionsState.FingerprintGesture(
380379
gestureType = key.type,
381380
clickType = key.clickType,
382-
showClickTypes = showClickTypes,
383381
)
384382
}
385383
}
@@ -864,16 +862,16 @@ sealed class TriggerKeyOptionsState {
864862
data class Assistant(
865863
val assistantType: AssistantTriggerType,
866864
override val clickType: ClickType,
867-
override val showClickTypes: Boolean,
868865
) : TriggerKeyOptionsState() {
866+
override val showClickTypes: Boolean = false
869867
override val showLongPressClickType: Boolean = false
870868
}
871869

872870
data class FingerprintGesture(
873871
val gestureType: FingerprintGestureType,
874872
override val clickType: ClickType,
875-
override val showClickTypes: Boolean,
876873
) : TriggerKeyOptionsState() {
874+
override val showClickTypes: Boolean = false
877875
override val showLongPressClickType: Boolean = false
878876
}
879877

app/src/main/java/io/github/sds100/keymapper/mappings/keymaps/trigger/FingerprintTriggerKey.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ data class FingerprintTriggerKey(
1919
) : TriggerKey() {
2020
override val consumeEvent: Boolean = true
2121
override val allowedLongPress: Boolean = false
22+
override val allowedDoublePress: Boolean = false
2223

2324
override fun compareTo(other: TriggerKey) = when (other) {
2425
is FingerprintTriggerKey -> compareValuesBy(

app/src/main/java/io/github/sds100/keymapper/mappings/keymaps/trigger/FloatingButtonKey.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ data class FloatingButtonKey(
1919

2020
override val consumeEvent: Boolean = true
2121
override val allowedLongPress: Boolean = true
22+
override val allowedDoublePress: Boolean = true
2223

2324
override fun compareTo(other: TriggerKey) = when (other) {
2425
is FloatingButtonKey -> compareValuesBy(

app/src/main/java/io/github/sds100/keymapper/mappings/keymaps/trigger/KeyCodeTriggerKey.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ data class KeyCodeTriggerKey(
1919
) : TriggerKey() {
2020

2121
override val allowedLongPress: Boolean = true
22+
override val allowedDoublePress: Boolean = true
2223

2324
override fun toString(): String {
2425
val deviceString = when (device) {

0 commit comments

Comments
 (0)