Skip to content

Commit 595faa1

Browse files
authored
Merge pull request #1544 from keymapperorg/develop
Release 2.8.3
2 parents 21c02f8 + 9a44750 commit 595faa1

File tree

64 files changed

+401
-347
lines changed

Some content is hidden

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

64 files changed

+401
-347
lines changed

.github/workflows/build-mkdocs.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
name: Build mkdocs
2-
1+
name: Build mkdocs
32

43
on:
54
push:
65
branches:
7-
- master
8-
9-
6+
- master
107
- main
118
permissions:
129
contents: write
@@ -18,12 +15,10 @@ jobs:
1815
- uses: actions/setup-python@v4
1916
with:
2017
python-version: 3.x
21-
- uses: actions/cache@v2
18+
- uses: actions/cache@v3
2219
with:
2320
key: ${{ github.ref }}
2421
path: .cache
2522
- run: pip install mkdocs-material
2623
- run: pip install mkdocs-redirects
27-
28-
2924
- run: mkdocs gh-deploy --force

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1+
## [2.8.3](https://github.com/sds100/KeyMapper/releases/tag/v2.8.3)
2+
3+
#### 17 March 2025
4+
5+
## Changed
6+
7+
- #1474 always allow specifying a name for key map launcher shortcuts
8+
- #1533 simplify naming of ringer mode actions
9+
10+
## Bug fixes
11+
12+
- #1535 side key/assistant trigger does not trigger from non-assistant buttons
13+
114
## [2.8.2](https://github.com/sds100/KeyMapper/releases/tag/v2.8.2)
215

16+
#### 12 March 2025
17+
318
## Changes
419

520
- #1514, #1454 Improving naming of assistant trigger to also refer to the side key and do not force the user to select Key Mapper as the assistant.

