Browse Source

Use constants for proxy choices, part 2

master
str4d 10 years ago
parent
commit
810483ec74
  1. 5
      app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java
  2. 11
      app/src/main/java/acr/browser/lightning/preference/PreferenceManager.java

5
app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

@ -588,11 +588,12 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -588,11 +588,12 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
mPreferences.setProxyChoice(orbotInstalled ? 1 : 2);
mPreferences.setProxyChoice(orbotInstalled ?
Constants.PROXY_ORBOT : Constants.PROXY_I2P);
initializeProxy();
break;
case DialogInterface.BUTTON_NEGATIVE:
mPreferences.setProxyChoice(0);
mPreferences.setProxyChoice(Constants.NO_PROXY);
break;
}
}

11
app/src/main/java/acr/browser/lightning/preference/PreferenceManager.java

@ -233,7 +233,7 @@ public class PreferenceManager { @@ -233,7 +233,7 @@ public class PreferenceManager {
}
public int getProxyChoice() {
return mPrefs.getInt(Name.PROXY_CHOICE, 0);
return mPrefs.getInt(Name.PROXY_CHOICE, Constants.NO_PROXY);
}
public int getUserAgentChoice() {
@ -409,12 +409,17 @@ public class PreferenceManager { @@ -409,12 +409,17 @@ public class PreferenceManager {
}
/**
* 0: None. 1: Orbot. 2: I2P.
* Valid choices:
* <ul>
* <li>{@link Constants#NO_PROXY}</li>
* <li>{@link Constants#PROXY_ORBOT}</li>
* <li>{@link Constants#PROXY_I2P}</li>
* </ul>
*
* @param choice the proxy to use.
*/
public void setProxyChoice(int choice) {
putBoolean(Name.USE_PROXY, choice != 0);
putBoolean(Name.USE_PROXY, choice != Constants.NO_PROXY);
putInt(Name.PROXY_CHOICE, choice);
}

Loading…
Cancel
Save