Skip to content

Commit

Permalink
Merge pull request #48 from Aga-C/change-previous-button-behavior
Browse files Browse the repository at this point in the history
Changed the previous button behavior (#45)
  • Loading branch information
naveensingh authored Apr 27, 2024
2 parents 24ceb96 + e396456 commit f74bf4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MyWidgetProvider : AppWidgetProvider() {
} else {
when (action) {
NEXT -> player.seekToNextMediaItem()
PREVIOUS -> player.seekToPreviousMediaItem()
PREVIOUS -> if (player.contentPosition > 5000) player.seekTo(0) else player.seekToPreviousMediaItem()
PLAYPAUSE -> player.togglePlayback()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class SimpleMusicPlayer(private val exoPlayer: ExoPlayer) : ForwardingPlayer(exo

override fun seekToPrevious() {
play()
if (!maybeForcePrevious()) {
if (currentPosition > 5000) {
seekTo(0)
} else if (!maybeForcePrevious()) {
seekToPreviousCount += 1
seekWithDelay()
}
Expand Down

0 comments on commit f74bf4d

Please sign in to comment.