Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Casanowow Life for love
VLC-Android
Commits
17e00cf2
Commit
17e00cf2
authored
Aug 23, 2017
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create Notification channel at App Launch
parent
023accc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
vlc-android/src/org/videolan/vlc/VLCApplication.java
vlc-android/src/org/videolan/vlc/VLCApplication.java
+3
-0
vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
.../src/org/videolan/vlc/gui/helpers/NotificationHelper.java
+7
-11
No files found.
vlc-android/src/org/videolan/vlc/VLCApplication.java
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
);
...
...
vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment