Skip to content

Commit 92b0861

Browse files
committed
wip
1 parent 3b2896a commit 92b0861

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

app/src/main/kotlin/org/akanework/gramophone/logic/GramophonePlaybackService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ class GramophonePlaybackService : MediaLibraryService(), MediaSessionService.Lis
248248
internalPlaybackThread.start()
249249
playbackHandler = Handler(internalPlaybackThread.looper)
250250
handler = Handler(Looper.getMainLooper())
251-
setForegroundServiceTimeoutMs(120000)
252251
nm = NotificationManagerCompat.from(this)
253252
prefs = PreferenceManager.getDefaultSharedPreferences(this)
254253
setListener(this)
255254
setMediaNotificationProvider(
256255
MeiZuLyricsMediaNotificationProvider(this) { lastSentHighlightedLyric }
257256
)
257+
setForegroundServiceTimeoutMs(120000)
258258
if (mayThrowForegroundServiceStartNotAllowed()
259259
|| mayThrowForegroundServiceStartNotAllowedMiui()
260260
) {

app/src/main/kotlin/org/akanework/gramophone/logic/ui/MeiZuLyricsMediaNotificationProvider.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class MeiZuLyricsMediaNotificationProvider(
6262
) {
6363
onNotificationChangedCallback.onNotificationChanged(it.also {
6464
if (ticker != null)
65-
it.applyNotificationFlags(false)
65+
it.applyNotificationFlags(true, false)
6666
})
6767
}.also {
68-
if (ticker != null)
69-
it.applyNotificationFlags(isManualNotificationUpdate)
68+
if (ticker != null || isManualNotificationUpdate)
69+
it.applyNotificationFlags(ticker != null, isManualNotificationUpdate)
7070
}
7171
}
7272

@@ -76,10 +76,11 @@ class MeiZuLyricsMediaNotificationProvider(
7676
extras: Bundle
7777
) = inner.handleCustomCommand(session, action, extras)
7878

79-
private fun MediaNotification.applyNotificationFlags(onlyUpdateTicker: Boolean) {
79+
private fun MediaNotification.applyNotificationFlags(alwaysShowTicker: Boolean, onlyUpdateTicker: Boolean) {
8080
notification.apply {
8181
// Keep the status bar lyrics scrolling
82-
flags = flags.or(FLAG_ALWAYS_SHOW_TICKER)
82+
if (alwaysShowTicker)
83+
flags = flags.or(FLAG_ALWAYS_SHOW_TICKER)
8384
// Only update the ticker (lyrics), and do not update other properties
8485
if (onlyUpdateTicker)
8586
flags = flags.or(FLAG_ONLY_UPDATE_TICKER)

0 commit comments

Comments
 (0)