diff --git a/README.md b/README.md index 93b7818..e200d89 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,9 @@ a server-driven radio session and songs are added from Deezer or YouTube Music. locally. - **Previous** from the player: after two seconds of playback it restarts the current track; before that it restores the last played track. -- **Headset/Bluetooth next and previous** use the same queue rules as the - buttons; they no longer seek inside the single ExoPlayer item. +- **Headset/Bluetooth next and previous** and the media notification's skip / + back buttons use the same queue rules as the in-app controls; they no longer + seek inside the single ExoPlayer item. - The bottom player keeps the cover and title/artist readable on narrow phones; add-to-mood actions moved into the overflow menu. - **Scrubbing**: the progress slider can be dragged on every platform. Android and @@ -199,7 +200,7 @@ Tagged builds (`v*`) publish to internal testing from CI. The Gitea secrets are: | `ANDROID_KEY_PASSWORD` | key password | | `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON | -Then `git tag v0.3.1 && git push --tags` builds, signs and uploads the bundle. +Then `git tag v0.3.2 && git push --tags` builds, signs and uploads the bundle. Gradle Play Publisher asks Play for the next free `versionCode` (`ResolutionStrategy.AUTO`), so only the tag/version name needs to change. diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index a5fb559..40a1b02 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -41,7 +41,7 @@ val hasUploadKey = uploadKeyStore?.exists() == true && val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt() val appVersionName = System.getenv("VERSION_NAME") ?: localProperties.getProperty("VERSION_NAME") - ?: "0.3.1" + ?: "0.3.2" kotlin { androidTarget { diff --git a/composeApp/src/androidMain/kotlin/win/taptap/musicmanager/client/PlaybackService.kt b/composeApp/src/androidMain/kotlin/win/taptap/musicmanager/client/PlaybackService.kt index 605c9f8..00c5df8 100644 --- a/composeApp/src/androidMain/kotlin/win/taptap/musicmanager/client/PlaybackService.kt +++ b/composeApp/src/androidMain/kotlin/win/taptap/musicmanager/client/PlaybackService.kt @@ -9,6 +9,8 @@ import android.view.KeyEvent import androidx.core.content.IntentCompat import androidx.media3.common.AudioAttributes import androidx.media3.common.C +import androidx.media3.common.ForwardingPlayer +import androidx.media3.common.Player import androidx.media3.exoplayer.ExoPlayer import androidx.media3.session.MediaSession import androidx.media3.session.MediaSessionService @@ -38,7 +40,7 @@ class PlaybackService : MediaSessionService() { override fun onCreate() { super.onCreate() - val player = ExoPlayer.Builder(this) + val exoPlayer = ExoPlayer.Builder(this) .setAudioAttributes( AudioAttributes.Builder() .setUsage(C.USAGE_MEDIA) @@ -52,6 +54,44 @@ class PlaybackService : MediaSessionService() { setWakeMode(C.WAKE_MODE_NETWORK) } + // ExoPlayer holds one item at a time; the queue lives in the app. Advertise + // next/previous so the notification and Android Auto show the buttons and + // route them to the queue instead of seeking inside the single item. + val player = object : ForwardingPlayer(exoPlayer) { + override fun getAvailableCommands(): Player.Commands = + super.getAvailableCommands().buildUpon() + .addAll( + Player.COMMAND_SEEK_TO_NEXT, + Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM, + Player.COMMAND_SEEK_TO_PREVIOUS, + Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM, + ) + .build() + + override fun isCommandAvailable(command: Int): Boolean = + command == Player.COMMAND_SEEK_TO_NEXT || + command == Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEM || + command == Player.COMMAND_SEEK_TO_PREVIOUS || + command == Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM || + super.isCommandAvailable(command) + + override fun seekToNext() { + if (!PlaybackCommands.next()) super.seekToNext() + } + + override fun seekToNextMediaItem() { + if (!PlaybackCommands.next()) super.seekToNextMediaItem() + } + + override fun seekToPrevious() { + if (!PlaybackCommands.previous()) super.seekToPrevious() + } + + override fun seekToPreviousMediaItem() { + if (!PlaybackCommands.previous()) super.seekToPreviousMediaItem() + } + } + val sessionActivity = PendingIntent.getActivity( this, 0, diff --git a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt index 414a79a..bce6165 100644 --- a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt +++ b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/MoodDetailScreen.kt @@ -189,9 +189,9 @@ fun MoodDetailScreen(state: AppState, store: AppStore) { if (state.preview.isNotEmpty()) { item { HorizontalDivider(Modifier.padding(vertical = 12.dp)) - SectionTitle("Next batch") + SectionTitle("Up next") Text( - "What the radio would play next, mixed from this mood and its ready picks. " + + "Preview of the radio mix: these are the tracks that would play next. " + "Nothing here is downloaded or saved.", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant, diff --git a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt index dbafe50..b5d2a84 100644 --- a/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt +++ b/composeApp/src/commonMain/kotlin/win/taptap/musicmanager/client/ui/SettingsScreen.kt @@ -107,7 +107,7 @@ fun SettingsScreen(state: AppState, store: AppStore) { Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) Text( - "AudioManager 0.3.1 · $platformName", + "AudioManager 0.3.2 · $platformName", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, )