diff --git a/app/src/main/java/acr/browser/lightning/activity/SettingsActivity.java b/app/src/main/java/acr/browser/lightning/activity/SettingsActivity.java
index 80e17ec..9ee017a 100644
--- a/app/src/main/java/acr/browser/lightning/activity/SettingsActivity.java
+++ b/app/src/main/java/acr/browser/lightning/activity/SettingsActivity.java
@@ -98,7 +98,10 @@ public class SettingsActivity extends ThemableSettingsActivity {
mProxyChoiceName = (TextView) findViewById(R.id.proxyChoiceName);
mProxyChoices = this.getResources().getStringArray(R.array.proxy_choices_array);
int choice = mPreferences.getProxyChoice();
- mProxyChoiceName.setText(mProxyChoices[choice]);
+ if (choice == Constants.PROXY_MANUAL)
+ mProxyChoiceName.setText(mPreferences.getProxyHost() + ":" + mPreferences.getProxyPort());
+ else
+ mProxyChoiceName.setText(mProxyChoices[choice]);
CheckBox flash = (CheckBox) findViewById(R.id.cbFlash);
CheckBox adblock = (CheckBox) findViewById(R.id.cbAdblock);
@@ -337,6 +340,10 @@ public class SettingsActivity extends ThemableSettingsActivity {
ih.promptToInstall(this);
}
break;
+
+ case Constants.PROXY_MANUAL:
+ manualProxyPicker();
+ break;
}
mPreferences.setProxyChoice(choice);
@@ -344,6 +351,29 @@ public class SettingsActivity extends ThemableSettingsActivity {
mProxyChoiceName.setText(mProxyChoices[choice]);
}
+ public void manualProxyPicker() {
+ View v = getLayoutInflater().inflate(R.layout.picker_manual_proxy, null);
+ final EditText eProxyHost = (EditText) v.findViewById(R.id.proxyHost);
+ final EditText eProxyPort = (EditText) v.findViewById(R.id.proxyPort);
+ eProxyHost.setText(mPreferences.getProxyHost());
+ eProxyPort.setText(Integer.toString(mPreferences.getProxyPort()));
+
+ new AlertDialog.Builder(mActivity)
+ .setTitle(R.string.manual_proxy)
+ .setView(v)
+ .setPositiveButton(R.string.action_ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i) {
+ String proxyHost = eProxyHost.getText().toString();
+ int proxyPort = Integer.parseInt(eProxyPort.getText().toString());
+ mPreferences.setProxyHost(proxyHost);
+ mPreferences.setProxyPort(proxyPort);
+ mProxyChoiceName.setText(proxyHost + ":" + proxyPort);
+ }
+ })
+ .show();
+ }
+
public void agentPicker() {
final AlertDialog.Builder agentStringPicker = new AlertDialog.Builder(mActivity);
diff --git a/app/src/main/java/acr/browser/lightning/constant/Constants.java b/app/src/main/java/acr/browser/lightning/constant/Constants.java
index 4c15eb9..c3ba14c 100644
--- a/app/src/main/java/acr/browser/lightning/constant/Constants.java
+++ b/app/src/main/java/acr/browser/lightning/constant/Constants.java
@@ -43,4 +43,5 @@ public final class Constants {
public static final int NO_PROXY = 0;
public static final int PROXY_ORBOT = 1;
public static final int PROXY_I2P = 2;
+ public static final int PROXY_MANUAL = 3;
}
diff --git a/app/src/main/java/acr/browser/lightning/preference/PreferenceManager.java b/app/src/main/java/acr/browser/lightning/preference/PreferenceManager.java
index 224959f..c6d1316 100644
--- a/app/src/main/java/acr/browser/lightning/preference/PreferenceManager.java
+++ b/app/src/main/java/acr/browser/lightning/preference/PreferenceManager.java
@@ -423,6 +423,14 @@ public class PreferenceManager {
putInt(Name.PROXY_CHOICE, choice);
}
+ public void setProxyHost(String proxyHost) {
+ putString(Name.USE_PROXY_HOST, proxyHost);
+ }
+
+ public void setProxyPort(int proxyPort) {
+ putInt(Name.USE_PROXY_PORT, proxyPort);
+ }
+
public void setUserAgentChoice(int choice) {
putInt(Name.USER_AGENT, choice);
}
diff --git a/app/src/main/res/layout/picker_manual_proxy.xml b/app/src/main/res/layout/picker_manual_proxy.xml
new file mode 100644
index 0000000..f8568ac
--- /dev/null
+++ b/app/src/main/res/layout/picker_manual_proxy.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 392068c..71099f3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -163,7 +163,11 @@
- None
- Orbot
- I2P
+ - Manual
+ Manual proxy
+ Host:
+ Port:
It looks like you have Orbot installed. Do you want to use Tor?
It looks like you have I2P installed. Do you want to use I2P?
Please install Orbot in order to proxy with Tor.