[Android] Assorted DirectoryAdapter and fragment fixes

Edward Wang git at videolan.org
Mon May 20 05:40:22 CEST 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun May 19 23:11:03 2013 -0400| [4c432b3f3c136f42a5cde553e57beec9369dadd1] | committer: Edward Wang

Assorted DirectoryAdapter and fragment fixes

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

 .../src/org/videolan/vlc/gui/DirectoryAdapter.java        |   13 ++++++-------
 .../src/org/videolan/vlc/gui/DirectoryViewFragment.java   |    2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index d65fec6..37ed603 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -100,14 +100,14 @@ public class DirectoryAdapter extends BaseAdapter {
 
         public Boolean existsChild(String _n) {
             for(DirectoryAdapter.Node n : this.children) {
-                if(n.name == _n) return true;
+                if(n.name.equals(_n)) return true;
             }
             return false;
         }
 
         public DirectoryAdapter.Node ensureExists(String _n) {
             for(DirectoryAdapter.Node n : this.children) {
-                if(n.name == _n) return n;
+                if(n.name.equals(_n)) return n;
             }
             DirectoryAdapter.Node nn = new Node(_n);
             this.children.add(nn);
@@ -117,7 +117,7 @@ public class DirectoryAdapter extends BaseAdapter {
         public int subfolderCount() {
             int c = 0;
             for(DirectoryAdapter.Node n : this.children) {
-                if(n.isFile() == false && n.name != "..") c++;
+                if(n.isFile() == false && !n.name.equals("..")) c++;
             }
             return c;
         }
@@ -303,7 +303,7 @@ public class DirectoryAdapter extends BaseAdapter {
         } else
             holder.title.setText(selectedNode.getVisibleName());
 
-        if(selectedNode.name == "..")
+        if(selectedNode.name.equals(".."))
             holderText = context.getString(R.string.parent_folder);
         else if(!selectedNode.isFile()) {
             int folderCount = selectedNode.subfolderCount();
@@ -344,8 +344,7 @@ public class DirectoryAdapter extends BaseAdapter {
                 storage = Util.stripTrailingSlash(storage);
                 if (storage.endsWith(directoryName)) {
                     this.mCurrentRoot = storage;
-                    this.mCurrentDir = storage;
-                    this.mCurrentDir = Util.stripTrailingSlash(this.mCurrentDir);
+                    this.mCurrentDir = Util.stripTrailingSlash(storage);
                     break;
                 }
             }
@@ -357,7 +356,7 @@ public class DirectoryAdapter extends BaseAdapter {
                 this.mCurrentDir = Util.stripTrailingSlash(this.mCurrentDir);
 
                 if (this.mCurrentDir.equals(getParentDir(this.mCurrentRoot))) {
-                    // Returning on the storage list
+                    // Returning to the storage list
                     this.mCurrentDir = null;
                     this.mCurrentRoot = null;
                 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index 06fea18..e90bc90 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -162,7 +162,7 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
     }
 
     public void showParentDirectory() {
-            mDirectoryAdapter.browse("..");
+        mDirectoryAdapter.browse("..");
     };
 
     private void openMediaFile(int p) {



More information about the Android mailing list