[Android] Remove useless global variable

Geoffrey Métais git at videolan.org
Fri Sep 1 17:40:00 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Sep  1 15:26:18 2017 +0200| [9c6ea1b6a8bb4af426feac89f16e9fc5c6438198] | committer: Geoffrey Métais

Remove useless global variable

> https://code.videolan.org/videolan/vlc-android/commit/9c6ea1b6a8bb4af426feac89f16e9fc5c6438198
---

 .../src/org/videolan/vlc/gui/helpers/NotificationHelper.java      | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java b/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
index af58edf3f..249cb651c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
@@ -168,24 +168,22 @@ public class NotificationHelper {
         }
     }
 
-    private static NotificationManager sNotificationManager;
     @RequiresApi(api = Build.VERSION_CODES.O)
     public static void createNotificationChannels() {
-        if (sNotificationManager == null)
-            sNotificationManager = (NotificationManager) VLCApplication.getAppContext().getSystemService(Context.NOTIFICATION_SERVICE);
+        final NotificationManager notificationManager = (NotificationManager) VLCApplication.getAppContext().getSystemService(Context.NOTIFICATION_SERVICE);
         // Playback channel
         CharSequence name = VLCApplication.getAppResources().getString(R.string.playback);
         String description = VLCApplication.getAppResources().getString(R.string.playback_controls);
         NotificationChannel channel = new NotificationChannel("vlc_playback", name, NotificationManager.IMPORTANCE_LOW);
         channel.setDescription(description);
         channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
-        sNotificationManager.createNotificationChannel(channel);
+        notificationManager.createNotificationChannel(channel);
         // Scan channel
         name = VLCApplication.getAppResources().getString(R.string.medialibrary_scan);
         description = VLCApplication.getAppResources().getString(R.string.Medialibrary_progress);
         channel = new NotificationChannel("vlc_medialibrary", name, NotificationManager.IMPORTANCE_LOW);
         channel.setDescription(description);
         channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
-        sNotificationManager.createNotificationChannel(channel);
+        notificationManager.createNotificationChannel(channel);
     }
 }



More information about the Android mailing list