Skip to content

Commit

Permalink
1.1.4 fixes and improvements + switching to kotlin 2.0.0 AGP 8.5.0
Browse files Browse the repository at this point in the history
Took 2 hours 2 minutes
  • Loading branch information
JulesPvx committed Jul 2, 2024
1 parent 9b39b9c commit 3f29a86
Show file tree
Hide file tree
Showing 17 changed files with 144,217 additions and 166,328 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

263 changes: 0 additions & 263 deletions .idea/other.xml

This file was deleted.

12 changes: 10 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension

plugins {
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.ksp)
alias(libs.plugins.android.application)

Expand All @@ -41,8 +42,8 @@ android {
applicationId = "fr.angel.soundtap"
minSdk = 30
targetSdk = 34
versionCode = 39
versionName = "1.1.3"
versionCode = 40
versionName = "1.1.4"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -100,6 +101,13 @@ android {
}
}

composeCompiler {
enableStrongSkippingMode = true

reportsDestination = layout.buildDirectory.dir("compose_compiler")
// stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
}

dependencies {

implementation(libs.androidx.core.ktx)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
android:name=".SoundTapApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import fr.angel.soundtap.service.media.MediaReceiver
import kotlin.math.abs
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
Expand Down Expand Up @@ -80,7 +79,7 @@ data class AccessibilityServiceState(
(
System.currentTimeMillis() - volumeUpLastPressedTime >= doublePressThreshold ||
System.currentTimeMillis() - volumeDownLastPressedTime >= doublePressThreshold
)
)
}

data class TimedHardwareButtonsEvent(
Expand Down Expand Up @@ -130,7 +129,6 @@ class SoundTapAccessibilityService : AccessibilityService() {
}
}

@OptIn(ExperimentalCoroutinesApi::class)
override fun onKeyEvent(event: KeyEvent?): Boolean {
// Skip the event if the service is not activated or that no media receiver is registered
if (event == null ||
Expand Down Expand Up @@ -173,10 +171,10 @@ class SoundTapAccessibilityService : AccessibilityService() {
KeyEvent.KEYCODE_VOLUME_UP -> {
keySequenceTimeout(
keyPressed =
TimedHardwareButtonsEvent(
event = HardwareButtonsEvent.VOLUME_UP,
creationTime = System.currentTimeMillis(),
),
TimedHardwareButtonsEvent(
event = HardwareButtonsEvent.VOLUME_UP,
creationTime = System.currentTimeMillis(),
),
)
_uiState.value =
_uiState.value.copy(
Expand All @@ -187,10 +185,10 @@ class SoundTapAccessibilityService : AccessibilityService() {
KeyEvent.KEYCODE_VOLUME_DOWN -> {
keySequenceTimeout(
keyPressed =
TimedHardwareButtonsEvent(
event = HardwareButtonsEvent.VOLUME_DOWN,
creationTime = System.currentTimeMillis(),
),
TimedHardwareButtonsEvent(
event = HardwareButtonsEvent.VOLUME_DOWN,
creationTime = System.currentTimeMillis(),
),
)
_uiState.value =
_uiState.value.copy(volumeDownLastPressedTime = System.currentTimeMillis())
Expand Down Expand Up @@ -414,14 +412,14 @@ class SoundTapAccessibilityService : AccessibilityService() {

private fun executeAction(action: MediaAction) {
when (action) {
MediaAction.PLAY_PAUSE -> MediaReceiver.firstCallback?.togglePlayPause()
MediaAction.NEXT -> MediaReceiver.firstCallback?.skipToNext()
MediaAction.PREVIOUS -> MediaReceiver.firstCallback?.skipToPrevious()
MediaAction.STOP -> MediaReceiver.firstCallback?.stop()
MediaAction.FAST_FORWARD -> MediaReceiver.firstCallback?.fastForward()
MediaAction.REWIND -> MediaReceiver.firstCallback?.rewind()
MediaAction.PLAY -> MediaReceiver.firstCallback?.play()
MediaAction.PAUSE -> MediaReceiver.firstCallback?.pause()
MediaAction.PLAY_PAUSE -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.togglePlayPause()
MediaAction.NEXT -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.skipToNext()
MediaAction.PREVIOUS -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.skipToPrevious()
MediaAction.STOP -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.stop()
MediaAction.FAST_FORWARD -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.fastForward()
MediaAction.REWIND -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.rewind()
MediaAction.PLAY -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.play()
MediaAction.PAUSE -> MediaReceiver.getBetterCallback(preferredMediaPlayer)?.pause()
MediaAction.NONE -> { // Do Nothing
}
}
Expand Down
Loading

0 comments on commit 3f29a86

Please sign in to comment.