Resume playback if it's paused

This commit is contained in:
Naveen 2023-08-20 21:41:24 +05:30
parent 0adf91cba3
commit 88c874d8e8
No known key found for this signature in database
GPG key ID: 0E155DAD31671DA3

View file

@ -16,10 +16,7 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.musicplayer.R
import com.simplemobiletools.musicplayer.adapters.QueueAdapter
import com.simplemobiletools.musicplayer.dialogs.NewPlaylistDialog
import com.simplemobiletools.musicplayer.extensions.audioHelper
import com.simplemobiletools.musicplayer.extensions.currentMediaItems
import com.simplemobiletools.musicplayer.extensions.indexOfTrack
import com.simplemobiletools.musicplayer.extensions.toTracks
import com.simplemobiletools.musicplayer.extensions.*
import com.simplemobiletools.musicplayer.helpers.RoomHelper
import com.simplemobiletools.musicplayer.models.Track
import kotlinx.android.synthetic.main.activity_queue.*
@ -56,6 +53,8 @@ class QueueActivity : SimpleControllerActivity() {
override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) = updateAdapter()
override fun onIsPlayingChanged(isPlaying: Boolean) = updateAdapter()
private fun setupOptionsMenu() {
setupSearch(queue_toolbar.menu)
queue_toolbar.setOnMenuItemClickListener { menuItem ->
@ -131,6 +130,9 @@ class QueueActivity : SimpleControllerActivity() {
withPlayer {
val startIndex = currentMediaItems.indexOfTrack(it as Track)
seekTo(startIndex, 0)
if (!isReallyPlaying) {
play()
}
}
}