Skip to content

Commit 146403f

Browse files
committed
暂停时如果桌面歌词是锁定状态则隐藏 closes #321
1 parent e266275 commit 146403f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

app/src/main/java/remix/myplayer/lyric/LyricManager.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ class LyricManager @Inject constructor(
198198
@UiThread
199199
private fun ensureDesktopLyric() {
200200
val shouldShow =
201-
isServiceAvailable && isNotifyShowing && isScreenOn && !isAppInForeground && isDesktopLyricEnabled
201+
isServiceAvailable && isNotifyShowing && isScreenOn && !isAppInForeground && isDesktopLyricEnabled &&
202+
(!isDesktopLyricLocked || isPlaying)
202203
if (shouldShow != (desktopLyricView != null)) {
203204
if (shouldShow) {
204205
createDesktopLyric()
@@ -211,22 +212,24 @@ class LyricManager @Inject constructor(
211212
var isDesktopLyricLocked: Boolean
212213
get() = desktopLyricPrefs.locked
213214
@UiThread set(value) {
215+
MessageNotifier.show(if (value) R.string.desktop_lyric__lock_ticker else R.string.desktop_lyric__unlock)
216+
214217
desktopLyricPrefs.locked = value
218+
_desktopUiState.value = _desktopUiState.value.copy(locked = value)
215219

216220
desktopLyricView?.run {
217-
_desktopUiState.value = _desktopUiState.value.copy(locked = value)
218-
219-
MessageNotifier.show(if (value) R.string.desktop_lyric__lock_ticker else R.string.desktop_lyric__unlock)
220221
(layoutParams as WindowManager.LayoutParams).apply {
221222
applyLockState(this, value)
222223
windowManager.updateViewLayout(this@run, this)
223224
}
225+
}
224226

225-
MusicServiceRemote.service?.run {
226-
updateNotification()
227-
updatePlaybackState()
228-
}
227+
MusicServiceRemote.service?.run {
228+
updateNotification()
229+
updatePlaybackState()
229230
}
231+
232+
ensureDesktopLyric()
230233
}
231234

232235
@UiThread
@@ -402,6 +405,7 @@ class LyricManager @Inject constructor(
402405
updateProgress()
403406
}
404407
}
408+
ensureDesktopLyric()
405409
}
406410
private var progress: Long = 0
407411
set(value) {

0 commit comments

Comments
 (0)