M src/main/java/org/safsftp/MainActivity.java => src/main/java/org/safsftp/MainActivity.java +11 -1
@@ 10,7 10,8 @@ import android.os.Bundle;
public class MainActivity extends PreferenceActivity
implements OnSharedPreferenceChangeListener {
- private EditTextPreference hostText, portText, usernameText, passwdText;
+ private EditTextPreference hostText, portText, usernameText, passwdText,
+ mountpointText;
private void notifyRootChanges(){
Uri uri=DocumentsContract.buildRootsUri("org.safsftp");
@@ 26,6 27,7 @@ public class MainActivity extends PreferenceActivity
portText=(EditTextPreference)findPreference("port");
usernameText=(EditTextPreference)findPreference("username");
passwdText=(EditTextPreference)findPreference("passwd");
+ mountpointText=(EditTextPreference)findPreference("mountpoint");
SharedPreferences settings=getPreferenceScreen().getSharedPreferences();
settings.registerOnSharedPreferenceChangeListener(this);
@@ 37,6 39,8 @@ public class MainActivity extends PreferenceActivity
usernameText.setSummary(settings.getString("username", ""));
if (!settings.getString("passwd", "").equals(""))
passwdText.setSummary(getString(R.string.passwd_filled));
+ if (!settings.getString("mountpoint", "").equals(""))
+ mountpointText.setSummary(settings.getString("mountpoint",""));
}
@Override
@@ 68,6 72,12 @@ public class MainActivity extends PreferenceActivity
else
passwdText.setSummary(getString(R.string.passwd_filled));
break;
+ case "mountpoint":
+ if (settings.getString("mountpoint", "").equals(""))
+ mountpointText.setSummary(getString(R.string.mountpoint_summary));
+ else
+ mountpointText.setSummary(settings.getString("mountpoint",""));
+ break;
}
}
}
M src/main/java/org/safsftp/SFTPDocumentsProvider.java => src/main/java/org/safsftp/SFTPDocumentsProvider.java +3 -1
@@ 223,9 223,11 @@ public class SFTPDocumentsProvider extends DocumentsProvider {
.getDefaultSharedPreferences(getContext());
host=settings.getString("host","");
port=settings.getString("port","22");
+ String mountpoint=settings.getString("mountpoint",".");
+ if(mountpoint.equals(""))mountpoint=".";
MatrixCursor.RowBuilder row=result.newRow();
row.add(Root.COLUMN_ROOT_ID,host+":"+port);
- row.add(Root.COLUMN_DOCUMENT_ID,host+":"+port+"/.");
+ row.add(Root.COLUMN_DOCUMENT_ID,host+":"+port+"/"+mountpoint);
row.add(Root.COLUMN_FLAGS,0);
row.add(Root.COLUMN_TITLE,"SFTP "+host+":"+port);
row.add(Root.COLUMN_ICON,R.mipmap.sym_def_app_icon);
M src/main/res/values/strings.xml => src/main/res/values/strings.xml +2 -0
@@ 8,6 8,8 @@
<string name="port_summary">Port to connect.</string>
<string name="username">Username</string>
<string name="username_summary">Username to connect.</string>
+ <string name="mountpoint">Path to mount</string>
+ <string name="mountpoint_summary">Path on the server to mount.</string>
<string name="auth">Authentication Details</string>
<string name="passwd">Password</string>
<string name="passwd_summary">Password.</string>
M src/main/res/xml/main_pre.xml => src/main/res/xml/main_pre.xml +3 -0
@@ 11,6 11,9 @@
<EditTextPreference android:key="username"
android:summary="@string/username_summary"
android:title="@string/username" />
+ <EditTextPreference android:key="mountpoint"
+ android:summary="@string/mountpoint_summary"
+ android:title="@string/mountpoint" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/auth">
<EditTextPreference android:title="@string/passwd"