[Android] Remove some libVLC.getExistingInstance() useless usages

Jean-Baptiste Kempf git at videolan.org
Mon Oct 15 14:01:19 CEST 2012


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Oct 15 14:00:45 2012 +0200| [cf45a20ea8d111eda75699062e97309b31072095] | committer: Jean-Baptiste Kempf

Remove some libVLC.getExistingInstance() useless usages

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

 vlc-android/src/org/videolan/vlc/LibVLC.java               |   10 +++++-----
 vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java |   11 ++++++-----
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/LibVLC.java b/vlc-android/src/org/videolan/vlc/LibVLC.java
index 4dcce9e..623516f 100644
--- a/vlc-android/src/org/videolan/vlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/vlc/LibVLC.java
@@ -89,7 +89,7 @@ public class LibVLC {
     /**
      * Singleton constructor of libVLC Without surface and vout to create the
      * thumbnail and get information e.g. on the MediaLibraryActivity
-     * 
+     *
      * @return libVLC instance
      * @throws LibVlcException
      */
@@ -108,7 +108,7 @@ public class LibVLC {
     /**
      * Return an existing instance of libVLC Call it when it is NOT important
      * that this fails
-     * 
+     *
      * @return libVLC instance OR null
      */
     public static LibVLC getExistingInstance() {
@@ -476,11 +476,11 @@ public class LibVLC {
 
     public native int getSpuTracksCount();
 
-    public native String nativeToURI(String path);
+    public static native String nativeToURI(String path);
 
-    public native void nativeReadDirectory(String path, ArrayList<String> res);
+    public static native void nativeReadDirectory(String path, ArrayList<String> res);
 
-    public native boolean nativeIsPathDirectory(String path);
+    public native static boolean nativeIsPathDirectory(String path);
 
     /**
      * Get the list of existing items in the media list (playlist)
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index ad22241..34d4be2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -128,7 +128,7 @@ public class DirectoryAdapter extends BaseAdapter {
             return;
 
         ArrayList<String> files = new ArrayList<String>();
-        LibVLC.getExistingInstance().nativeReadDirectory(path, files);
+        LibVLC.nativeReadDirectory(path, files);
         StringBuilder sb = new StringBuilder(100);
         /* If no sub-directories or I/O error don't crash */
         if(files == null || files.size() < 1) {
@@ -147,9 +147,9 @@ public class DirectoryAdapter extends BaseAdapter {
                 String newPath = sb.toString();
                 sb.setLength(0);
 
-                if(LibVLC.getExistingInstance().nativeIsPathDirectory(newPath)) {
+                if (LibVLC.nativeIsPathDirectory(newPath)) {
                     ArrayList<String> files_int = new ArrayList<String>();
-                    LibVLC.getExistingInstance().nativeReadDirectory(newPath, files_int);
+                    LibVLC.nativeReadDirectory(newPath, files_int);
                     if(files_int.size() < 8) { /* Optimisation: If there are more than 8
                                                    sub-folders, don't scan each one, otherwise
                                                    when scaled it is very slow to load */
@@ -293,7 +293,8 @@ public class DirectoryAdapter extends BaseAdapter {
 
     public boolean browse(String directoryName) {
         try {
-            this.mCurrentDir = new URI(LibVLC.getExistingInstance().nativeToURI(this.mCurrentDir + "/" + directoryName)).normalize().getPath();
+            this.mCurrentDir = new URI(LibVLC.nativeToURI(this.mCurrentDir
+                    + "/" + directoryName)).normalize().getPath();
             this.mCurrentDir = Util.stripTrailingSlash(this.mCurrentDir);
         } catch (URISyntaxException e) {
             e.printStackTrace();
@@ -318,7 +319,7 @@ public class DirectoryAdapter extends BaseAdapter {
     public String getMediaLocation(int position) {
         if (position >= mCurrentNode.children.size())
             return null;
-        return LibVLC.getExistingInstance().nativeToURI(
+        return LibVLC.nativeToURI(
                 this.mCurrentDir + "/" + mCurrentNode.children.get(position).name
         );
     }



More information about the Android mailing list