From 5e576d586054e374ee4f89ea9eb8a53ec5b4919a Mon Sep 17 00:00:00 2001 From: casey langen Date: Sat, 23 Jul 2022 14:30:15 -0700 Subject: [PATCH] Add seek support to modern playback notification. --- .../casey/musikcube/remote/service/system/SystemService.kt | 7 ++++++- .../musikcube/remote/ui/shared/activity/BaseActivity.kt | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt index d6052d739..3e67ac27f 100644 --- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt +++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/service/system/SystemService.kt @@ -564,6 +564,10 @@ class SystemService : Service() { return false } + override fun onSeekTo(pos: Long) { + playback?.seekTo(pos.toDouble() / 1000.0) + } + override fun onPlay() { playback?.let { when (it.queueCount == 0) { @@ -711,7 +715,8 @@ class SystemService : Service() { PlaybackStateCompat.ACTION_PLAY_PAUSE or PlaybackStateCompat.ACTION_SKIP_TO_NEXT or PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS or - PlaybackStateCompat.ACTION_STOP + PlaybackStateCompat.ACTION_STOP or + PlaybackStateCompat.ACTION_SEEK_TO private var wakeLockAcquireTime = -1L private var totalWakeLockTime = 0L diff --git a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/ui/shared/activity/BaseActivity.kt b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/ui/shared/activity/BaseActivity.kt index 29de98ca4..d6bc79def 100644 --- a/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/ui/shared/activity/BaseActivity.kt +++ b/src/musikdroid/app/src/main/java/io/casey/musikcube/remote/ui/shared/activity/BaseActivity.kt @@ -97,7 +97,6 @@ abstract class BaseActivity : AppCompatActivity(), ViewModel.Provider, Runner.Ta mixins.onDestroy() } - override fun onBackPressed() { (top as? IBackHandler)?.let { if (it.onBackPressed()) {