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
11 changes: 3 additions & 8 deletions .github/workflows/build-mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Build mkdocs

name: Build mkdocs

on:
push:
branches:
- master


- master
- main
permissions:
contents: write
Expand All @@ -18,12 +15,10 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs-material
- run: pip install mkdocs-redirects


- run: mkdocs gh-deploy --force
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
## [2.8.3](https://github.com/sds100/KeyMapper/releases/tag/v2.8.3)

#### 17 March 2025

## Changed

- #1474 always allow specifying a name for key map launcher shortcuts
- #1533 simplify naming of ringer mode actions

## Bug fixes

- #1535 side key/assistant trigger does not trigger from non-assistant buttons

## [2.8.2](https://github.com/sds100/KeyMapper/releases/tag/v2.8.2)

#### 12 March 2025

## Changes

- #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.

## Bug fixes
- #1461 fix: crash on startup due to getting MotionEvent device
-
- #1518 fix: detect apps playing media without a notification for media constraints

## [2.8.1](https://github.com/sds100/KeyMapper/releases/tag/v2.8.1)

#### 18 February 2025
Expand Down
37 changes: 19 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-kapt"
apply plugin: "com.google.devtools.ksp"
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: "kotlinx-serialization"
apply plugin: "org.jetbrains.kotlin.plugin.parcelize"
Expand Down Expand Up @@ -158,7 +159,7 @@ dependencies {

def room_version = "2.6.1"
def coroutinesVersion = "1.9.0"
def nav_version = '2.8.5'
def nav_version = '2.8.9'
def work_version = "2.10.0"
def epoxy_version = "4.6.2"
def splitties_version = "3.0.0"
Expand All @@ -168,10 +169,10 @@ dependencies {
// kotlin stuff
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3"

// random stuff
implementation "com.google.android.material:material:1.13.0-alpha09"
implementation "com.google.android.material:material:1.13.0-alpha11"
implementation "com.github.salomonbrys.kotson:kotson:2.5.0"
implementation "com.airbnb.android:epoxy:$epoxy_version"
implementation "com.github.AppIntro:AppIntro:6.1.0"
Expand All @@ -186,7 +187,7 @@ dependencies {
implementation "dev.rikka.shizuku:api:$shizuku_version"
implementation "dev.rikka.shizuku:provider:$shizuku_version"
implementation "org.lsposed.hiddenapibypass:hiddenapibypass:4.3"
proImplementation 'com.revenuecat.purchases:purchases:8.10.8'
proImplementation 'com.revenuecat.purchases:purchases:8.11.0'


// splitties
Expand All @@ -201,8 +202,8 @@ dependencies {
implementation "androidx.legacy:legacy-support-core-ui:1.0.0"
implementation "androidx.core:core-ktx:1.15.0"

implementation "androidx.activity:activity-ktx:1.10.0"
implementation "androidx.fragment:fragment-ktx:1.8.5"
implementation "androidx.activity:activity-ktx:1.10.1"
implementation "androidx.fragment:fragment-ktx:1.8.6"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.8.7"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.7"
Expand All @@ -214,21 +215,21 @@ dependencies {
implementation "androidx.appcompat:appcompat:1.7.0"
implementation "androidx.recyclerview:recyclerview:1.4.0"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.constraintlayout:constraintlayout:2.2.0"
implementation "androidx.constraintlayout:constraintlayout:2.2.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.viewpager2:viewpager2:1.1.0"
implementation "androidx.datastore:datastore-preferences:1.1.2"
implementation "androidx.datastore:datastore-preferences:1.1.3"
implementation "androidx.core:core-splashscreen:1.0.1"
kapt "androidx.room:room-compiler:$room_version"
ksp "androidx.room:room-compiler:$room_version"

// Compose
implementation "androidx.compose.ui:ui-android:1.7.6"
implementation "androidx.compose.ui:ui-android:1.7.8"
implementation "androidx.compose.material3:material3-android:1.3.1"
implementation "androidx.compose.ui:ui-tooling-preview-android:1.7.6"
implementation "androidx.compose.material:material-icons-extended-android:1.7.6"
debugImplementation "androidx.compose.ui:ui-tooling:1.7.6"
debug_releaseImplementation "androidx.compose.ui:ui-tooling:1.7.6"
implementation "androidx.compose.ui:ui-tooling-preview-android:1.7.8"
implementation "androidx.compose.material:material-icons-extended-android:1.7.8"
debugImplementation "androidx.compose.ui:ui-tooling:1.7.8"
debug_releaseImplementation "androidx.compose.ui:ui-tooling:1.7.8"

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

Expand All @@ -242,13 +243,13 @@ dependencies {
testImplementation "org.hamcrest:hamcrest-all:1.3"
testImplementation "androidx.test.ext:junit-ktx:$androidXTestExtKotlinRunnerVersion"
testImplementation "androidx.test:core-ktx:1.6.1"
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation "org.robolectric:robolectric:4.12.1"
testImplementation "androidx.arch.core:core-testing:2.2.0"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
testImplementation "pl.pragmatists:JUnitParams:1.1.1"
testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
testImplementation "org.mockito:mockito-core:5.1.1"
testImplementation "org.mockito:mockito-inline:5.0.0"
testImplementation "org.mockito:mockito-core:5.2.0"
testImplementation "org.mockito:mockito-inline:5.2.0"

androidTestImplementation "androidx.test.ext:junit:$androidXTestExtKotlinRunnerVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
Expand All @@ -258,6 +259,6 @@ dependencies {
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
androidTestImplementation "org.mockito:mockito-android:4.6.1"
debugImplementation "androidx.fragment:fragment-testing:1.8.5"
debugImplementation "androidx.fragment:fragment-testing:1.8.6"
implementation "androidx.test:core:$androidXTestCoreVersion"
}
2 changes: 1 addition & 1 deletion app/src/main/assets/whats-new.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
You can now remap the DPAD buttons on your game controller!
You can now remap the power button/side key on your phone and the DPAD buttons on your game controller!

Many other bug fixes. See all the changes at http://changelog.keymapper.club.
1 change: 0 additions & 1 deletion app/src/main/java/io/github/sds100/keymapper/UseCases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ object UseCases {

fun createKeymapShortcut(ctx: Context) = CreateKeyMapShortcutUseCaseImpl(
ServiceLocator.appShortcutAdapter(ctx),
displayKeyMap(ctx),
ServiceLocator.resourceProvider(ctx),
)

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

import android.media.AudioAttributes
import android.os.Build
import io.github.sds100.keymapper.system.accessibility.IAccessibilityService
import io.github.sds100.keymapper.system.bluetooth.BluetoothDeviceInfo
Expand Down Expand Up @@ -40,7 +41,16 @@ class ConstraintSnapshotImpl(
private val connectedBluetoothDevices: Set<BluetoothDeviceInfo> by lazy { devicesAdapter.connectedBluetoothDevices.value }
private val orientation: Orientation by lazy { displayAdapter.orientation }
private val isScreenOn: Boolean by lazy { displayAdapter.isScreenOn.firstBlocking() }
private val appsPlayingMedia: List<String> by lazy { mediaAdapter.getPackagesPlayingMedia() }
private val appsPlayingMedia: List<String> by lazy { mediaAdapter.getActiveMediaSessionPackages() }

private val audioContentTypes: Set<Int> by lazy {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mediaAdapter.getActiveAudioContentTypes()
} else {
emptySet()
}
}

private val isWifiEnabled: Boolean by lazy { networkAdapter.isWifiEnabled() }
private val connectedWifiSSID: String? by lazy { networkAdapter.connectedWifiSSID }
private val chosenImeId: String? by lazy { inputMethodAdapter.chosenIme.value?.id }
Expand All @@ -55,18 +65,35 @@ class ConstraintSnapshotImpl(
}
}

private fun isMediaContentTypePlaying(): Boolean {
return audioContentTypes.contains(AudioAttributes.CONTENT_TYPE_MOVIE) ||
audioContentTypes.contains(AudioAttributes.CONTENT_TYPE_MUSIC)
}

override fun isSatisfied(constraint: Constraint): Boolean {
val isSatisfied = when (constraint) {
is Constraint.AppInForeground -> appInForeground == constraint.packageName
is Constraint.AppNotInForeground -> appInForeground != constraint.packageName
is Constraint.AppPlayingMedia ->
appsPlayingMedia.contains(constraint.packageName)
is Constraint.AppPlayingMedia -> {
if (appsPlayingMedia.contains(constraint.packageName)) {
return true
} else if (appInForeground == constraint.packageName && isMediaContentTypePlaying()) {
return true
} else {
return false
}
}

is Constraint.AppNotPlayingMedia ->
appsPlayingMedia.none { it == constraint.packageName }
appsPlayingMedia.none { it == constraint.packageName } &&
!(appInForeground == constraint.packageName && isMediaContentTypePlaying())

Constraint.MediaPlaying ->
isMediaContentTypePlaying() || appsPlayingMedia.isNotEmpty()

Constraint.NoMediaPlaying ->
!isMediaContentTypePlaying() && appsPlayingMedia.isEmpty()

Constraint.MediaPlaying -> appsPlayingMedia.isNotEmpty()
Constraint.NoMediaPlaying -> appsPlayingMedia.isEmpty()
is Constraint.BtDeviceConnected -> {
connectedBluetoothDevices.any { it.address == constraint.bluetoothAddress }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ class ActionListTypeConverter {
}

@TypeConverter
fun toJsonString(actionList: MutableList<ActionEntity>): String = Gson().toJson(actionList)!!
fun toJsonString(actionList: List<ActionEntity>): String = Gson().toJson(actionList)!!
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class ConstraintListTypeConverter {
fun toConstraintList(json: String) = Gson().fromJson<MutableList<ConstraintEntity>>(json)

@TypeConverter
fun toJsonString(constraintList: MutableList<ConstraintEntity>) =
fun toJsonString(constraintList: List<ConstraintEntity>) =
Gson().toJson(constraintList)!!
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class ExtraListTypeConverter {
fun toExtraObject(string: String) = Gson().fromJson<MutableList<Extra>>(string)

@TypeConverter
fun toString(extras: MutableList<Extra>) = Gson().toJson(extras)!!
fun toString(extras: List<Extra>) = Gson().toJson(extras)!!
}
Loading