Moved proxy code to utility class, remove proxy from lite version to reduce apk size
This commit is contained in:
parent
9dc9634299
commit
d8b8d2c047
50
app/app.iml
50
app/app.iml
@ -8,7 +8,7 @@
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="LightningPlusDebug" />
|
||||
<option name="SELECTED_BUILD_VARIANT" value="lightningPlusDebug" />
|
||||
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleLightningPlusDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileLightningPlusDebugSources" />
|
||||
@ -25,34 +25,34 @@
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/LightningPlus/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/LightningPlus/debug" />
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/lightningPlus/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/lightningPlus/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/LightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/LightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/LightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/LightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/LightningPlus/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/LightningPlus/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlusDebug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlusDebug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlusDebug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlusDebug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlusDebug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlusDebug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlusDebug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/LightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/LightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/LightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/LightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/LightningPlus/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/LightningPlus/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/lightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/lightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/lightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/lightningPlus/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/lightningPlus/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/lightningPlus/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlusDebug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/lightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/lightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/lightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/lightningPlus/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/lightningPlus/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/lightningPlus/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlus/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/lightningPlus/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/LightningPlus/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestLightningPlus/res" type="java-test-resource" />
|
||||
@ -93,6 +93,7 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/palette-v7/22.2.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/net.i2p.android/client/0.7/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
@ -110,6 +111,7 @@
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="client-0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="palette-v7-22.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
|
||||
|
@ -25,13 +25,13 @@ android {
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
LightningPlus {
|
||||
lightningPlus {
|
||||
buildConfigField "boolean", "FULL_VERSION", "true"
|
||||
applicationId "acr.browser.lightning"
|
||||
versionCode 78
|
||||
}
|
||||
|
||||
LightningFree {
|
||||
lightningLite {
|
||||
buildConfigField "boolean", "FULL_VERSION", "false"
|
||||
applicationId "acr.browser.barebones"
|
||||
versionCode 81
|
||||
@ -44,13 +44,10 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile(project(':libnetcipher')) {
|
||||
// Exclude any support-v4 modules because appcompat-v7 will import the latest
|
||||
exclude module: 'support-v4'
|
||||
exclude module: 'android-support-v4'
|
||||
}
|
||||
compile 'com.android.support:palette-v7:22.2.0'
|
||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||
compile 'org.jsoup:jsoup:1.8.1'
|
||||
compile 'net.i2p.android:client:0.7@aar'
|
||||
|
||||
lightningPlusCompile 'net.i2p.android:client:0.7'
|
||||
lightningPlusCompile(project(':libnetcipher'))
|
||||
}
|
||||
|
@ -0,0 +1,219 @@
|
||||
package acr.browser.lightning.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.util.Log;
|
||||
|
||||
import net.i2p.android.ui.I2PAndroidHelper;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.BrowserApp;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import info.guardianproject.onionkit.ui.OrbotHelper;
|
||||
import info.guardianproject.onionkit.web.WebkitProxy;
|
||||
|
||||
/**
|
||||
* 6/4/2015 Anthony Restaino
|
||||
*/
|
||||
public class ProxyUtils {
|
||||
// Helper
|
||||
private static I2PAndroidHelper mI2PHelper;
|
||||
private static boolean mI2PHelperBound;
|
||||
private static boolean mI2PProxyInitialized;
|
||||
private static PreferenceManager mPreferences;
|
||||
private static ProxyUtils mInstance;
|
||||
|
||||
private ProxyUtils(Context context) {
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
mI2PHelper = new I2PAndroidHelper(context);
|
||||
}
|
||||
|
||||
public static ProxyUtils getInstance(Context context) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new ProxyUtils(context);
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
/*
|
||||
* If Orbot/Tor or I2P is installed, prompt the user if they want to enable
|
||||
* proxying for this session
|
||||
*/
|
||||
public void checkForProxy(final Activity activity) {
|
||||
boolean useProxy = mPreferences.getUseProxy();
|
||||
|
||||
OrbotHelper oh = new OrbotHelper(activity.getApplicationContext());
|
||||
final boolean orbotInstalled = oh.isOrbotInstalled();
|
||||
boolean orbotChecked = mPreferences.getCheckedForTor();
|
||||
boolean orbot = orbotInstalled && !orbotChecked;
|
||||
|
||||
boolean i2pInstalled = mI2PHelper.isI2PAndroidInstalled();
|
||||
boolean i2pChecked = mPreferences.getCheckedForI2P();
|
||||
boolean i2p = i2pInstalled && !i2pChecked;
|
||||
|
||||
// TODO Is the idea to show this per-session, or only once?
|
||||
if (!useProxy && (orbot || i2p)) {
|
||||
if (orbot) mPreferences.setCheckedForTor(true);
|
||||
if (i2p) mPreferences.setCheckedForI2P(true);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
|
||||
if (orbotInstalled && i2pInstalled) {
|
||||
String[] proxyChoices = activity.getResources().getStringArray(R.array.proxy_choices_array);
|
||||
builder.setTitle(activity.getResources().getString(R.string.http_proxy))
|
||||
.setSingleChoiceItems(proxyChoices, mPreferences.getProxyChoice(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setProxyChoice(which);
|
||||
}
|
||||
})
|
||||
.setNeutralButton(activity.getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (mPreferences.getUseProxy())
|
||||
initializeProxy(activity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
mPreferences.setProxyChoice(orbotInstalled ?
|
||||
Constants.PROXY_ORBOT : Constants.PROXY_I2P);
|
||||
initializeProxy(activity);
|
||||
break;
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
mPreferences.setProxyChoice(Constants.NO_PROXY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
builder.setMessage(orbotInstalled ? R.string.use_tor_prompt : R.string.use_i2p_prompt)
|
||||
.setPositiveButton(R.string.yes, dialogClickListener)
|
||||
.setNegativeButton(R.string.no, dialogClickListener);
|
||||
}
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize WebKit Proxying
|
||||
*/
|
||||
private void initializeProxy(Activity activity) {
|
||||
String host;
|
||||
int port;
|
||||
|
||||
switch (mPreferences.getProxyChoice()) {
|
||||
case Constants.NO_PROXY:
|
||||
// We shouldn't be here
|
||||
return;
|
||||
|
||||
case Constants.PROXY_ORBOT:
|
||||
OrbotHelper oh = new OrbotHelper(activity.getApplicationContext());
|
||||
if (!oh.isOrbotRunning()) {
|
||||
oh.requestOrbotStart(activity);
|
||||
}
|
||||
host = "localhost";
|
||||
port = 8118;
|
||||
break;
|
||||
|
||||
case Constants.PROXY_I2P:
|
||||
mI2PProxyInitialized = true;
|
||||
if (mI2PHelperBound && !mI2PHelper.isI2PAndroidRunning()) {
|
||||
mI2PHelper.requestI2PAndroidStart(activity);
|
||||
}
|
||||
host = "localhost";
|
||||
port = 4444;
|
||||
break;
|
||||
|
||||
default:
|
||||
host = mPreferences.getProxyHost();
|
||||
port = mPreferences.getProxyPort();
|
||||
}
|
||||
|
||||
try {
|
||||
WebkitProxy.setProxy(BrowserApp.class.getName(), activity.getApplicationContext(),
|
||||
host, port);
|
||||
} catch (Exception e) {
|
||||
Log.d(Constants.TAG, "error enabling web proxying", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isProxyReady(Context context) {
|
||||
if (mPreferences.getProxyChoice() == Constants.PROXY_I2P) {
|
||||
if (!mI2PHelper.isI2PAndroidRunning()) {
|
||||
Utils.showToast(context, context.getString(R.string.i2p_not_running));
|
||||
return false;
|
||||
} else if (!mI2PHelper.areTunnelsActive()) {
|
||||
Utils.showToast(context, context.getString(R.string.i2p_tunnels_not_ready));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateProxySettings(Activity activity) {
|
||||
if (mPreferences.getUseProxy()) {
|
||||
initializeProxy(activity);
|
||||
} else {
|
||||
try {
|
||||
WebkitProxy.resetProxy(BrowserApp.class.getName(),
|
||||
activity.getApplicationContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mI2PProxyInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void onStop() {
|
||||
mI2PHelper.unbind();
|
||||
mI2PHelperBound = false;
|
||||
}
|
||||
|
||||
public void onStart(final Activity activity) {
|
||||
if (mPreferences.getProxyChoice() == Constants.PROXY_I2P) {
|
||||
// Try to bind to I2P Android
|
||||
mI2PHelper.bind(new I2PAndroidHelper.Callback() {
|
||||
@Override
|
||||
public void onI2PAndroidBound() {
|
||||
mI2PHelperBound = true;
|
||||
if (mI2PProxyInitialized && !mI2PHelper.isI2PAndroidRunning())
|
||||
mI2PHelper.requestI2PAndroidStart(activity);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public int setProxyChoice(int choice, Activity activity) {
|
||||
switch (choice) {
|
||||
case Constants.PROXY_ORBOT:
|
||||
OrbotHelper oh = new OrbotHelper(activity.getApplicationContext());
|
||||
if (!oh.isOrbotInstalled()) {
|
||||
choice = Constants.NO_PROXY;
|
||||
Utils.showToast(activity, activity.getResources().getString(R.string.install_orbot));
|
||||
}
|
||||
break;
|
||||
|
||||
case Constants.PROXY_I2P:
|
||||
I2PAndroidHelper ih = new I2PAndroidHelper(activity.getApplicationContext());
|
||||
if (!ih.isI2PAndroidInstalled()) {
|
||||
choice = Constants.NO_PROXY;
|
||||
ih.promptToInstall(activity);
|
||||
}
|
||||
break;
|
||||
case Constants.PROXY_MANUAL:
|
||||
break;
|
||||
}
|
||||
return choice;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package acr.browser.lightning.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* 6/4/2015 Anthony Restaino
|
||||
*/
|
||||
public class ProxyUtils {
|
||||
|
||||
private static ProxyUtils mInstance;
|
||||
|
||||
private ProxyUtils(Context context) {
|
||||
|
||||
}
|
||||
|
||||
public static ProxyUtils getInstance(Context context) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new ProxyUtils(context);
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
/*
|
||||
* If Orbot/Tor or I2P is installed, prompt the user if they want to enable
|
||||
* proxying for this session
|
||||
*/
|
||||
public void checkForProxy(final Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize WebKit Proxying
|
||||
*/
|
||||
private void initializeProxy(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
public boolean isProxyReady(Context context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateProxySettings(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
public void onStop() {
|
||||
|
||||
}
|
||||
|
||||
public void onStart(final Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
public int setProxyChoice(int choice, Activity activity) {
|
||||
return choice;
|
||||
}
|
||||
}
|
@ -92,8 +92,6 @@ import android.widget.TextView.OnEditorActionListener;
|
||||
import android.widget.Toast;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import net.i2p.android.ui.I2PAndroidHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
@ -124,11 +122,10 @@ import acr.browser.lightning.object.ClickHandler;
|
||||
import acr.browser.lightning.object.DrawerArrowDrawable;
|
||||
import acr.browser.lightning.object.SearchAdapter;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.ProxyUtils;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
import acr.browser.lightning.view.AnimatedProgressBar;
|
||||
import acr.browser.lightning.view.LightningView;
|
||||
import info.guardianproject.onionkit.ui.OrbotHelper;
|
||||
import info.guardianproject.onionkit.web.WebkitProxy;
|
||||
|
||||
public class BrowserActivity extends ThemableActivity implements BrowserController, OnClickListener {
|
||||
|
||||
@ -165,7 +162,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
// Context
|
||||
private Activity mActivity;
|
||||
|
||||
// Native
|
||||
// Primatives
|
||||
private boolean mSystemBrowser = false, mIsNewIntent = false, mFullScreen, mColorMode,
|
||||
mDarkTheme;
|
||||
private int mOriginalOrientation, mBackgroundColor, mIdGenerator;
|
||||
@ -182,10 +179,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
private Drawable mDeleteIcon, mRefreshIcon, mCopyIcon, mIcon;
|
||||
private DrawerArrowDrawable mArrowDrawable;
|
||||
|
||||
// Helper
|
||||
private I2PAndroidHelper mI2PHelper;
|
||||
private boolean mI2PHelperBound;
|
||||
private boolean mI2PProxyInitialized;
|
||||
// Proxy
|
||||
private ProxyUtils mProxyUtils;
|
||||
|
||||
// Constant
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
@ -269,7 +264,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
R.id.arrow_button);
|
||||
arrowButton.setOnClickListener(this);
|
||||
|
||||
mI2PHelper = new I2PAndroidHelper(this);
|
||||
mProxyUtils = ProxyUtils.getInstance(this);
|
||||
|
||||
RelativeLayout back = (RelativeLayout) findViewById(R.id.action_back);
|
||||
back.setOnClickListener(this);
|
||||
@ -354,7 +349,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath());
|
||||
}
|
||||
|
||||
checkForProxy();
|
||||
mProxyUtils.checkForProxy(this);
|
||||
}
|
||||
|
||||
private class SearchClass {
|
||||
@ -543,129 +538,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* If Orbot/Tor or I2P is installed, prompt the user if they want to enable
|
||||
* proxying for this session
|
||||
*/
|
||||
private void checkForProxy() {
|
||||
boolean useProxy = mPreferences.getUseProxy();
|
||||
|
||||
OrbotHelper oh = new OrbotHelper(this);
|
||||
final boolean orbotInstalled = oh.isOrbotInstalled();
|
||||
boolean orbotChecked = mPreferences.getCheckedForTor();
|
||||
boolean orbot = orbotInstalled && !orbotChecked;
|
||||
|
||||
boolean i2pInstalled = mI2PHelper.isI2PAndroidInstalled();
|
||||
boolean i2pChecked = mPreferences.getCheckedForI2P();
|
||||
boolean i2p = i2pInstalled && !i2pChecked;
|
||||
|
||||
// TODO Is the idea to show this per-session, or only once?
|
||||
if (!useProxy && (orbot || i2p)) {
|
||||
if (orbot) mPreferences.setCheckedForTor(true);
|
||||
if (i2p) mPreferences.setCheckedForI2P(true);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
|
||||
if (orbotInstalled && i2pInstalled) {
|
||||
String[] proxyChoices = this.getResources().getStringArray(R.array.proxy_choices_array);
|
||||
builder.setTitle(getResources().getString(R.string.http_proxy))
|
||||
.setSingleChoiceItems(proxyChoices, mPreferences.getProxyChoice(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setProxyChoice(which);
|
||||
}
|
||||
})
|
||||
.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (mPreferences.getUseProxy())
|
||||
initializeProxy();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
mPreferences.setProxyChoice(orbotInstalled ?
|
||||
Constants.PROXY_ORBOT : Constants.PROXY_I2P);
|
||||
initializeProxy();
|
||||
break;
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
mPreferences.setProxyChoice(Constants.NO_PROXY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
builder.setMessage(orbotInstalled ? R.string.use_tor_prompt : R.string.use_i2p_prompt)
|
||||
.setPositiveButton(R.string.yes, dialogClickListener)
|
||||
.setNegativeButton(R.string.no, dialogClickListener);
|
||||
}
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize WebKit Proxying
|
||||
*/
|
||||
private void initializeProxy() {
|
||||
String host;
|
||||
int port;
|
||||
|
||||
switch (mPreferences.getProxyChoice()) {
|
||||
case Constants.NO_PROXY:
|
||||
// We shouldn't be here
|
||||
return;
|
||||
|
||||
case Constants.PROXY_ORBOT:
|
||||
OrbotHelper oh = new OrbotHelper(this);
|
||||
if (!oh.isOrbotRunning()) {
|
||||
oh.requestOrbotStart(this);
|
||||
}
|
||||
host = "localhost";
|
||||
port = 8118;
|
||||
break;
|
||||
|
||||
case Constants.PROXY_I2P:
|
||||
mI2PProxyInitialized = true;
|
||||
if (mI2PHelperBound && !mI2PHelper.isI2PAndroidRunning()) {
|
||||
mI2PHelper.requestI2PAndroidStart(this);
|
||||
}
|
||||
host = "localhost";
|
||||
port = 4444;
|
||||
break;
|
||||
|
||||
default:
|
||||
host = mPreferences.getProxyHost();
|
||||
port = mPreferences.getProxyPort();
|
||||
}
|
||||
|
||||
try {
|
||||
WebkitProxy.setProxy(BrowserApp.class.getName(), getApplicationContext(),
|
||||
host, port);
|
||||
} catch (Exception e) {
|
||||
Log.d(Constants.TAG, "error enabling web proxying", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isProxyReady() {
|
||||
if (mPreferences.getProxyChoice() == Constants.PROXY_I2P) {
|
||||
if (!mI2PHelper.isI2PAndroidRunning()) {
|
||||
Utils.showToast(this, getString(R.string.i2p_not_running));
|
||||
return false;
|
||||
} else if (!mI2PHelper.areTunnelsActive()) {
|
||||
Utils.showToast(this, getString(R.string.i2p_tunnels_not_ready));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isTablet() {
|
||||
return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
||||
}
|
||||
@ -817,17 +689,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
}
|
||||
|
||||
updateCookiePreference();
|
||||
if (mPreferences.getUseProxy()) {
|
||||
initializeProxy();
|
||||
} else {
|
||||
try {
|
||||
WebkitProxy.resetProxy(BrowserApp.class.getName(),
|
||||
getApplicationContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mI2PProxyInitialized = false;
|
||||
}
|
||||
mProxyUtils.updateProxySettings(this);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1487,8 +1349,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mI2PHelper.unbind();
|
||||
mI2PHelperBound = false;
|
||||
mProxyUtils.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1503,17 +1364,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (mPreferences.getProxyChoice() == Constants.PROXY_I2P) {
|
||||
// Try to bind to I2P Android
|
||||
mI2PHelper.bind(new I2PAndroidHelper.Callback() {
|
||||
@Override
|
||||
public void onI2PAndroidBound() {
|
||||
mI2PHelperBound = true;
|
||||
if (mI2PProxyInitialized && !mI2PHelper.isI2PAndroidRunning())
|
||||
mI2PHelper.requestI2PAndroidStart(BrowserActivity.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
mProxyUtils.onStart(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2025,6 +1876,11 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProxyReady() {
|
||||
return mProxyUtils.isProxyReady(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* function that opens the HTML history page in the browser
|
||||
*/
|
||||
|
@ -26,426 +26,418 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.i2p.android.ui.I2PAndroidHelper;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.utils.ProxyUtils;
|
||||
import acr.browser.lightning.utils.Utils;
|
||||
import info.guardianproject.onionkit.ui.OrbotHelper;
|
||||
|
||||
public class SettingsActivity extends ThemableSettingsActivity {
|
||||
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
private PreferenceManager mPreferences;
|
||||
private Context mContext;
|
||||
private Activity mActivity;
|
||||
private CharSequence[] mProxyChoices;
|
||||
private TextView mProxyChoiceName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.settings);
|
||||
mContext = this;
|
||||
mActivity = this;
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void init() {
|
||||
// set up ActionBar
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
// initialize UI
|
||||
RelativeLayout layoutFlash = (RelativeLayout) findViewById(R.id.layoutFlash);
|
||||
RelativeLayout layoutBlockAds = (RelativeLayout) findViewById(R.id.layoutAdBlock);
|
||||
layoutBlockAds.setEnabled(Constants.FULL_VERSION);
|
||||
RelativeLayout layoutImages = (RelativeLayout) findViewById(R.id.layoutImages);
|
||||
RelativeLayout layoutEnableJS = (RelativeLayout) findViewById(R.id.layoutEnableJS);
|
||||
LinearLayout layoutProxyChoice = (LinearLayout) findViewById(R.id.layoutProxyChoice);
|
||||
RelativeLayout layoutColor = (RelativeLayout) findViewById(R.id.layoutColorMode);
|
||||
RelativeLayout layoutBookmarks = (RelativeLayout) findViewById(R.id.layoutBookmarks);
|
||||
|
||||
layoutBookmarks.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, BookmarkActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (API >= 19) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
int flashNum = mPreferences.getFlashSupport();
|
||||
boolean imagesBool = mPreferences.getBlockImagesEnabled();
|
||||
boolean enableJSBool = mPreferences.getJavaScriptEnabled();
|
||||
|
||||
mProxyChoiceName = (TextView) findViewById(R.id.proxyChoiceName);
|
||||
mProxyChoices = this.getResources().getStringArray(R.array.proxy_choices_array);
|
||||
int choice = mPreferences.getProxyChoice();
|
||||
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);
|
||||
adblock.setEnabled(Constants.FULL_VERSION);
|
||||
CheckBox images = (CheckBox) findViewById(R.id.cbImageBlock);
|
||||
CheckBox enablejs = (CheckBox) findViewById(R.id.cbJavascript);
|
||||
CheckBox color = (CheckBox) findViewById(R.id.cbColorMode);
|
||||
|
||||
images.setChecked(imagesBool);
|
||||
enablejs.setChecked(enableJSBool);
|
||||
if (flashNum > 0) {
|
||||
flash.setChecked(true);
|
||||
} else {
|
||||
flash.setChecked(false);
|
||||
}
|
||||
adblock.setChecked(mPreferences.getAdBlockEnabled());
|
||||
color.setChecked(mPreferences.getColorModeEnabled());
|
||||
|
||||
initCheckBox(flash, adblock, images, enablejs, color);
|
||||
clickListenerForCheckBoxes(layoutFlash, layoutBlockAds, layoutImages, layoutEnableJS,
|
||||
layoutProxyChoice, layoutColor, flash, adblock, images, enablejs, color);
|
||||
|
||||
RelativeLayout general = (RelativeLayout) findViewById(R.id.layoutGeneral);
|
||||
RelativeLayout display = (RelativeLayout) findViewById(R.id.layoutDisplay);
|
||||
RelativeLayout privacy = (RelativeLayout) findViewById(R.id.layoutPrivacy);
|
||||
RelativeLayout advanced = (RelativeLayout) findViewById(R.id.layoutAdvanced);
|
||||
RelativeLayout about = (RelativeLayout) findViewById(R.id.layoutAbout);
|
||||
|
||||
general(general);
|
||||
display(display);
|
||||
privacy(privacy);
|
||||
advanced(advanced);
|
||||
about(about);
|
||||
}
|
||||
|
||||
public void clickListenerForCheckBoxes(RelativeLayout layoutFlash,
|
||||
RelativeLayout layoutBlockAds, RelativeLayout layoutImages,
|
||||
RelativeLayout layoutEnableJS, LinearLayout layoutProxyChoice, RelativeLayout layoutColor,
|
||||
final CheckBox flash, final CheckBox adblock, final CheckBox images,
|
||||
final CheckBox enablejs, final CheckBox color) {
|
||||
layoutFlash.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (API < 19) {
|
||||
flash.setChecked(!flash.isChecked());
|
||||
} else {
|
||||
Utils.createInformativeDialog(mContext,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_dead));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
layoutBlockAds.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
adblock.setChecked(!adblock.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
layoutImages.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
images.setChecked(!images.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
layoutEnableJS.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
enablejs.setChecked(!enablejs.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
layoutProxyChoice.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
proxyChoicePicker();
|
||||
}
|
||||
});
|
||||
layoutColor.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
color.setChecked(!color.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void initCheckBox(CheckBox flash, CheckBox adblock, CheckBox images, CheckBox enablejs,
|
||||
CheckBox color) {
|
||||
flash.setEnabled(API < 19);
|
||||
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
getFlashChoice();
|
||||
} else {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
boolean flashInstalled = false;
|
||||
try {
|
||||
PackageManager pm = getPackageManager();
|
||||
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
|
||||
if (ai != null) {
|
||||
flashInstalled = true;
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
flashInstalled = false;
|
||||
}
|
||||
if (!flashInstalled && isChecked) {
|
||||
Utils.createInformativeDialog(SettingsActivity.this,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_not_installed));
|
||||
buttonView.setChecked(false);
|
||||
mPreferences.setFlashSupport(0);
|
||||
|
||||
} else if ((API >= 17) && isChecked) {
|
||||
Utils.createInformativeDialog(SettingsActivity.this,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_unsupported));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
adblock.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setAdBlockEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
images.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setBlockImagesEnabled(isChecked);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
enablejs.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setJavaScriptEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
color.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setColorModeEnabled(isChecked);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void getFlashChoice() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mContext.getResources().getString(R.string.title_flash));
|
||||
builder.setMessage(getResources().getString(R.string.flash))
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(getResources().getString(R.string.action_manual),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
mPreferences.setFlashSupport(1);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_auto),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setFlashSupport(2);
|
||||
}
|
||||
}).setOnCancelListener(new OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
private void proxyChoicePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||
picker.setTitle(getResources().getString(R.string.http_proxy));
|
||||
picker.setSingleChoiceItems(mProxyChoices, mPreferences.getProxyChoice(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setProxyChoice(which);
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void setProxyChoice(int choice) {
|
||||
switch (choice) {
|
||||
case Constants.PROXY_ORBOT:
|
||||
OrbotHelper oh = new OrbotHelper(this);
|
||||
if (!oh.isOrbotInstalled()) {
|
||||
choice = Constants.NO_PROXY;
|
||||
Utils.showToast(mContext, getResources().getString(R.string.install_orbot));
|
||||
}
|
||||
break;
|
||||
|
||||
case Constants.PROXY_I2P:
|
||||
I2PAndroidHelper ih = new I2PAndroidHelper(this);
|
||||
if (!ih.isI2PAndroidInstalled()) {
|
||||
choice = Constants.NO_PROXY;
|
||||
ih.promptToInstall(this);
|
||||
}
|
||||
break;
|
||||
|
||||
case Constants.PROXY_MANUAL:
|
||||
manualProxyPicker();
|
||||
break;
|
||||
}
|
||||
|
||||
mPreferences.setProxyChoice(choice);
|
||||
if (choice < mProxyChoices.length)
|
||||
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);
|
||||
|
||||
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent));
|
||||
final EditText getAgent = new EditText(this);
|
||||
getAgent.append(mPreferences.getUserAgentString(""));
|
||||
agentStringPicker.setView(getAgent);
|
||||
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getAgent.getText().toString();
|
||||
mPreferences.setUserAgentString(text);
|
||||
getAgent.setText(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
});
|
||||
agentStringPicker.show();
|
||||
}
|
||||
|
||||
public void general(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, GeneralSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void display(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, DisplaySettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void privacy(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, PrivacySettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void advanced(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, AdvancedSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void about(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, AboutSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
private static final int API = android.os.Build.VERSION.SDK_INT;
|
||||
private PreferenceManager mPreferences;
|
||||
private Context mContext;
|
||||
private Activity mActivity;
|
||||
private CharSequence[] mProxyChoices;
|
||||
private TextView mProxyChoiceName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.settings);
|
||||
mContext = this;
|
||||
mActivity = this;
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void init() {
|
||||
// set up ActionBar
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
// mPreferences storage
|
||||
mPreferences = PreferenceManager.getInstance();
|
||||
|
||||
// initialize UI
|
||||
RelativeLayout layoutFlash = (RelativeLayout) findViewById(R.id.layoutFlash);
|
||||
RelativeLayout layoutBlockAds = (RelativeLayout) findViewById(R.id.layoutAdBlock);
|
||||
layoutBlockAds.setEnabled(Constants.FULL_VERSION);
|
||||
RelativeLayout layoutImages = (RelativeLayout) findViewById(R.id.layoutImages);
|
||||
RelativeLayout layoutEnableJS = (RelativeLayout) findViewById(R.id.layoutEnableJS);
|
||||
LinearLayout layoutProxyChoice = (LinearLayout) findViewById(R.id.layoutProxyChoice);
|
||||
RelativeLayout layoutColor = (RelativeLayout) findViewById(R.id.layoutColorMode);
|
||||
RelativeLayout layoutBookmarks = (RelativeLayout) findViewById(R.id.layoutBookmarks);
|
||||
|
||||
layoutBookmarks.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, BookmarkActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (API >= 19) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
int flashNum = mPreferences.getFlashSupport();
|
||||
boolean imagesBool = mPreferences.getBlockImagesEnabled();
|
||||
boolean enableJSBool = mPreferences.getJavaScriptEnabled();
|
||||
|
||||
mProxyChoiceName = (TextView) findViewById(R.id.proxyChoiceName);
|
||||
mProxyChoices = this.getResources().getStringArray(R.array.proxy_choices_array);
|
||||
int choice = mPreferences.getProxyChoice();
|
||||
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);
|
||||
adblock.setEnabled(Constants.FULL_VERSION);
|
||||
CheckBox images = (CheckBox) findViewById(R.id.cbImageBlock);
|
||||
CheckBox enablejs = (CheckBox) findViewById(R.id.cbJavascript);
|
||||
CheckBox color = (CheckBox) findViewById(R.id.cbColorMode);
|
||||
|
||||
images.setChecked(imagesBool);
|
||||
enablejs.setChecked(enableJSBool);
|
||||
if (flashNum > 0) {
|
||||
flash.setChecked(true);
|
||||
} else {
|
||||
flash.setChecked(false);
|
||||
}
|
||||
adblock.setChecked(mPreferences.getAdBlockEnabled());
|
||||
color.setChecked(mPreferences.getColorModeEnabled());
|
||||
|
||||
initCheckBox(flash, adblock, images, enablejs, color);
|
||||
clickListenerForCheckBoxes(layoutFlash, layoutBlockAds, layoutImages, layoutEnableJS,
|
||||
layoutProxyChoice, layoutColor, flash, adblock, images, enablejs, color);
|
||||
|
||||
RelativeLayout general = (RelativeLayout) findViewById(R.id.layoutGeneral);
|
||||
RelativeLayout display = (RelativeLayout) findViewById(R.id.layoutDisplay);
|
||||
RelativeLayout privacy = (RelativeLayout) findViewById(R.id.layoutPrivacy);
|
||||
RelativeLayout advanced = (RelativeLayout) findViewById(R.id.layoutAdvanced);
|
||||
RelativeLayout about = (RelativeLayout) findViewById(R.id.layoutAbout);
|
||||
|
||||
general(general);
|
||||
display(display);
|
||||
privacy(privacy);
|
||||
advanced(advanced);
|
||||
about(about);
|
||||
}
|
||||
|
||||
public void clickListenerForCheckBoxes(RelativeLayout layoutFlash,
|
||||
RelativeLayout layoutBlockAds, RelativeLayout layoutImages,
|
||||
RelativeLayout layoutEnableJS, LinearLayout layoutProxyChoice, RelativeLayout layoutColor,
|
||||
final CheckBox flash, final CheckBox adblock, final CheckBox images,
|
||||
final CheckBox enablejs, final CheckBox color) {
|
||||
layoutFlash.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (API < 19) {
|
||||
flash.setChecked(!flash.isChecked());
|
||||
} else {
|
||||
Utils.createInformativeDialog(mContext,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_dead));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
layoutBlockAds.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
adblock.setChecked(!adblock.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
layoutImages.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
images.setChecked(!images.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
layoutEnableJS.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
enablejs.setChecked(!enablejs.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
if (Constants.FULL_VERSION == false) {
|
||||
layoutProxyChoice.setEnabled(false);
|
||||
}
|
||||
layoutProxyChoice.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
proxyChoicePicker();
|
||||
}
|
||||
});
|
||||
layoutColor.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
color.setChecked(!color.isChecked());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void initCheckBox(CheckBox flash, CheckBox adblock, CheckBox images, CheckBox enablejs,
|
||||
CheckBox color) {
|
||||
flash.setEnabled(API < 19);
|
||||
flash.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
getFlashChoice();
|
||||
} else {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
boolean flashInstalled = false;
|
||||
try {
|
||||
PackageManager pm = getPackageManager();
|
||||
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
|
||||
if (ai != null) {
|
||||
flashInstalled = true;
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
flashInstalled = false;
|
||||
}
|
||||
if (!flashInstalled && isChecked) {
|
||||
Utils.createInformativeDialog(SettingsActivity.this,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_not_installed));
|
||||
buttonView.setChecked(false);
|
||||
mPreferences.setFlashSupport(0);
|
||||
|
||||
} else if ((API >= 17) && isChecked) {
|
||||
Utils.createInformativeDialog(SettingsActivity.this,
|
||||
getResources().getString(R.string.title_warning), getResources()
|
||||
.getString(R.string.dialog_adobe_unsupported));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
adblock.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setAdBlockEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
images.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setBlockImagesEnabled(isChecked);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
enablejs.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setJavaScriptEnabled(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
color.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mPreferences.setColorModeEnabled(isChecked);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void getFlashChoice() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mContext.getResources().getString(R.string.title_flash));
|
||||
builder.setMessage(getResources().getString(R.string.flash))
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(getResources().getString(R.string.action_manual),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
mPreferences.setFlashSupport(1);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_auto),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferences.setFlashSupport(2);
|
||||
}
|
||||
}).setOnCancelListener(new OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
mPreferences.setFlashSupport(0);
|
||||
}
|
||||
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
private void proxyChoicePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mContext);
|
||||
picker.setTitle(getResources().getString(R.string.http_proxy));
|
||||
picker.setSingleChoiceItems(mProxyChoices, mPreferences.getProxyChoice(),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setProxyChoice(which);
|
||||
}
|
||||
});
|
||||
picker.setNeutralButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
picker.show();
|
||||
}
|
||||
|
||||
private void setProxyChoice(int choice) {
|
||||
ProxyUtils utils = ProxyUtils.getInstance(this);
|
||||
switch (choice) {
|
||||
case Constants.PROXY_ORBOT:
|
||||
choice = utils.setProxyChoice(choice, this);
|
||||
break;
|
||||
case Constants.PROXY_I2P:
|
||||
choice = utils.setProxyChoice(choice, this);
|
||||
break;
|
||||
case Constants.PROXY_MANUAL:
|
||||
manualProxyPicker();
|
||||
break;
|
||||
}
|
||||
|
||||
mPreferences.setProxyChoice(choice);
|
||||
if (choice < mProxyChoices.length)
|
||||
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);
|
||||
|
||||
agentStringPicker.setTitle(getResources().getString(R.string.title_user_agent));
|
||||
final EditText getAgent = new EditText(this);
|
||||
getAgent.append(mPreferences.getUserAgentString(""));
|
||||
agentStringPicker.setView(getAgent);
|
||||
agentStringPicker.setPositiveButton(getResources().getString(R.string.action_ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String text = getAgent.getText().toString();
|
||||
mPreferences.setUserAgentString(text);
|
||||
getAgent.setText(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
});
|
||||
agentStringPicker.show();
|
||||
}
|
||||
|
||||
public void general(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, GeneralSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void display(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, DisplaySettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void privacy(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, PrivacySettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void advanced(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, AdvancedSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void about(RelativeLayout view) {
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(mContext, AboutSettingsActivity.class));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar_settings" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutFlash"
|
||||
@ -25,7 +25,7 @@
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
@ -61,7 +61,7 @@
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -96,7 +96,7 @@
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
@ -132,7 +132,7 @@
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
@ -160,40 +160,7 @@
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutProxyChoice"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/http_proxy"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/proxyChoiceName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light"
|
||||
tools:text="Disabled" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layoutColorMode"
|
||||
android:layout_width="match_parent"
|
||||
@ -202,7 +169,7 @@
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -222,6 +189,40 @@
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutProxyChoice"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/http_proxy"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/proxyChoiceName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/light"
|
||||
tools:text="Disabled" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
@ -236,7 +237,7 @@
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
@ -263,7 +264,7 @@
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -289,7 +290,7 @@
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
@ -316,7 +317,7 @@
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
@ -343,7 +344,7 @@
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
@ -370,14 +371,14 @@
|
||||
android:background="?attr/listChoiceBackgroundIndicator"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
|
@ -158,7 +158,6 @@
|
||||
<string name="powered_by_google">Unterstützt durch Google</string>
|
||||
<string name="title_adblock">Werbeblocker</string>
|
||||
<string name="message_adblock">Der Werbeblocker ist nur in Lightning Browser+ verfügbar und kann im Google Play Store gekauft werden!</string>
|
||||
<string name="enable_orbot">Orbot aktivieren</string>
|
||||
<string name="use_tor_prompt">Orbot ist installiert. Soll Tor verwendet werden?</string>
|
||||
<string name="install_orbot">Um Tor verwenden zu können, muss Orbot installiert sein!</string>
|
||||
<string name="yes">Ja</string>
|
||||
|
@ -141,7 +141,6 @@
|
||||
<string name="powered_by_google">Proporcionadas por Google</string>
|
||||
<string name="title_adblock">AdBlock</string>
|
||||
<string name="message_adblock">El bloqueador de publicidad AdBlock sólo está disponible en la versión de pago del navegador, Lightning Browser+. Puede descargarla en Google Play.</string>
|
||||
<string name="enable_orbot">Habilitar Orbot</string>
|
||||
<string name="use_tor_prompt">Parece que tienes Orbot instalado. ¿Quieres usar Tor?</string>
|
||||
<string name="install_orbot">Por favor, instala Orbot para usar Tor.</string>
|
||||
<string name="yes">Sí</string>
|
||||
|
@ -142,7 +142,6 @@
|
||||
<string name="powered_by_google">Powered by Google</string>
|
||||
<string name="title_adblock">AdBlock</string>
|
||||
<string name="message_adblock">Το AdBlock είναι προς το παρόν διαθέσιμο μόνο στην πληρωμένη έκδοση του browser, Lightning Browser+. Είναι διαθέσιμη για κατέβασμα στο Google Play.</string>
|
||||
<string name="enable_orbot">Ενεργοποίηση Orbot</string>
|
||||
<string name="use_tor_prompt">Φαίνεται οτι έχετε εγκατεστημένο το Orbot. Θα θέλατε να χρησιμοποιήσετε το Tor?</string>
|
||||
<string name="install_orbot">Παρακαλώ εγκαταστήστε το Orbot για να χρησιμοποιήσετε το Tor.</string>
|
||||
<string name="yes">Ναι</string>
|
||||
|
@ -158,7 +158,6 @@
|
||||
<string name="powered_by_google">A Google támogatásával</string>
|
||||
<string name="title_adblock">AdBlock</string>
|
||||
<string name="message_adblock">Az AdBlock jelenleg csak a Lightning Browser + fizetős változatban érhető el.Ez letölthető a Google Play Áruházból.</string>
|
||||
<string name="enable_orbot">Orbot bekapcsolása</string>
|
||||
<string name="use_tor_prompt">Úgy tűnik, hogy önnek telepítve van az Orbot.Szeretné használni Tor-t?</string>
|
||||
<string name="install_orbot">Kérjük telepítse az Orbot-ot annak érdekében, hogy működjön a proxy a Tor-ral.</string>
|
||||
<string name="yes">Igen</string>
|
||||
|
@ -93,7 +93,6 @@
|
||||
<string name="message_text_copied">Testo copiato negli appunti</string>
|
||||
<string name="message_link_copied">Link copiato negli appunti</string>
|
||||
<string name="block_ads">Blocca Annunci</string>
|
||||
<string name="enable_orbot">Abilita Orbot</string>
|
||||
<string name="sync_history">Sincronizza cronologia con Google</string>
|
||||
<string name="export_bookmarks">Esporta segnalibri</string>
|
||||
<string name="import_backup">Importa segnalibri da backup</string>
|
||||
|
@ -155,7 +155,6 @@
|
||||
<string name="powered_by_google">Powered by Google</string>
|
||||
<string name="title_adblock">広告ブロック</string>
|
||||
<string name="message_adblock">広告ブロックは有料版のLightning Browser+でのみ利用可能です。Google Playからダウンロードできます。</string>
|
||||
<string name="enable_orbot">Orbot</string>
|
||||
<string name="use_tor_prompt">Orbotがインストールされています。Torを使用しますか?</string>
|
||||
<string name="install_orbot">Torでプロキシを有効にするにはOrbotをインストールしてください</string>
|
||||
<string name="yes">はい</string>
|
||||
|
@ -141,7 +141,6 @@
|
||||
<string name="powered_by_google">Dostarczane przez Google</string>
|
||||
<string name="title_adblock">Blokowanie reklam</string>
|
||||
<string name="message_adblock">Blokowanie reklam jest obecnie dostępne tylko w płatnej wersji przeglądarki, Lightning Browser+. Jest ona dostępna do pobrania w sklepie Google Play.</string>
|
||||
<string name="enable_orbot">Włącz Orbota</string>
|
||||
<string name="use_tor_prompt">Wygląda na to że Orbot jest zainstalowany. Chciałbyś go włączyć i użyć sieci Tor do łączenia się z internetem?</string>
|
||||
<string name="install_orbot">Zanistaluj Orbota by móc używać sieci Tor do łączenia się z internetem.</string>
|
||||
<string name="yes">Tak</string>
|
||||
|
@ -158,7 +158,6 @@
|
||||
<string name="powered_by_google">Disponibilizado por Google</string>
|
||||
<string name="title_adblock">AdBlock</string>
|
||||
<string name="message_adblock">O AdBlock apenas está disponível na versão paga, o Lightning Browser+. Esta versão está disponível na loja Google.</string>
|
||||
<string name="enable_orbot">Ativar Orbot</string>
|
||||
<string name="use_tor_prompt">Parece que você tem o Orbot instalado. Gostaria de utilizar a rede Tor?</string>
|
||||
<string name="install_orbot">Por favor instale o Orbot para poder utilizar a rede Tor.</string>
|
||||
<string name="yes">Sim</string>
|
||||
|
@ -141,7 +141,6 @@
|
||||
<string name="powered_by_google">Используя Google</string>
|
||||
<string name="title_adblock">AdBlock</string>
|
||||
<string name="message_adblock">AdBlock в настоящее время доступен только в платной версии браузера Lightning Browser+. Он доступен для загрузки в Google Play.</string>
|
||||
<string name="enable_orbot">Использовать Orbot</string>
|
||||
<string name="use_tor_prompt">Похоже, установлен Orbot. Вы хотите использовать Tor?</string>
|
||||
<string name="install_orbot">Пожалуйста, установите Orbot для проксирования через Tor.</string>
|
||||
<string name="yes">Да</string>
|
||||
|
@ -155,7 +155,6 @@
|
||||
<string name="powered_by_google">Погоњено Гуглом</string>
|
||||
<string name="title_adblock">Адблок</string>
|
||||
<string name="message_adblock">Адблок је доступан само у плаћеном издању прегледача, „Lightning Browser+“. Доступан је за преузимање на Гугловом Плеју.</string>
|
||||
<string name="enable_orbot">Омогући Орбот</string>
|
||||
<string name="use_tor_prompt">Изгледа да имате Орбот инсталиран. Желите ли да користите Тор?</string>
|
||||
<string name="install_orbot">Инсталирајте Орбот да бисте користили Тор.</string>
|
||||
<string name="yes">Да</string>
|
||||
|
@ -142,7 +142,6 @@
|
||||
<string name="powered_by_google">Powered by Google</string>
|
||||
<string name="title_adblock">AdBlock</string>
|
||||
<string name="message_adblock">AdBlock şu anda yalnızca ücretli sürüm olan Lightning Browser+ ile kullanılabilir. Ücretli sürümü Google Play aracılığı ile indirebilirsin.</string>
|
||||
<string name="enable_orbot">Orbot\'u kullan</string>
|
||||
<string name="use_tor_prompt">Cihazında Orbot yüklü görünüyor. Tor kullanmak ister misin?</string>
|
||||
<string name="install_orbot">Tor proxy ağı ile gezinmek için Orbot yüklemelisin.</string>
|
||||
<string name="yes">Evet</string>
|
||||
|
@ -142,7 +142,6 @@
|
||||
<string name="powered_by_google">由 Google 提供支持</string>
|
||||
<string name="title_adblock">广告拦截</string>
|
||||
<string name="message_adblock">广告拦截现在只能在付费版的浏览器 - Lightning Browser+ 中使用。你可以在 Google Play 中下载它。</string>
|
||||
<string name="enable_orbot">启用 Orbot</string>
|
||||
<string name="use_tor_prompt">看起来你已经安装了 Orbot. 你想要使用 Tor 吗?</string>
|
||||
<string name="install_orbot">请安装 Orbot 以便通过 Tor 全使用代理。</string>
|
||||
<string name="yes">是</string>
|
||||
|
@ -158,7 +158,7 @@
|
||||
<string name="powered_by_google">Powered by Google</string>
|
||||
<string name="title_adblock">AdBlock</string>
|
||||
<string name="message_adblock">AdBlock is currently only available in the browser\'s paid version, Lightning Browser+. It is available to download on Google Play.</string>
|
||||
<string name="http_proxy">HTTP proxy</string>
|
||||
<string name="http_proxy">HTTP Proxy</string>
|
||||
<string-array name="proxy_choices_array">
|
||||
<item>None</item>
|
||||
<item>Orbot</item>
|
||||
|
Loading…
Reference in New Issue
Block a user