M src/main/java/org/safcephfs/CephFSDocumentsProvider.java => src/main/java/org/safcephfs/CephFSDocumentsProvider.java +3 -1
@@ 154,10 154,12 @@ public class CephFSDocumentsProvider extends DocumentsProvider {
key = settings.getString("key", "");
id = settings.getString("id", "");
path = settings.getString("path", "");
+ String timeout = settings.getString("timeout", "");
+ timeout = timeout.matches("\\d+") ? timeout : "20";
cm = new CephMount(id);
cm.conf_set("mon_host", mon);
cm.conf_set("key", key);
- cm.conf_set("client_mount_timeout", "20");
+ cm.conf_set("client_mount_timeout", timeout);
checkPermissions = settings.getBoolean("permissions", true);
if (!checkPermissions) {
cm.conf_set("client_permissions", "false");
M src/main/java/org/safcephfs/MainActivity.java => src/main/java/org/safcephfs/MainActivity.java +6 -1
@@ 13,7 13,7 @@ import java.util.Arrays;
public class MainActivity extends PreferenceActivity
implements OnSharedPreferenceChangeListener {
- private EditTextPreference monText, pathText, idText, keyText;
+ private EditTextPreference monText, pathText, idText, keyText, timeoutText;
private void notifyRootChanges(){
Uri uri = DocumentsContract.buildRootsUri("org.safcephfs");
@@ 29,6 29,7 @@ public class MainActivity extends PreferenceActivity
pathText = (EditTextPreference) findPreference("path");
idText = (EditTextPreference) findPreference("id");
keyText = (EditTextPreference) findPreference("key");
+ timeoutText = (EditTextPreference) findPreference("timeout");
SharedPreferences settings = getPreferenceScreen().getSharedPreferences();
settings.registerOnSharedPreferenceChangeListener(this);
@@ 40,6 41,7 @@ public class MainActivity extends PreferenceActivity
idText.setSummary(settings.getString("id", ""));
if (!settings.getString("key", "").equals(""))
keyText.setSummary(getString(R.string.key_filled));
+ timeoutText.setSummary(settings.getString("timeout", ""));
}
@Override
@@ 71,6 73,9 @@ public class MainActivity extends PreferenceActivity
else
keyText.setSummary(getString(R.string.key_filled));
break;
+ case "timeout":
+ timeoutText.setSummary(settings.getString("timeout", ""));
+ break;
}
}
}
M src/main/res/values/strings.xml => src/main/res/values/strings.xml +1 -0
@@ 15,4 15,5 @@
<string name="misc">Miscellaneous Settings</string>
<string name="permissions">Enforce file permissions</string>
<string name="permissions_summary">Whether to enforce file permissions.</string>
+ <string name="timeout">Connection timeout in seconds</string>
</resources>
M src/main/res/xml/main_pre.xml => src/main/res/xml/main_pre.xml +3 -0
@@ 21,5 21,8 @@
<CheckBoxPreference android:key="permissions"
android:summary="@string/permissions_summary"
android:title="@string/permissions" />
+ <EditTextPreference android:key="timeout"
+ android:defaultValue="20"
+ android:title="@string/timeout" />
</PreferenceCategory>
</PreferenceScreen>