fix: notification skip/back drive the app queue
- advertise next/previous on a ForwardingPlayer so the notification and Android Auto show the buttons, and route them to the mood queue - rename the preview section to 'Up next' with a clearer subtitle - version 0.3.2
This commit is contained in:
1 parent
2478505dba
commit
e28e95fa2b
5 files changed
+49
-8
No files matched your search
@@ -45,8 +45,9 @@ a server-driven radio session and songs are added from Deezer or YouTube Music.
|
|||||||
locally.
|
locally.
|
||||||
- **Previous** from the player: after two seconds of playback it restarts the
|
- **Previous** from the player: after two seconds of playback it restarts the
|
||||||
current track; before that it restores the last played track.
|
current track; before that it restores the last played track.
|
||||||
- **Headset/Bluetooth next and previous** use the same queue rules as the
|
- **Headset/Bluetooth next and previous** and the media notification's skip /
|
||||||
buttons; they no longer seek inside the single ExoPlayer item.
|
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;
|
- The bottom player keeps the cover and title/artist readable on narrow phones;
|
||||||
add-to-mood actions moved into the overflow menu.
|
add-to-mood actions moved into the overflow menu.
|
||||||
- **Scrubbing**: the progress slider can be dragged on every platform. Android and
|
- **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 |
|
| `ANDROID_KEY_PASSWORD` | key password |
|
||||||
| `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON |
|
| `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`
|
Gradle Play Publisher asks Play for the next free `versionCode`
|
||||||
(`ResolutionStrategy.AUTO`), so only the tag/version name needs to change.
|
(`ResolutionStrategy.AUTO`), so only the tag/version name needs to change.
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ val hasUploadKey = uploadKeyStore?.exists() == true &&
|
|||||||
val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt()
|
val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt()
|
||||||
val appVersionName = System.getenv("VERSION_NAME")
|
val appVersionName = System.getenv("VERSION_NAME")
|
||||||
?: localProperties.getProperty("VERSION_NAME")
|
?: localProperties.getProperty("VERSION_NAME")
|
||||||
?: "0.3.1"
|
?: "0.3.2"
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
androidTarget {
|
androidTarget {
|
||||||
|
|||||||
+41
-1
@@ -9,6 +9,8 @@ import android.view.KeyEvent
|
|||||||
import androidx.core.content.IntentCompat
|
import androidx.core.content.IntentCompat
|
||||||
import androidx.media3.common.AudioAttributes
|
import androidx.media3.common.AudioAttributes
|
||||||
import androidx.media3.common.C
|
import androidx.media3.common.C
|
||||||
|
import androidx.media3.common.ForwardingPlayer
|
||||||
|
import androidx.media3.common.Player
|
||||||
import androidx.media3.exoplayer.ExoPlayer
|
import androidx.media3.exoplayer.ExoPlayer
|
||||||
import androidx.media3.session.MediaSession
|
import androidx.media3.session.MediaSession
|
||||||
import androidx.media3.session.MediaSessionService
|
import androidx.media3.session.MediaSessionService
|
||||||
@@ -38,7 +40,7 @@ class PlaybackService : MediaSessionService() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
|
||||||
val player = ExoPlayer.Builder(this)
|
val exoPlayer = ExoPlayer.Builder(this)
|
||||||
.setAudioAttributes(
|
.setAudioAttributes(
|
||||||
AudioAttributes.Builder()
|
AudioAttributes.Builder()
|
||||||
.setUsage(C.USAGE_MEDIA)
|
.setUsage(C.USAGE_MEDIA)
|
||||||
@@ -52,6 +54,44 @@ class PlaybackService : MediaSessionService() {
|
|||||||
setWakeMode(C.WAKE_MODE_NETWORK)
|
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(
|
val sessionActivity = PendingIntent.getActivity(
|
||||||
this,
|
this,
|
||||||
0,
|
0,
|
||||||
|
|||||||
+2
-2
@@ -189,9 +189,9 @@ fun MoodDetailScreen(state: AppState, store: AppStore) {
|
|||||||
if (state.preview.isNotEmpty()) {
|
if (state.preview.isNotEmpty()) {
|
||||||
item {
|
item {
|
||||||
HorizontalDivider(Modifier.padding(vertical = 12.dp))
|
HorizontalDivider(Modifier.padding(vertical = 12.dp))
|
||||||
SectionTitle("Next batch")
|
SectionTitle("Up next")
|
||||||
Text(
|
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.",
|
"Nothing here is downloaded or saved.",
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ fun SettingsScreen(state: AppState, store: AppStore) {
|
|||||||
Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold)
|
Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold)
|
||||||
Text(
|
Text(
|
||||||
"AudioManager 0.3.1 · $platformName",
|
"AudioManager 0.3.2 · $platformName",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user