Use constants for proxy choices, part 2
This commit is contained in:
parent
a0b2197d8f
commit
810483ec74
@ -588,11 +588,12 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case DialogInterface.BUTTON_POSITIVE:
|
case DialogInterface.BUTTON_POSITIVE:
|
||||||
mPreferences.setProxyChoice(orbotInstalled ? 1 : 2);
|
mPreferences.setProxyChoice(orbotInstalled ?
|
||||||
|
Constants.PROXY_ORBOT : Constants.PROXY_I2P);
|
||||||
initializeProxy();
|
initializeProxy();
|
||||||
break;
|
break;
|
||||||
case DialogInterface.BUTTON_NEGATIVE:
|
case DialogInterface.BUTTON_NEGATIVE:
|
||||||
mPreferences.setProxyChoice(0);
|
mPreferences.setProxyChoice(Constants.NO_PROXY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ public class PreferenceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getProxyChoice() {
|
public int getProxyChoice() {
|
||||||
return mPrefs.getInt(Name.PROXY_CHOICE, 0);
|
return mPrefs.getInt(Name.PROXY_CHOICE, Constants.NO_PROXY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserAgentChoice() {
|
public int getUserAgentChoice() {
|
||||||
@ -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.
|
* @param choice the proxy to use.
|
||||||
*/
|
*/
|
||||||
public void setProxyChoice(int choice) {
|
public void setProxyChoice(int choice) {
|
||||||
putBoolean(Name.USE_PROXY, choice != 0);
|
putBoolean(Name.USE_PROXY, choice != Constants.NO_PROXY);
|
||||||
putInt(Name.PROXY_CHOICE, choice);
|
putInt(Name.PROXY_CHOICE, choice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user