[Android] remove some unused arguments (Context)

Sébastien Toque git at videolan.org
Thu Oct 3 20:58:24 CEST 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Tue Oct  1 23:02:13 2013 +0200| [1263951fd108f6e163c1765dff565332daa5c88f] | committer: Sébastien Toque

remove some unused arguments (Context)

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=1263951fd108f6e163c1765dff565332daa5c88f
---

 vlc-android/src/org/videolan/vlc/AudioService.java           |   10 ++++------
 vlc-android/src/org/videolan/vlc/Media.java                  |    2 +-
 vlc-android/src/org/videolan/vlc/MediaDatabase.java          |    8 ++++----
 vlc-android/src/org/videolan/vlc/MediaLibrary.java           |    2 +-
 vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java     |    2 +-
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java  |    4 ++--
 6 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index dd6e9ca..770f14b 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -388,8 +388,7 @@ public class AudioService extends Service {
                     long length = service.mLibVLC.getLength();
                     MediaDatabase dbManager = MediaDatabase
                             .getInstance(VLCApplication.getAppContext());
-                    Media m = dbManager.getMedia(VLCApplication.getAppContext(),
-                            location);
+                    Media m = dbManager.getMedia(location);
                     /**
                      * 1) There is a media to update
                      * 2) It has a length of 0
@@ -941,7 +940,7 @@ public class AudioService extends Service {
             MediaDatabase db = MediaDatabase.getInstance(AudioService.this);
             for (int i = 0; i < mediaPathList.size(); i++) {
                 String location = mediaPathList.get(i);
-                Media media = db.getMedia(AudioService.this, location);
+                Media media = db.getMedia(location);
                 if(media == null) {
                     if(!validateLocation(location)) {
                         Log.w(TAG, "Invalid location " + location);
@@ -1031,7 +1030,7 @@ public class AudioService extends Service {
             MediaDatabase db = MediaDatabase.getInstance(AudioService.this);
             for (int i = 0; i < mediaLocationList.size(); i++) {
                 String location = mediaLocationList.get(i);
-                Media media = db.getMedia(AudioService.this, location);
+                Media media = db.getMedia(location);
                 if(media == null) {
                     if (!validateLocation(location)) {
                         showToast(getResources().getString(R.string.invalid_location, location), Toast.LENGTH_SHORT);
@@ -1302,7 +1301,7 @@ public class AudioService extends Service {
             String location = mLibVLC.getMediaList().getMRL(i);
             Media media;
             if(i != skip) {
-                media = db.getMedia(AudioService.this, location);
+                media = db.getMedia(location);
                 if(media == null) {
                     if (!validateLocation(location)) {
                         showToast(getResources().getString(R.string.invalid_location, location), Toast.LENGTH_SHORT);
@@ -1314,7 +1313,6 @@ public class AudioService extends Service {
             } else {
                 // Prevent re-parsing the media, which would mean losing the connection
                 media = new Media(
-                        getApplicationContext(),
                         URI,
                         0,
                         0,
diff --git a/vlc-android/src/org/videolan/vlc/Media.java b/vlc-android/src/org/videolan/vlc/Media.java
index 81d95a8..a5bbe1d 100644
--- a/vlc-android/src/org/videolan/vlc/Media.java
+++ b/vlc-android/src/org/videolan/vlc/Media.java
@@ -211,7 +211,7 @@ public class Media implements Comparable<Media> {
         }
     }
 
-    public Media(Context context, String location, long time, long length, int type,
+    public Media(String location, long time, long length, int type,
             Bitmap picture, String title, String artist, String genre, String album,
             int width, int height, String artworkURL, int audio, int spu) {
         mLocation = location;
diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 8b98954..e739609 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -340,7 +340,7 @@ public class MediaDatabase {
         return files;
     }
 
-    public synchronized HashMap<String, Media> getMedias(Context context) {
+    public synchronized HashMap<String, Media> getMedias() {
 
         Cursor cursor;
         HashMap<String, Media> medias = new HashMap<String, Media>();
@@ -371,7 +371,7 @@ public class MediaDatabase {
             if (cursor.moveToFirst()) {
                 do {
                     String location = cursor.getString(12);
-                    Media media = new Media(context, location,
+                    Media media = new Media(location,
                             cursor.getLong(0),      // MEDIA_TIME
                             cursor.getLong(1),      // MEDIA_LENGTH
                             cursor.getInt(2),       // MEDIA_TYPE
@@ -433,7 +433,7 @@ public class MediaDatabase {
         return times;
     }
 
-    public synchronized Media getMedia(Context context, String location) {
+    public synchronized Media getMedia(String location) {
 
         Cursor cursor;
         Media media = null;
@@ -463,7 +463,7 @@ public class MediaDatabase {
             return null;
         }
         if (cursor.moveToFirst()) {
-            media = new Media(context, location,
+            media = new Media(location,
                     cursor.getLong(0),
                     cursor.getLong(1),
                     cursor.getInt(2),
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 3c0137a..51ab085 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -225,7 +225,7 @@ public class MediaLibrary {
             directories.addAll(mediaDirs);
 
             // get all existing media items
-            HashMap<String, Media> existingMedias = DBManager.getMedias(mContext);
+            HashMap<String, Media> existingMedias = DBManager.getMedias();
 
             // list of all added files
             HashSet<String> addedLocations = new HashSet<String>();
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
index 9742035..c17a3f8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
@@ -67,7 +67,7 @@ public class HistoryAdapter extends BaseAdapter {
         MediaDatabase db = MediaDatabase.getInstance(VLCApplication.getAppContext());
         for(int i = 0; i < items.size(); i++) {
             if(db.mediaItemExists(items.get(i)))
-                mHistory.add(db.getMedia(VLCApplication.getAppContext(), items.get(i)));
+                mHistory.add(db.getMedia(items.get(i)));
             else
                 mHistory.add(new Media(items.get(i), libVLC.getPrimaryMediaList(), i));
         }
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 56b9d14..529d3d1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1385,7 +1385,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
         int time = (int) mLibVLC.getTime();
         int length = (int) mLibVLC.getLength();
         if (length == 0) {
-            Media media = MediaDatabase.getInstance(this).getMedia(this, mLocation);
+            Media media = MediaDatabase.getInstance(this).getMedia(mLocation);
             if (media != null)
                 length = (int) media.getLength();
         }
@@ -1533,7 +1533,7 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
         if (mLocation != null && mLocation.length() > 0 && !dontParse) {
             // restore last position
             SharedPreferences preferences = getSharedPreferences(PreferencesActivity.NAME, MODE_PRIVATE);
-            Media media = MediaDatabase.getInstance(this).getMedia(this, mLocation);
+            Media media = MediaDatabase.getInstance(this).getMedia(mLocation);
             if(media != null) {
                 // in media library
                 if(media.getTime() > 0 && !fromStart)



More information about the Android mailing list