summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/Settings_Obscure.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-12-26 04:58:57 +0100
committerArne Schwabe <arne@rfc2549.org>2012-12-26 04:58:57 +0100
commit8a94d6c21681896f60054c18e2495ef8c53e6f7c (patch)
tree42f3214fe619e402d8f02f2164097e4717d07c16 /src/de/blinkt/openvpn/Settings_Obscure.java
parentfd7570835b7e7fdd335b55bc006791ecb402277b (diff)
parent58131bfbde80b433992ab2e7deabb0b63aac072e (diff)
Return to the old icon, I do not like the new ones yet...
Diffstat (limited to 'src/de/blinkt/openvpn/Settings_Obscure.java')
-rw-r--r--src/de/blinkt/openvpn/Settings_Obscure.java43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/de/blinkt/openvpn/Settings_Obscure.java b/src/de/blinkt/openvpn/Settings_Obscure.java
index f7a63043..160dbe0c 100644
--- a/src/de/blinkt/openvpn/Settings_Obscure.java
+++ b/src/de/blinkt/openvpn/Settings_Obscure.java
@@ -14,13 +14,15 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
private EditTextPreference mCustomConfig;
private ListPreference mLogverbosity;
private CheckBoxPreference mPersistent;
+ private ListPreference mConnectretrymax;
+ private EditTextPreference mConnectretry;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.vpn_obscure);
-
+
mUseRandomHostName = (CheckBoxPreference) findPreference("useRandomHostname");
mUseFloat = (CheckBoxPreference) findPreference("useFloat");
@@ -28,10 +30,17 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
mCustomConfig = (EditTextPreference) findPreference("customOptions");
mLogverbosity = (ListPreference) findPreference("verblevel");
mPersistent = (CheckBoxPreference) findPreference("usePersistTun");
-
+ mConnectretrymax = (ListPreference) findPreference("connectretrymax");
+ mConnectretry = (EditTextPreference) findPreference("connectretry");
+
mLogverbosity.setOnPreferenceChangeListener(this);
mLogverbosity.setSummary("%s");
+ mConnectretrymax.setOnPreferenceChangeListener(this);
+ mConnectretrymax.setSummary("%s");
+
+ mConnectretry.setOnPreferenceChangeListener(this);
+
loadSettings();
@@ -46,6 +55,12 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
mLogverbosity.setValue(mProfile.mVerb);
onPreferenceChange(mLogverbosity, mProfile.mVerb);
+
+ mConnectretrymax.setValue(mProfile.mConnectRetryMax);
+ onPreferenceChange(mConnectretrymax, mProfile.mConnectRetryMax);
+
+ mConnectretry.setText(mProfile.mConnectRetry);
+ onPreferenceChange(mConnectretry, mProfile.mConnectRetry);
}
@@ -55,7 +70,9 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
mProfile.mUseCustomConfig = mUseCustomConfig.isChecked();
mProfile.mCustomConfigOptions = mCustomConfig.getText();
mProfile.mVerb = mLogverbosity.getValue();
+ mProfile.mConnectRetryMax = mConnectretrymax.getValue();
mProfile.mPersistTun = mPersistent.isChecked();
+ mProfile.mConnectRetry = mConnectretry.getText();
}
@@ -69,7 +86,27 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
mLogverbosity.setDefaultValue(newValue);
//This is idiotic.
int i =Integer.parseInt((String) newValue);
- mLogverbosity.setSummary(mLogverbosity.getEntries()[i]);
+
+ // verb >= 5 is not supported by the chooser
+ if(i < mLogverbosity.getEntries().length )
+ mLogverbosity.setSummary(mLogverbosity.getEntries()[i]);
+ else
+ mLogverbosity.setSummary(String.format("debug verbosity: %d",i));
+ } else if (preference == mConnectretrymax) {
+ if(newValue==null) {
+ newValue="5";
+ }
+ mConnectretrymax.setDefaultValue(newValue);
+
+ for(int i=0;i<mConnectretrymax.getEntryValues().length;i++){
+ if(mConnectretrymax.getEntryValues().equals(newValue))
+ mConnectretrymax.setSummary(mConnectretrymax.getEntries()[i]);
+ }
+
+ } else if (preference == mConnectretry) {
+ if(newValue==null || newValue=="")
+ newValue="5";
+ mConnectretry.setSummary(String.format("%s s" , newValue));
}
return true;