[Android] Clean some variables declaration

Geoffrey Métais git at videolan.org
Tue Jul 4 16:43:24 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jul  4 11:23:00 2017 +0200| [ed2826c17980b655dd51167971d2fce520cf9a6e] | committer: Geoffrey Métais

Clean some variables declaration

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

 .../src/org/videolan/vlc/PlaybackService.java       | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 969e9098b..79e6d1ce7 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -155,10 +155,10 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         return binder.getService();
     }
 
-    KeyguardManager mKeyguardManager;
+    private KeyguardManager mKeyguardManager;
     private SharedPreferences mSettings;
     private final IBinder mBinder = new LocalBinder();
-    private MediaWrapperList mMediaList = new MediaWrapperList();
+    private final MediaWrapperList mMediaList = new MediaWrapperList();
     private Medialibrary mMedialibrary;
     private MediaPlayer mMediaPlayer;
     private boolean mParsed = false;
@@ -167,21 +167,21 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
     private boolean mSwitchingToVideo = false;
     private boolean mVideoBackground = false;
 
-    final private ArrayList<Callback> mCallbacks = new ArrayList<>();
+    private final ArrayList<Callback> mCallbacks = new ArrayList<>();
     private boolean mDetectHeadset = true;
     private PowerManager.WakeLock mWakeLock;
     private final AtomicBoolean mExpanding = new AtomicBoolean(false);
     private final ExecutorService mExecutorService = Executors.newSingleThreadExecutor();
-    private AtomicBoolean mUpdateMeta = new AtomicBoolean(false);
+    private final AtomicBoolean mUpdateMeta = new AtomicBoolean(false);
 
     // Index management
     /**
      * Stack of previously played indexes, used in shuffle mode
      */
-    private Stack<Integer> mPrevious;
-    private int mCurrentIndex; // Set to -1 if no media is currently loaded
-    private int mPrevIndex; // Set to -1 if no previous media
-    private int mNextIndex; // Set to -1 if no next media
+    private final Stack<Integer> mPrevious = new Stack<>();
+    private int mCurrentIndex = -1; // Set to -1 if no media is currently loaded
+    private int mPrevIndex = -1; // Set to -1 if no previous media
+    private int mNextIndex = -1; // Set to -1 if no next media
 
     // Playback management
 
@@ -252,11 +252,6 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
         mDetectHeadset = mSettings.getBoolean("enable_headset_detection", true);
 
-        mCurrentIndex = -1;
-        mPrevIndex = -1;
-        mNextIndex = -1;
-        mPrevious = new Stack<>();
-
         // Make sure the audio player will acquire a wake-lock while playing. If we don't do
         // that, the CPU might go to sleep while the song is playing, causing playback to stop.
         PowerManager pm = (PowerManager) VLCApplication.getAppContext().getSystemService(Context.POWER_SERVICE);



More information about the Android mailing list