app/build.gradle

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: "com.android.application"
22
apply plugin: "kotlin-android"
33
apply plugin: "kotlin-kapt"
4+
apply plugin: "com.google.devtools.ksp"
45
apply plugin: "androidx.navigation.safeargs.kotlin"
56
apply plugin: "kotlinx-serialization"
67
apply plugin: "org.jetbrains.kotlin.plugin.parcelize"
@@ -158,7 +159,7 @@ dependencies {
158159

159160
def room_version = "2.6.1"
160161
def coroutinesVersion = "1.9.0"
161-
def nav_version = '2.8.5'
162+
def nav_version = '2.8.9'
162163
def work_version = "2.10.0"
163164
def epoxy_version = "4.6.2"
164165
def splitties_version = "3.0.0"
@@ -168,10 +169,10 @@ dependencies {
168169
// kotlin stuff
169170
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
170171
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
171-
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0"
172+
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3"
172173

173174
// random stuff
174-
implementation "com.google.android.material:material:1.13.0-alpha09"
175+
implementation "com.google.android.material:material:1.13.0-alpha11"
175176
implementation "com.github.salomonbrys.kotson:kotson:2.5.0"
176177
implementation "com.airbnb.android:epoxy:$epoxy_version"
177178
implementation "com.github.AppIntro:AppIntro:6.1.0"
@@ -186,7 +187,7 @@ dependencies {
186187
implementation "dev.rikka.shizuku:api:$shizuku_version"
187188
implementation "dev.rikka.shizuku:provider:$shizuku_version"
188189
implementation "org.lsposed.hiddenapibypass:hiddenapibypass:4.3"
189-
proImplementation 'com.revenuecat.purchases:purchases:8.10.8'
190+
proImplementation 'com.revenuecat.purchases:purchases:8.11.0'
190191

191192

192193
// splitties
@@ -201,8 +202,8 @@ dependencies {
201202
implementation "androidx.legacy:legacy-support-core-ui:1.0.0"
202203
implementation "androidx.core:core-ktx:1.15.0"
203204

204-
implementation "androidx.activity:activity-ktx:1.10.0"
205-
implementation "androidx.fragment:fragment-ktx:1.8.5"
205+
implementation "androidx.activity:activity-ktx:1.10.1"
206+
implementation "androidx.fragment:fragment-ktx:1.8.6"
206207
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7"
207208
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.8.7"
208209
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.7"
@@ -214,21 +215,21 @@ dependencies {
214215
implementation "androidx.appcompat:appcompat:1.7.0"
215216
implementation "androidx.recyclerview:recyclerview:1.4.0"
216217
implementation "androidx.preference:preference-ktx:1.2.1"
217-
implementation "androidx.constraintlayout:constraintlayout:2.2.0"
218+
implementation "androidx.constraintlayout:constraintlayout:2.2.1"
218219
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
219220
implementation "androidx.room:room-runtime:$room_version"
220221
implementation "androidx.viewpager2:viewpager2:1.1.0"
221-
implementation "androidx.datastore:datastore-preferences:1.1.2"
222+
implementation "androidx.datastore:datastore-preferences:1.1.3"
222223
implementation "androidx.core:core-splashscreen:1.0.1"
223-
kapt "androidx.room:room-compiler:$room_version"
224+
ksp "androidx.room:room-compiler:$room_version"
224225

225226
// Compose
226-
implementation "androidx.compose.ui:ui-android:1.7.6"
227+
implementation "androidx.compose.ui:ui-android:1.7.8"
227228
implementation "androidx.compose.material3:material3-android:1.3.1"
228-
implementation "androidx.compose.ui:ui-tooling-preview-android:1.7.6"
229-
implementation "androidx.compose.material:material-icons-extended-android:1.7.6"
230-
debugImplementation "androidx.compose.ui:ui-tooling:1.7.6"
231-
debug_releaseImplementation "androidx.compose.ui:ui-tooling:1.7.6"
229+
implementation "androidx.compose.ui:ui-tooling-preview-android:1.7.8"
230+
implementation "androidx.compose.material:material-icons-extended-android:1.7.8"
231+
debugImplementation "androidx.compose.ui:ui-tooling:1.7.8"
232+
debug_releaseImplementation "androidx.compose.ui:ui-tooling:1.7.8"
232233

233234
// debugImplementation "com.squareup.leakcanary:leakcanary-android:2.6"
234235

@@ -242,13 +243,13 @@ dependencies {
242243
testImplementation "org.hamcrest:hamcrest-all:1.3"
243244
testImplementation "androidx.test.ext:junit-ktx:$androidXTestExtKotlinRunnerVersion"
244245
testImplementation "androidx.test:core-ktx:1.6.1"
245-
testImplementation "org.robolectric:robolectric:4.3.1"
246+
testImplementation "org.robolectric:robolectric:4.12.1"
246247
testImplementation "androidx.arch.core:core-testing:2.2.0"
247248
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
248249
testImplementation "pl.pragmatists:JUnitParams:1.1.1"
249250
testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
250-
testImplementation "org.mockito:mockito-core:5.1.1"
251-
testImplementation "org.mockito:mockito-inline:5.0.0"
251+
testImplementation "org.mockito:mockito-core:5.2.0"
252+
testImplementation "org.mockito:mockito-inline:5.2.0"
252253

253254
androidTestImplementation "androidx.test.ext:junit:$androidXTestExtKotlinRunnerVersion"
254255
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
@@ -258,6 +259,6 @@ dependencies {
258259
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
259260
androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
260261
androidTestImplementation "org.mockito:mockito-android:4.6.1"
261-
debugImplementation "androidx.fragment:fragment-testing:1.8.5"
262+
debugImplementation "androidx.fragment:fragment-testing:1.8.6"
262263
implementation "androidx.test:core:$androidXTestCoreVersion"
263264
}

app/src/main/assets/whats-new.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
You can now remap the DPAD buttons on your game controller!
1+
You can now remap the power button/side key on your phone and the DPAD buttons on your game controller!
22

33
Many other bug fixes. See all the changes at http://changelog.keymapper.club.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ object UseCases {
9898

9999
fun createKeymapShortcut(ctx: Context) = CreateKeyMapShortcutUseCaseImpl(
100100
ServiceLocator.appShortcutAdapter(ctx),
101-
displayKeyMap(ctx),
102101
ServiceLocator.resourceProvider(ctx),
103102
)
104103

app/src/main/java/io/github/sds100/keymapper/constraints/ConstraintSnapshot.kt

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.github.sds100.keymapper.constraints
22

3+
import android.media.AudioAttributes
34
import android.os.Build
45
import io.github.sds100.keymapper.system.accessibility.IAccessibilityService
56
import io.github.sds100.keymapper.system.bluetooth.BluetoothDeviceInfo
@@ -40,7 +41,16 @@ class ConstraintSnapshotImpl(
4041
private val connectedBluetoothDevices: Set<BluetoothDeviceInfo> by lazy { devicesAdapter.connectedBluetoothDevices.value }
4142
private val orientation: Orientation by lazy { displayAdapter.orientation }
4243
private val isScreenOn: Boolean by lazy { displayAdapter.isScreenOn.firstBlocking() }
43-
private val appsPlayingMedia: List<String> by lazy { mediaAdapter.getPackagesPlayingMedia() }
44+
private val appsPlayingMedia: List<String> by lazy { mediaAdapter.getActiveMediaSessionPackages() }
45+
46+
private val audioContentTypes: Set<Int> by lazy {
47+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
48+
mediaAdapter.getActiveAudioContentTypes()
49+
} else {
50+
emptySet()
51+
}
52+
}
53+
4454
private val isWifiEnabled: Boolean by lazy { networkAdapter.isWifiEnabled() }
4555
private val connectedWifiSSID: String? by lazy { networkAdapter.connectedWifiSSID }
4656
private val chosenImeId: String? by lazy { inputMethodAdapter.chosenIme.value?.id }
@@ -55,18 +65,35 @@ class ConstraintSnapshotImpl(
5565
}
5666
}
5767

68+
private fun isMediaContentTypePlaying(): Boolean {
69+
return audioContentTypes.contains(AudioAttributes.CONTENT_TYPE_MOVIE) ||
70+
audioContentTypes.contains(AudioAttributes.CONTENT_TYPE_MUSIC)
71+
}
72+
5873
override fun isSatisfied(constraint: Constraint): Boolean {
5974
val isSatisfied = when (constraint) {
6075
is Constraint.AppInForeground -> appInForeground == constraint.packageName
6176
is Constraint.AppNotInForeground -> appInForeground != constraint.packageName
62-
is Constraint.AppPlayingMedia ->
63-
appsPlayingMedia.contains(constraint.packageName)
77+
is Constraint.AppPlayingMedia -> {
78+
if (appsPlayingMedia.contains(constraint.packageName)) {
79+
return true
80+
} else if (appInForeground == constraint.packageName && isMediaContentTypePlaying()) {
81+
return true
82+
} else {
83+
return false
84+
}
85+
}
6486

6587
is Constraint.AppNotPlayingMedia ->
66-
appsPlayingMedia.none { it == constraint.packageName }
88+
appsPlayingMedia.none { it == constraint.packageName } &&
89+
!(appInForeground == constraint.packageName && isMediaContentTypePlaying())
90+
91+
Constraint.MediaPlaying ->
92+
isMediaContentTypePlaying() || appsPlayingMedia.isNotEmpty()
93+
94+
Constraint.NoMediaPlaying ->
95+
!isMediaContentTypePlaying() && appsPlayingMedia.isEmpty()
6796

68-
Constraint.MediaPlaying -> appsPlayingMedia.isNotEmpty()
69-
Constraint.NoMediaPlaying -> appsPlayingMedia.isEmpty()
7097
is Constraint.BtDeviceConnected -> {
7198
connectedBluetoothDevices.any { it.address == constraint.bluetoothAddress }
7299
}

app/src/main/java/io/github/sds100/keymapper/data/db/typeconverter/ActionListTypeConverter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ class ActionListTypeConverter {
1919
}
2020

2121
@TypeConverter
22-
fun toJsonString(actionList: MutableList<ActionEntity>): String = Gson().toJson(actionList)!!
22+
fun toJsonString(actionList: List<ActionEntity>): String = Gson().toJson(actionList)!!
2323
}

app/src/main/java/io/github/sds100/keymapper/data/db/typeconverter/ConstraintListTypeConverter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class ConstraintListTypeConverter {
1414
fun toConstraintList(json: String) = Gson().fromJson<MutableList<ConstraintEntity>>(json)
1515

1616
@TypeConverter
17-
fun toJsonString(constraintList: MutableList<ConstraintEntity>) =
17+
fun toJsonString(constraintList: List<ConstraintEntity>) =
1818
Gson().toJson(constraintList)!!
1919
}

app/src/main/java/io/github/sds100/keymapper/data/db/typeconverter/ExtraListTypeConverter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ class ExtraListTypeConverter {
1414
fun toExtraObject(string: String) = Gson().fromJson<MutableList<Extra>>(string)
1515

1616
@TypeConverter
17-
fun toString(extras: MutableList<Extra>) = Gson().toJson(extras)!!
17+
fun toString(extras: List<Extra>) = Gson().toJson(extras)!!
1818
}

0 commit comments

Comments
 (0)