[Android] Pre-fill folder path with '/home/username'

Geoffrey Métais git at videolan.org
Wed Mar 2 11:36:59 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar  2 11:36:01 2016 +0100| [abcf974e4c8ba6d482bdef754a21caf8d4c04ea2] | committer: Geoffrey Métais

Pre-fill folder path with '/home/username'

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

 .../src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.java
index 1f6196c..c6732dc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.java
@@ -126,7 +126,7 @@ public class NetworkServerDialog extends DialogFragment implements AdapterView.O
             if (!TextUtils.isEmpty(mUri.getUserInfo()))
                 mEditUsername.setText(mUri.getUserInfo());
             if (!TextUtils.isEmpty(mUri.getPath()))
-                mEditFolder.setText(mUri.getPath().substring(1));
+                mEditFolder.setText(mUri.getPath());
             if (!TextUtils.isEmpty(mName))
                 mEditServername.setText(mName);
 
@@ -231,15 +231,18 @@ public class NetworkServerDialog extends DialogFragment implements AdapterView.O
     }
 
     @Override
-    public void onNothingSelected(AdapterView<?> parent) {
-
-    }
+    public void onNothingSelected(AdapterView<?> parent) {}
 
     @Override
     public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
 
     @Override
     public void onTextChanged(CharSequence s, int start, int before, int count) {
+        if (mEditUsername.hasFocus()) {
+            mEditFolder.removeTextChangedListener(this);
+            mEditFolder.setText("/home/" + mEditUsername.getText().toString());
+            mEditFolder.addTextChangedListener(this);
+        }
         updateUrl();
     }
 



More information about the Android mailing list