Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
8decaa38
Commit
8decaa38
authored
6 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Reuse playback notification if available
parent
03bcee5c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/PlaybackService.kt
+7
-4
7 additions, 4 deletions
vlc-android/src/org/videolan/vlc/PlaybackService.kt
with
7 additions
and
4 deletions
vlc-android/src/org/videolan/vlc/PlaybackService.kt
+
7
−
4
View file @
8decaa38
...
...
@@ -21,6 +21,7 @@ package org.videolan.vlc
import
android.annotation.TargetApi
import
android.app.KeyguardManager
import
android.app.Notification
import
android.app.PendingIntent
import
android.app.SearchManager
import
android.app.Service
...
...
@@ -565,13 +566,14 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
private
fun
forceForeground
()
{
val
ctx
=
this
@PlaybackService
val
notification
=
NotificationHelper
.
createPlaybackNotification
(
ctx
,
false
,
val
stopped
=
playlistManager
.
player
.
playbackState
==
PlaybackStateCompat
.
STATE_STOPPED
val
notification
=
if
(
this
::
notification
.
isInitialized
&&
!
stopped
)
notification
else
NotificationHelper
.
createPlaybackNotification
(
ctx
,
false
,
ctx
.
resources
.
getString
(
R
.
string
.
loading
),
""
,
""
,
null
,
false
,
mediaSession
.
sessionToken
,
sessionPendingIntent
)
startForeground
(
3
,
notification
)
isForeground
=
true
if
(
isVideoPlaying
||
AndroidDevices
.
showTvUi
(
this
)
||
playlistManager
.
player
.
playbackState
==
PlaybackStateCompat
.
STATE_STOPPED
)
hideNotification
(
true
)
if
(
isVideoPlaying
||
AndroidDevices
.
showTvUi
(
this
)
||
stopped
)
hideNotification
(
true
)
}
private
fun
sendStartSessionIdIntent
()
{
...
...
@@ -677,7 +679,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
if
(
cover
==
null
||
cover
.
isRecycled
)
cover
=
BitmapFactory
.
decodeResource
(
ctx
.
resources
,
R
.
drawable
.
ic_no_media
)
val
notification
=
NotificationHelper
.
createPlaybackNotification
(
ctx
,
notification
=
NotificationHelper
.
createPlaybackNotification
(
ctx
,
mw
.
hasFlag
(
MediaWrapper
.
MEDIA_FORCE_AUDIO
),
title
,
artist
,
album
,
cover
,
playing
,
sessionToken
,
sessionPendingIntent
)
if
(
isPlayingPopup
)
return
@launch
...
...
@@ -703,6 +705,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
}
}
}
private
lateinit
var
notification
:
Notification
private
fun
currentMediaHasFlag
(
flag
:
Int
):
Boolean
{
val
mw
=
playlistManager
.
getCurrentMedia
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment