[Android] And more of the same

Jean-Baptiste Kempf git at videolan.org
Fri Jun 22 21:11:45 CEST 2012


android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jun 22 20:56:59 2012 +0200| [768c84e0680302cbf0dd3037797274212b951499] | committer: Jean-Baptiste Kempf

And more of the same

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=768c84e0680302cbf0dd3037797274212b951499
---

 vlc-android/src/org/videolan/vlc/AudioService.java         |   12 ++++++++----
 .../src/org/videolan/vlc/AudioServiceController.java       |    4 ++--
 vlc-android/src/org/videolan/vlc/Media.java                |    3 ++-
 vlc-android/src/org/videolan/vlc/MediaLibrary.java         |   10 ++++++----
 vlc-android/src/org/videolan/vlc/ThumbnailerManager.java   |    5 +++--
 vlc-android/src/org/videolan/vlc/gui/SearchActivity.java   |    5 +++--
 6 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 12c7c49..e83f959 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -124,7 +124,7 @@ public class AudioService extends Service {
         return mInterface;
     }
 
-    private BroadcastReceiver serviceReceiver = new BroadcastReceiver() {
+    private final BroadcastReceiver serviceReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
             String action = intent.getAction();
@@ -249,7 +249,7 @@ public class AudioService extends Service {
     /**
      * Handle libvlc asynchronous events
      */
-    private Handler mEventHandler = new Handler() {
+    private final Handler mEventHandler = new Handler() {
 
         @Override
         public void handleMessage(Message msg) {
@@ -295,7 +295,7 @@ public class AudioService extends Service {
             updateWidget(this);
     }
 
-    private Handler mHandler = new Handler() {
+    private final Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
@@ -438,7 +438,7 @@ public class AudioService extends Service {
         return null;
     }
 
-    private IAudioService.Stub mInterface = new IAudioService.Stub() {
+    private final IAudioService.Stub mInterface = new IAudioService.Stub() {
 
         @Override
         public String getCurrentMediaLocation() throws RemoteException {
@@ -504,6 +504,7 @@ public class AudioService extends Service {
                 return null;
         }
 
+        @Override
         public Bitmap getCover() {
             if (mCurrentMedia != null) {
                 return AudioService.this.getCover();
@@ -585,6 +586,7 @@ public class AudioService extends Service {
             }
         }
 
+        @Override
         public List<String> getItems() {
             ArrayList<String> medias = new ArrayList<String>();
             for (int i = 0; i < mMediaList.size(); i++) {
@@ -594,6 +596,7 @@ public class AudioService extends Service {
             return medias;
         }
 
+        @Override
         public String getItem() {
             return mCurrentMedia != null
                     ? mCurrentMedia.getLocation()
@@ -610,6 +613,7 @@ public class AudioService extends Service {
             AudioService.this.previous();
         }
 
+        @Override
         public void shuffle() throws RemoteException {
             AudioService.this.shuffle();
         }
diff --git a/vlc-android/src/org/videolan/vlc/AudioServiceController.java b/vlc-android/src/org/videolan/vlc/AudioServiceController.java
index 2f2df4f..5f6ef61 100644
--- a/vlc-android/src/org/videolan/vlc/AudioServiceController.java
+++ b/vlc-android/src/org/videolan/vlc/AudioServiceController.java
@@ -46,8 +46,8 @@ public class AudioServiceController implements IAudioPlayerControl {
     private static boolean mIsBound = false;
     private IAudioService mAudioServiceBinder;
     private ServiceConnection mAudioServiceConnection;
-    private ArrayList<IAudioPlayer> mAudioPlayer;
-    private IAudioServiceCallback mCallback = new IAudioServiceCallback.Stub() {
+    private final ArrayList<IAudioPlayer> mAudioPlayer;
+    private final IAudioServiceCallback mCallback = new IAudioServiceCallback.Stub() {
         @Override
         public void update() throws RemoteException {
             updateAudioPlayer();
diff --git a/vlc-android/src/org/videolan/vlc/Media.java b/vlc-android/src/org/videolan/vlc/Media.java
index 628b05f..176a486 100644
--- a/vlc-android/src/org/videolan/vlc/Media.java
+++ b/vlc-android/src/org/videolan/vlc/Media.java
@@ -86,7 +86,7 @@ public class Media implements Comparable<Media> {
     private String mEncodedBy;
     private String mTrackID;
 
-    private String mLocation;
+    private final String mLocation;
     private String mFilename;
     private long mTime = 0;
     private long mLength = 0;
@@ -162,6 +162,7 @@ public class Media implements Comparable<Media> {
     /**
      * Compare the filenames to sort items
      */
+    @Override
     public int compareTo(Media another) {
         return mTitle.toUpperCase().compareTo(
                 another.getTitle().toUpperCase());
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 9bd2466..6f2ae3e 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -44,9 +44,9 @@ public class MediaLibrary {
     public static final int MEDIA_ITEMS_UPDATED = 100;
 
     private static MediaLibrary mInstance;
-    private DatabaseManager mDBManager;
-    private ArrayList<Media> mItemList;
-    private ArrayList<Handler> mUpdateHandler;
+    private final DatabaseManager mDBManager;
+    private final ArrayList<Media> mItemList;
+    private final ArrayList<Handler> mUpdateHandler;
     protected Thread mLoadingThread;
 
     private MediaLibrary(Context context) {
@@ -152,13 +152,14 @@ public class MediaLibrary {
 
     private class GetMediaItemsRunnable implements Runnable {
 
-        private Stack<File> directories = new Stack<File>();
+        private final Stack<File> directories = new Stack<File>();
         private Context mContext;
 
         public GetMediaItemsRunnable(Context context) {
             mContext = context;
         }
 
+        @Override
         public void run() {
             // Initialize variables
             SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mContext);
@@ -271,6 +272,7 @@ public class MediaLibrary {
      */
     private class MediaItemFilter implements FileFilter {
 
+        @Override
         public boolean accept(File f) {
             boolean accepted = false;
             if (!f.isHidden()) {
diff --git a/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java b/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java
index 0b3271e..6c8a350 100644
--- a/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java
+++ b/vlc-android/src/org/videolan/vlc/ThumbnailerManager.java
@@ -45,9 +45,9 @@ public class ThumbnailerManager extends Thread {
     private final Condition notEmpty = lock.newCondition();
 
     private LibVLC mLibVlc;
-    private VideoListFragment mVideoListActivity;
+    private final VideoListFragment mVideoListActivity;
     private int totalCount;
-    private float mDensity;
+    private final float mDensity;
 
     public ThumbnailerManager(VideoListFragment videoListActivity) {
         mVideoListActivity = videoListActivity;
@@ -89,6 +89,7 @@ public class ThumbnailerManager extends Thread {
     /**
      * Thread main function.
      */
+    @Override
     public void run() {
         int count = 0;
         int total = 0;
diff --git a/vlc-android/src/org/videolan/vlc/gui/SearchActivity.java b/vlc-android/src/org/videolan/vlc/gui/SearchActivity.java
index 83f5b58..45d286a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SearchActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SearchActivity.java
@@ -171,7 +171,7 @@ public class SearchActivity extends ListActivity {
         setListAdapter(mHistoryAdapter);
     }
 
-    private TextWatcher searchTextWatcher = new TextWatcher() {
+    private final TextWatcher searchTextWatcher = new TextWatcher() {
 
         @Override
         public void onTextChanged(CharSequence s, int start, int before, int count) {
@@ -221,7 +221,7 @@ public class SearchActivity extends ListActivity {
         return super.onOptionsItemSelected(item);
     }
 
-    private OnEditorActionListener searchTextListener = new OnEditorActionListener() {
+    private final OnEditorActionListener searchTextListener = new OnEditorActionListener() {
         @Override
         public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
             InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -230,6 +230,7 @@ public class SearchActivity extends ListActivity {
         }
     };
 
+    @Override
     protected void onListItemClick(ListView l, View v, int position, long id) {
         if (getListAdapter() == mHistoryAdapter) {
             String selection = ((TextView) v.findViewById(android.R.id.text1)).getText().toString();



More information about the Android mailing list