Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
theinthan soe
VLC-Android
Commits
17e00cf2
Commit
17e00cf2
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Create Notification channel at App Launch
parent
023accc3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vlc-android/src/org/videolan/vlc/VLCApplication.java
+3
-0
3 additions, 0 deletions
vlc-android/src/org/videolan/vlc/VLCApplication.java
vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
+7
-11
7 additions, 11 deletions
.../src/org/videolan/vlc/gui/helpers/NotificationHelper.java
with
10 additions
and
11 deletions
vlc-android/src/org/videolan/vlc/VLCApplication.java
+
3
−
0
View file @
17e00cf2
...
...
@@ -40,6 +40,7 @@ import org.videolan.vlc.gui.DialogActivity;
import
org.videolan.vlc.gui.dialogs.VlcProgressDialog
;
import
org.videolan.vlc.gui.helpers.AudioUtil
;
import
org.videolan.vlc.gui.helpers.BitmapCache
;
import
org.videolan.vlc.gui.helpers.NotificationHelper
;
import
org.videolan.vlc.util.AndroidDevices
;
import
org.videolan.vlc.util.Strings
;
import
org.videolan.vlc.util.VLCInstance
;
...
...
@@ -94,6 +95,8 @@ public class VLCApplication extends Application {
runBackground
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
AndroidUtil
.
isOOrLater
)
NotificationHelper
.
createNotificationChannel
();
// Prepare cache folder constants
AudioUtil
.
prepareCacheFolder
(
instance
);
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
+
7
−
11
View file @
17e00cf2
...
...
@@ -58,7 +58,6 @@ public class NotificationHelper {
final
PendingIntent
piPlay
=
PendingIntent
.
getBroadcast
(
ctx
,
0
,
new
Intent
(
PlaybackService
.
ACTION_REMOTE_PLAYPAUSE
),
PendingIntent
.
FLAG_UPDATE_CURRENT
);
final
PendingIntent
piForward
=
PendingIntent
.
getBroadcast
(
ctx
,
0
,
new
Intent
(
PlaybackService
.
ACTION_REMOTE_FORWARD
),
PendingIntent
.
FLAG_UPDATE_CURRENT
);
if
(
AndroidUtil
.
isOOrLater
)
{
createNotificationChannel
();
final
Notification
.
Builder
builder
=
new
Notification
.
Builder
(
ctx
,
"vlc_channel"
);
builder
.
setSmallIcon
(
video
?
R
.
drawable
.
ic_notif_video
:
R
.
drawable
.
ic_notif_audio
)
.
setVisibility
(
NotificationCompat
.
VISIBILITY_PUBLIC
)
...
...
@@ -121,7 +120,6 @@ public class NotificationHelper {
private
static
final
Intent
notificationIntent
=
new
Intent
();
public
static
Notification
createScanNotification
(
Context
ctx
,
String
progressText
,
boolean
updateActions
,
boolean
paused
)
{
if
(
AndroidUtil
.
isOOrLater
)
{
createNotificationChannel
();
if
(
scanBuilder
==
null
)
{
scanBuilder
=
new
Notification
.
Builder
(
ctx
,
"vlc_channel"
)
.
setContentIntent
(
PendingIntent
.
getActivity
(
ctx
,
0
,
new
Intent
(
ctx
,
StartActivity
.
class
),
PendingIntent
.
FLAG_UPDATE_CURRENT
))
...
...
@@ -170,16 +168,14 @@ public class NotificationHelper {
private
static
NotificationManager
sNotificationManager
;
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
p
rivate
static
void
createNotificationChannel
()
{
p
ublic
static
void
createNotificationChannel
()
{
if
(
sNotificationManager
==
null
)
sNotificationManager
=
(
NotificationManager
)
VLCApplication
.
getAppContext
().
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
if
(
sNotificationManager
.
getNotificationChannel
(
"vlc_channel"
)
==
null
)
{
final
CharSequence
name
=
VLCApplication
.
getAppResources
().
getString
(
R
.
string
.
app_name
);
final
String
description
=
VLCApplication
.
getAppResources
().
getString
(
R
.
string
.
app_name_full
);
final
int
importance
=
NotificationManager
.
IMPORTANCE_DEFAULT
;
NotificationChannel
mChannel
=
new
NotificationChannel
(
"vlc_channel"
,
name
,
importance
);
mChannel
.
setDescription
(
description
);
sNotificationManager
.
createNotificationChannel
(
mChannel
);
}
final
CharSequence
name
=
VLCApplication
.
getAppResources
().
getString
(
R
.
string
.
app_name
);
final
String
description
=
VLCApplication
.
getAppResources
().
getString
(
R
.
string
.
app_name_full
);
final
int
importance
=
NotificationManager
.
IMPORTANCE_DEFAULT
;
NotificationChannel
mChannel
=
new
NotificationChannel
(
"vlc_channel"
,
name
,
importance
);
mChannel
.
setDescription
(
description
);
sNotificationManager
.
createNotificationChannel
(
mChannel
);
}
}
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