[WIP] Initial multiple queues support#865
[WIP] Initial multiple queues support#865mikooomich wants to merge 9 commits intoFoedusProgramme:betafrom
Conversation
| customExtras.putInt("index", index) | ||
| }, Bundle.EMPTY | ||
| ).get().extras.run { | ||
| if (containsKey("allQueues")) { |
There was a problem hiding this comment.
why bother with containsKey if you throw anyway, you can just let the !! do its job
| /** | ||
| * Deletes a queue. | ||
| * | ||
| * When deleting the active queue, |
| if (index == masterQueues.lastIndex) { | ||
| masterQueues.removeAt(index) | ||
| if (index <= 0) { | ||
| player.pauseAllPlayersAndStopSelf() // TODO: correct way to stop playback |
| val endedWorkaroundPlayer | ||
| get() = mediaSession?.player as EndedWorkaroundPlayer? | ||
| private var controller: MediaBrowser? = null | ||
| val qb: QueueBoard = QueueBoard(this) |
There was a problem hiding this comment.
maybe should be inited in onCreate
| } | ||
|
|
||
| // TODO: shuffle and repeat mode | ||
| fun MediaController.playQueue( |
There was a problem hiding this comment.
you are doing this at the wrong level, Android AUto for example will just not call your SERVICE_QB_ENQUEUE, it will keep doing setMediaItems(). Instead a player wrapper should give old queue to queueboard before executing setMediaItems()
| /** | ||
| * Retrieve a song given a song ID. Returns null if no song is found | ||
| */ | ||
| fun findSong(mediaId: String): MediaItem? { |
There was a problem hiding this comment.
For future uses. Should i remove it for the time being?
There was a problem hiding this comment.
having smth for future use is ok if you know for what use, but atleast for me its not really clear what its useful for
|
|
||
| val current = (instance?.currentMediaItemIndex ?: 0) | ||
| if (current > playlistAdapter.playlist.second.size) { | ||
| // hax to workaround ui loading itself 4 times |
| controller?.setMediaItems(albums.shuffled().flatMap { it.songList }) | ||
| controller?.prepare() | ||
| controller?.play() | ||
| controller?.playQueue( |
There was a problem hiding this comment.
cf, this ui code shouldnt be changed. isOriginal is always true after setMediaItems(), it should only be considered changed after add/remove/move(/replace if id changed)
|
|
||
| if (startIndex == 0) { | ||
| val playerItemCount = plr.mediaItemCount | ||
| // player.player.replaceMediaItems seems to stop playback so we |
There was a problem hiding this comment.
replaceMediaItems probably does but replaceMediaItem without s does not, update current song with repalceMediaItem too
There was a problem hiding this comment.
The currently playing media item can be at any index, and it needs to become the first index.. I'm not sure how replaceMediaItem would work better than what I current have.
There was a problem hiding this comment.
I mean in addition to what you have, as replaceMediaItem updates metadata without interruptting playback
| return null | ||
| } | ||
|
|
||
| // I have no idea why this value gets reset to 0 by the end... but ig this works |
app/src/main/res/values/strings.xml
Outdated
| <string name="actions_query_shuffle_specific">shuffle $item_name</string> | ||
| <string name="please_allow_to_delete">Press allow to delete files</string> | ||
| <string name="choose_sd">Choose %s</string> | ||
| <string name="settings_mq_preview">Enable multiple queues preview</string> |
There was a problem hiding this comment.
try to avoid mentioning preview, instead use strings that can be reused once feature is stable, to avoid double work for translators
* And so it begins: My attempt to implement one of OuterTune's most cursed features (code wise), but without programming crimes.
* LocalDateTime methods shouldn't need sdk 26. Figure it out later
02e20d1 to
4304106
Compare
To test: Enable in Flags.kt, then enable settings toggle
[Rest of pr details to be filled out later]