remove some features, update strings
This commit is contained in:
parent
0eab701228
commit
dbe2f0ed52
@ -9,7 +9,9 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion project.minSdkVersion
|
||||
targetSdkVersion project.targetSdkVersion
|
||||
applicationId "org.purplei2p.lightning"
|
||||
versionName project.versionName
|
||||
versionCode project.versionCode
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
@ -22,11 +24,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
lightningPlus.setRoot('src/LightningPlus')
|
||||
lightningLite.setRoot('src/LightningLite')
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
minifyEnabled false
|
||||
@ -42,20 +39,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
lightningPlus {
|
||||
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"true\")"
|
||||
applicationId "org.purplei2p.lightning"
|
||||
versionCode project.versionCode_plus
|
||||
}
|
||||
|
||||
lightningLite {
|
||||
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"false\")"
|
||||
applicationId "org.purplei2p.barebones"
|
||||
versionCode project.versionCode_lite
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError true
|
||||
}
|
||||
|
@ -1,24 +1,3 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
-optimizationpasses 5
|
||||
-dontusemixedcaseclassnames
|
||||
-dontskipnonpubliclibraryclasses
|
||||
@ -33,22 +12,16 @@
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||
-keep public class * extends android.preference.Preference
|
||||
#-keep public class com.android.vending.licensing.ILicensingService
|
||||
-keep public class org.purplei2p.lightning.reading.*
|
||||
#-keep class org.lucasr.twowayview.** { *; }
|
||||
|
||||
-keepattributes *Annotation*
|
||||
#-keepclassmembers class ** {
|
||||
# @com.squareup.otto.Subscribe public *;
|
||||
# @com.squareup.otto.Produce public *;
|
||||
#}
|
||||
|
||||
-assumenosideeffects class android.util.Log {
|
||||
public static *** d(...);
|
||||
public static *** v(...);
|
||||
public static *** w(...);
|
||||
public static *** i(...);
|
||||
}
|
||||
#-assumenosideeffects class android.util.Log {
|
||||
# public static *** d(...);
|
||||
# public static *** v(...);
|
||||
# public static *** w(...);
|
||||
# public static *** i(...);
|
||||
#}
|
||||
|
||||
-keep class butterknife.** { *; }
|
||||
-dontwarn butterknife.internal.**
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,197 +0,0 @@
|
||||
package org.purplei2p.lightning.adblock;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.res.AssetManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.anthonycr.bonsai.Completable;
|
||||
import com.anthonycr.bonsai.CompletableAction;
|
||||
import com.anthonycr.bonsai.CompletableSubscriber;
|
||||
import com.anthonycr.bonsai.Schedulers;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.purplei2p.lightning.BuildConfig;
|
||||
import org.purplei2p.lightning.preference.PreferenceManager;
|
||||
import org.purplei2p.lightning.utils.StringBuilderUtils;
|
||||
import org.purplei2p.lightning.utils.Utils;
|
||||
|
||||
@Singleton
|
||||
public class AdBlock {
|
||||
|
||||
private static final String TAG = "AdBlock";
|
||||
private static final String BLOCKED_DOMAINS_LIST_FILE_NAME = "hosts.txt";
|
||||
private static final String LOCAL_IP_V4 = "127.0.0.1";
|
||||
private static final String LOCAL_IP_V4_ALT = "0.0.0.0";
|
||||
private static final String LOCAL_IP_V6 = "::1";
|
||||
private static final String LOCALHOST = "localhost";
|
||||
private static final String COMMENT = "#";
|
||||
private static final String TAB = "\t";
|
||||
private static final String SPACE = " ";
|
||||
private static final String EMPTY = "";
|
||||
|
||||
@NonNull private final Set<String> mBlockedDomainsList = new HashSet<>();
|
||||
@NonNull private final PreferenceManager mPreferenceManager;
|
||||
@NonNull private final Application mApplication;
|
||||
private boolean mBlockAds;
|
||||
|
||||
@Inject
|
||||
AdBlock(@NonNull Application application, @NonNull PreferenceManager preferenceManager) {
|
||||
mApplication = application;
|
||||
mPreferenceManager = preferenceManager;
|
||||
if (mBlockedDomainsList.isEmpty() && BuildConfig.FULL_VERSION) {
|
||||
loadHostsFile().subscribeOn(Schedulers.io()).subscribe();
|
||||
}
|
||||
mBlockAds = mPreferenceManager.getAdBlockEnabled();
|
||||
}
|
||||
|
||||
public void updatePreference() {
|
||||
mBlockAds = mPreferenceManager.getAdBlockEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* a method that determines if the given URL is an ad or not. It performs
|
||||
* a search of the URL's domain on the blocked domain hash set.
|
||||
*
|
||||
* @param url the URL to check for being an ad
|
||||
* @return true if it is an ad, false if it is not an ad
|
||||
*/
|
||||
public boolean isAd(@Nullable String url) {
|
||||
if (!mBlockAds || url == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String domain;
|
||||
try {
|
||||
domain = getDomainName(url);
|
||||
} catch (URISyntaxException e) {
|
||||
Log.d(TAG, "URL '" + url + "' is invalid", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isOnBlacklist = mBlockedDomainsList.contains(domain);
|
||||
if (isOnBlacklist) {
|
||||
Log.d(TAG, "URL '" + url + "' is an ad");
|
||||
}
|
||||
return isOnBlacklist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the probable domain name for a given URL
|
||||
*
|
||||
* @param url the url to parse
|
||||
* @return returns the domain
|
||||
* @throws URISyntaxException throws an exception if the string cannot form a URI
|
||||
*/
|
||||
@NonNull
|
||||
private static String getDomainName(@NonNull String url) throws URISyntaxException {
|
||||
int index = url.indexOf('/', 8);
|
||||
if (index != -1) {
|
||||
url = url.substring(0, index);
|
||||
}
|
||||
|
||||
URI uri = new URI(url);
|
||||
String domain = uri.getHost();
|
||||
if (domain == null) {
|
||||
return url;
|
||||
}
|
||||
|
||||
return domain.startsWith("www.") ? domain.substring(4) : domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* This Completable reads through a hosts file and extracts the domains that should
|
||||
* be redirected to localhost (a.k.a. IP address 127.0.0.1). It can handle files that
|
||||
* simply have a list of host names to block, or it can handle a full blown hosts file.
|
||||
* It will strip out comments, references to the base IP address and just extract the
|
||||
* domains to be used.
|
||||
*
|
||||
* @return a Completable that will load the hosts file into memory.
|
||||
*/
|
||||
@NonNull
|
||||
private Completable loadHostsFile() {
|
||||
return Completable.create(new CompletableAction() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull CompletableSubscriber subscriber) {
|
||||
AssetManager asset = mApplication.getAssets();
|
||||
BufferedReader reader = null;
|
||||
//noinspection TryFinallyCanBeTryWithResources
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(
|
||||
asset.open(BLOCKED_DOMAINS_LIST_FILE_NAME)));
|
||||
StringBuilder lineBuilder = new StringBuilder();
|
||||
String line;
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
final List<String> domains = new ArrayList<>(1);
|
||||
|
||||
while ((line = reader.readLine()) != null) {
|
||||
lineBuilder.append(line);
|
||||
|
||||
parseString(lineBuilder, domains);
|
||||
lineBuilder.setLength(0);
|
||||
}
|
||||
|
||||
mBlockedDomainsList.addAll(domains);
|
||||
Log.d(TAG, "Loaded ad list in: " + (System.currentTimeMillis() - time) + " ms");
|
||||
} catch (IOException e) {
|
||||
Log.wtf(TAG, "Reading blocked domains list from file '"
|
||||
+ BLOCKED_DOMAINS_LIST_FILE_NAME + "' failed.", e);
|
||||
} finally {
|
||||
Utils.close(reader);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void parseString(@NonNull StringBuilder lineBuilder, @NonNull List<String> parsedList) {
|
||||
if (!StringBuilderUtils.isEmpty(lineBuilder) &&
|
||||
!StringBuilderUtils.startsWith(lineBuilder, COMMENT)) {
|
||||
StringBuilderUtils.replace(lineBuilder, LOCAL_IP_V4, EMPTY);
|
||||
StringBuilderUtils.replace(lineBuilder, LOCAL_IP_V4_ALT, EMPTY);
|
||||
StringBuilderUtils.replace(lineBuilder, LOCAL_IP_V6, EMPTY);
|
||||
StringBuilderUtils.replace(lineBuilder, TAB, EMPTY);
|
||||
|
||||
int comment = lineBuilder.indexOf(COMMENT);
|
||||
if (comment >= 0) {
|
||||
lineBuilder.replace(comment, lineBuilder.length(), EMPTY);
|
||||
}
|
||||
|
||||
StringBuilderUtils.trim(lineBuilder);
|
||||
|
||||
if (!StringBuilderUtils.isEmpty(lineBuilder) &&
|
||||
!StringBuilderUtils.equals(lineBuilder, LOCALHOST)) {
|
||||
while (StringBuilderUtils.contains(lineBuilder, SPACE)) {
|
||||
int space = lineBuilder.indexOf(SPACE);
|
||||
StringBuilder partial = StringBuilderUtils.substring(lineBuilder, 0, space);
|
||||
StringBuilderUtils.trim(partial);
|
||||
|
||||
String partialLine = partial.toString();
|
||||
|
||||
// Add string to list
|
||||
parsedList.add(partialLine);
|
||||
StringBuilderUtils.replace(lineBuilder, partialLine, EMPTY);
|
||||
StringBuilderUtils.trim(lineBuilder);
|
||||
}
|
||||
if (lineBuilder.length() > 0) {
|
||||
// Add string to list.
|
||||
parsedList.add(lineBuilder.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,6 @@ import com.anthonycr.bonsai.Schedulers;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.purplei2p.lightning.BuildConfig;
|
||||
import org.purplei2p.lightning.R;
|
||||
import org.purplei2p.lightning.BrowserApp;
|
||||
import org.purplei2p.lightning.constant.BookmarkPage;
|
||||
@ -334,12 +333,6 @@ public class BrowserPresenter {
|
||||
* false if we have hit max tabs.
|
||||
*/
|
||||
public synchronized boolean newTab(@Nullable String url, boolean show) {
|
||||
// Limit number of tabs for limited version of app
|
||||
if (!BuildConfig.FULL_VERSION && mTabsModel.size() >= 10) {
|
||||
mView.showSnackbar(R.string.max_tabs);
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.d(TAG, "New tab, show: " + show);
|
||||
|
||||
LightningView startingTab = mTabsModel.newTab((Activity) mView, url, mIsIncognito);
|
||||
|
@ -15,8 +15,6 @@ import org.purplei2p.lightning.utils.FileUtils;
|
||||
public class PreferenceManager {
|
||||
|
||||
private static class Name {
|
||||
static final String ADOBE_FLASH_SUPPORT = "enableflash";
|
||||
static final String BLOCK_ADS = "AdBlock";
|
||||
static final String BLOCK_IMAGES = "blockimages";
|
||||
static final String CLEAR_CACHE_EXIT = "cache";
|
||||
static final String COOKIES = "cookies";
|
||||
@ -101,10 +99,6 @@ public class PreferenceManager {
|
||||
putBoolean(Name.SWAP_BOOKMARKS_AND_TABS, swap);
|
||||
}
|
||||
|
||||
public boolean getAdBlockEnabled() {
|
||||
return mPrefs.getBoolean(Name.BLOCK_ADS, false);
|
||||
}
|
||||
|
||||
public boolean getBlockImagesEnabled() {
|
||||
return mPrefs.getBoolean(Name.BLOCK_IMAGES, false);
|
||||
}
|
||||
@ -142,10 +136,6 @@ public class PreferenceManager {
|
||||
return mPrefs.getString(Name.DOWNLOAD_DIRECTORY, FileUtils.DEFAULT_DOWNLOAD_PATH);
|
||||
}
|
||||
|
||||
public int getFlashSupport() {
|
||||
return mPrefs.getInt(Name.ADOBE_FLASH_SUPPORT, 0);
|
||||
}
|
||||
|
||||
public boolean getFullScreenEnabled() {
|
||||
return mPrefs.getBoolean(Name.FULL_SCREEN, true);
|
||||
}
|
||||
@ -322,10 +312,6 @@ public class PreferenceManager {
|
||||
putString(Name.TEXT_ENCODING, encoding);
|
||||
}
|
||||
|
||||
public void setAdBlockEnabled(boolean enable) {
|
||||
putBoolean(Name.BLOCK_ADS, enable);
|
||||
}
|
||||
|
||||
public void setBlockImagesEnabled(boolean enable) {
|
||||
putBoolean(Name.BLOCK_IMAGES, enable);
|
||||
}
|
||||
@ -362,10 +348,6 @@ public class PreferenceManager {
|
||||
putString(Name.DOWNLOAD_DIRECTORY, directory);
|
||||
}
|
||||
|
||||
public void setFlashSupport(int n) {
|
||||
putInt(Name.ADOBE_FLASH_SUPPORT, n);
|
||||
}
|
||||
|
||||
public void setFullScreenEnabled(boolean enable) {
|
||||
putBoolean(Name.FULL_SCREEN, enable);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.purplei2p.lightning.BuildConfig;
|
||||
import org.purplei2p.lightning.R;
|
||||
import org.purplei2p.lightning.BrowserApp;
|
||||
import org.purplei2p.lightning.constant.Constants;
|
||||
@ -44,8 +43,6 @@ import static org.purplei2p.lightning.preference.PreferenceManager.Suggestion;
|
||||
public class GeneralSettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String SETTINGS_PROXY = "proxy";
|
||||
private static final String SETTINGS_FLASH = "cb_flash";
|
||||
private static final String SETTINGS_ADS = "cb_ads";
|
||||
private static final String SETTINGS_IMAGES = "cb_images";
|
||||
private static final String SETTINGS_JAVASCRIPT = "cb_javascript";
|
||||
private static final String SETTINGS_COLORMODE = "cb_colormode";
|
||||
@ -85,8 +82,6 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
searchengine = findPreference(SETTINGS_SEARCHENGINE);
|
||||
searchsSuggestions = findPreference(SETTINGS_SUGGESTIONS);
|
||||
|
||||
CheckBoxPreference cbFlash = (CheckBoxPreference) findPreference(SETTINGS_FLASH);
|
||||
CheckBoxPreference cbAds = (CheckBoxPreference) findPreference(SETTINGS_ADS);
|
||||
CheckBoxPreference cbImages = (CheckBoxPreference) findPreference(SETTINGS_IMAGES);
|
||||
CheckBoxPreference cbJsScript = (CheckBoxPreference) findPreference(SETTINGS_JAVASCRIPT);
|
||||
CheckBoxPreference cbColorMode = (CheckBoxPreference) findPreference(SETTINGS_COLORMODE);
|
||||
@ -97,8 +92,6 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
home.setOnPreferenceClickListener(this);
|
||||
searchsSuggestions.setOnPreferenceClickListener(this);
|
||||
searchengine.setOnPreferenceClickListener(this);
|
||||
cbFlash.setOnPreferenceChangeListener(this);
|
||||
cbAds.setOnPreferenceChangeListener(this);
|
||||
cbImages.setOnPreferenceChangeListener(this);
|
||||
cbJsScript.setOnPreferenceChangeListener(this);
|
||||
cbColorMode.setOnPreferenceChangeListener(this);
|
||||
@ -115,9 +108,6 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
proxy.setSummary(mProxyChoices[choice]);
|
||||
}
|
||||
|
||||
if (API >= Build.VERSION_CODES.KITKAT) {
|
||||
mPreferenceManager.setFlashSupport(0);
|
||||
}
|
||||
|
||||
BaseSearchEngine currentSearchEngine = mSearchEngineProvider.getCurrentSearchEngine();
|
||||
setSearchEngineSummary(currentSearchEngine);
|
||||
@ -161,27 +151,11 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
useragent.setSummary(getResources().getString(R.string.agent_custom));
|
||||
}
|
||||
|
||||
int flashNum = mPreferenceManager.getFlashSupport();
|
||||
boolean imagesBool = mPreferenceManager.getBlockImagesEnabled();
|
||||
boolean enableJSBool = mPreferenceManager.getJavaScriptEnabled();
|
||||
|
||||
cbAds.setEnabled(BuildConfig.FULL_VERSION);
|
||||
|
||||
if (!BuildConfig.FULL_VERSION) {
|
||||
cbAds.setSummary(R.string.upsell_plus_version);
|
||||
}
|
||||
|
||||
if (API < Build.VERSION_CODES.KITKAT) {
|
||||
cbFlash.setEnabled(true);
|
||||
} else {
|
||||
cbFlash.setEnabled(false);
|
||||
cbFlash.setSummary(R.string.flash_not_supported);
|
||||
}
|
||||
|
||||
cbImages.setChecked(imagesBool);
|
||||
cbJsScript.setChecked(enableJSBool);
|
||||
cbFlash.setChecked(flashNum > 0);
|
||||
cbAds.setChecked(BuildConfig.FULL_VERSION && mPreferenceManager.getAdBlockEnabled());
|
||||
cbColorMode.setChecked(mPreferenceManager.getColorModeEnabled());
|
||||
}
|
||||
|
||||
@ -202,38 +176,6 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
|
||||
}
|
||||
|
||||
private void getFlashChoice() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
||||
builder.setTitle(mActivity.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) {
|
||||
mPreferenceManager.setFlashSupport(1);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.action_auto),
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mPreferenceManager.setFlashSupport(2);
|
||||
}
|
||||
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
mPreferenceManager.setFlashSupport(0);
|
||||
}
|
||||
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
BrowserDialog.setDialogSize(mActivity, alert);
|
||||
}
|
||||
|
||||
private void proxyChoicePicker() {
|
||||
AlertDialog.Builder picker = new AlertDialog.Builder(mActivity);
|
||||
picker.setTitle(R.string.http_proxy);
|
||||
@ -615,22 +557,6 @@ public class GeneralSettingsFragment extends LightningPreferenceFragment impleme
|
||||
checked = Boolean.TRUE.equals(newValue);
|
||||
}
|
||||
switch (preference.getKey()) {
|
||||
case SETTINGS_FLASH:
|
||||
if (!Utils.isFlashInstalled(mActivity) && checked) {
|
||||
Utils.createInformativeDialog(mActivity, R.string.title_warning, R.string.dialog_adobe_not_installed);
|
||||
mPreferenceManager.setFlashSupport(0);
|
||||
return false;
|
||||
} else {
|
||||
if (checked) {
|
||||
getFlashChoice();
|
||||
} else {
|
||||
mPreferenceManager.setFlashSupport(0);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case SETTINGS_ADS:
|
||||
mPreferenceManager.setAdBlockEnabled(checked);
|
||||
return true;
|
||||
case SETTINGS_IMAGES:
|
||||
mPreferenceManager.setBlockImagesEnabled(checked);
|
||||
return true;
|
||||
|
@ -290,25 +290,6 @@ public final class Utils {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if flash player is installed
|
||||
*
|
||||
* @param context the context needed to obtain the PackageManager
|
||||
* @return true if flash is installed, false otherwise
|
||||
*/
|
||||
public static boolean isFlashInstalled(@NonNull Context context) {
|
||||
try {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
ApplicationInfo ai = pm.getApplicationInfo("com.adobe.flashplayer", 0);
|
||||
if (ai != null) {
|
||||
return true;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quietly closes a closeable object like an InputStream or OutputStream without
|
||||
* throwing any errors or requiring you do do any checks.
|
||||
|
@ -29,7 +29,6 @@ import android.view.ViewGroup;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||
import android.webkit.WebSettings.PluginState;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.anthonycr.bonsai.Schedulers;
|
||||
@ -298,24 +297,6 @@ public class LightningView {
|
||||
} else {
|
||||
settings.setGeolocationEnabled(false);
|
||||
}
|
||||
if (API < Build.VERSION_CODES.KITKAT) {
|
||||
switch (mPreferences.getFlashSupport()) {
|
||||
case 0:
|
||||
//noinspection deprecation
|
||||
settings.setPluginState(PluginState.OFF);
|
||||
break;
|
||||
case 1:
|
||||
//noinspection deprecation
|
||||
settings.setPluginState(PluginState.ON_DEMAND);
|
||||
break;
|
||||
case 2:
|
||||
//noinspection deprecation
|
||||
settings.setPluginState(PluginState.ON);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setUserAgent(context, mPreferences.getUserAgentChoice());
|
||||
|
||||
|
@ -62,7 +62,6 @@ import org.purplei2p.lightning.BrowserApp;
|
||||
import org.purplei2p.lightning.constant.Constants;
|
||||
import org.purplei2p.lightning.controller.UIController;
|
||||
import org.purplei2p.lightning.dialog.BrowserDialog;
|
||||
import org.purplei2p.lightning.adblock.AdBlock;
|
||||
import org.purplei2p.lightning.utils.IntentUtils;
|
||||
import org.purplei2p.lightning.utils.Preconditions;
|
||||
import org.purplei2p.lightning.utils.ProxyUtils;
|
||||
@ -81,7 +80,6 @@ public class LightningWebClient extends WebViewClient {
|
||||
private TrustManagerFactory tmf = null;
|
||||
|
||||
@Inject ProxyUtils mProxyUtils;
|
||||
@Inject AdBlock mAdBlock;
|
||||
|
||||
LightningWebClient(@NonNull Activity activity, @NonNull LightningView lightningView) {
|
||||
BrowserApp.getAppComponent().inject(this);
|
||||
@ -90,7 +88,6 @@ public class LightningWebClient extends WebViewClient {
|
||||
mActivity = activity;
|
||||
mUIController = (UIController) activity;
|
||||
mLightningView = lightningView;
|
||||
mAdBlock.updatePreference();
|
||||
mIntentUtils = new IntentUtils(activity);
|
||||
try {
|
||||
initTrustStore();
|
||||
@ -128,10 +125,6 @@ public class LightningWebClient extends WebViewClient {
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, @NonNull WebResourceRequest request) {
|
||||
if (mAdBlock.isAd(request.getUrl().toString())) {
|
||||
ByteArrayInputStream EMPTY = new ByteArrayInputStream("".getBytes());
|
||||
return new WebResourceResponse("text/plain", "utf-8", EMPTY);
|
||||
}
|
||||
return super.shouldInterceptRequest(view, request);
|
||||
}
|
||||
|
||||
@ -140,10 +133,6 @@ public class LightningWebClient extends WebViewClient {
|
||||
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
||||
if (mAdBlock.isAd(url)) {
|
||||
ByteArrayInputStream EMPTY = new ByteArrayInputStream("".getBytes());
|
||||
return new WebResourceResponse("text/plain", "utf-8", EMPTY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
<string name="location">Местоположение</string>
|
||||
<string name="password">Сохранять пароли</string>
|
||||
<string name="agent">User Agent</string>
|
||||
<string name="flash">Включить Adobe Flash</string>
|
||||
<string name="home">Новая вкладка</string>
|
||||
<string name="fullscreen">Во весь экран</string>
|
||||
<string name="java">Включить JavaScript</string>
|
||||
@ -59,7 +58,6 @@
|
||||
<string name="dialog_download">Загрузить файл? (%1$s)</string>
|
||||
<string name="action_cancel">Отмена</string>
|
||||
<string name="title_warning">Внимание</string>
|
||||
<string name="dialog_adobe_not_installed">"Adobe Flash Player не найден.\nУстановите Flash Player"</string>
|
||||
<string name="title_user_agent">User Agent</string>
|
||||
<string name="title_download_location">Путь загрузки</string>
|
||||
<string name="title_custom_homepage">Введите адрес</string>
|
||||
@ -95,7 +93,6 @@
|
||||
<string name="download_sdcard_busy_dlg_title">Карта памяти недоступна</string>
|
||||
<string name="download_sdcard_busy_dlg_msg">Карта памяти подключена к ПК. Для начала загрузки отключите её от ПК, нажав на уведомление.</string>
|
||||
<string name="incognito_cookies">Включить куки в режиме инкогнито</string>
|
||||
<string name="title_flash">Adobe Flash</string>
|
||||
<string name="action_manual">Вручную</string>
|
||||
<string name="action_auto">Автоматически</string>
|
||||
<string name="action_follow_me">Связаться с разработчиками</string>
|
||||
|
@ -14,7 +14,6 @@
|
||||
<string name="location">Location access</string>
|
||||
<string name="password">Save your passwords</string>
|
||||
<string name="agent">User agent</string>
|
||||
<string name="flash">Enable Adobe Flash</string>
|
||||
<string name="home">Homepage</string>
|
||||
<string name="fullscreen">Full-screen mode</string>
|
||||
<string name="java">Enable JavaScript</string>
|
||||
@ -61,7 +60,6 @@
|
||||
<string name="unknown_size">Unknown size</string>
|
||||
<string name="action_cancel">Cancel</string>
|
||||
<string name="title_warning">Warning</string>
|
||||
<string name="dialog_adobe_not_installed">Adobe Flash Player was not detected.\nPlease install Flash Player.</string>
|
||||
<string name="title_user_agent">User agent</string>
|
||||
<string name="title_download_location">Download location</string>
|
||||
<string name="title_custom_homepage">Custom homepage</string>
|
||||
@ -97,7 +95,6 @@
|
||||
<string name="download_sdcard_busy_dlg_title">USB storage unavailable</string>
|
||||
<string name="download_sdcard_busy_dlg_msg">The storage is busy. To allow downloads, touch \'Turn Off USB Storage\' in the notification.</string>
|
||||
<string name="incognito_cookies">Enable cookies in incognito mode</string>
|
||||
<string name="title_flash">Adobe Flash</string>
|
||||
<string name="action_manual">Manual</string>
|
||||
<string name="action_auto">Auto</string>
|
||||
<string name="action_follow_me">Contact me</string>
|
||||
@ -215,7 +212,6 @@
|
||||
<string name="clear_web_storage_exit">Clear web storage on exit</string>
|
||||
<string name="message_web_storage_cleared">Web storage cleared</string>
|
||||
<string name="hosts_source">Hosts file ad blocking source</string>
|
||||
<string name="settings_adblock">Ad block settings</string>
|
||||
<string name="tabs_in_drawer">Show tabs in navigation drawer</string>
|
||||
<string name="swap_bookmarks_and_tabs">Swap bookmark and tab drawers</string>
|
||||
<string name="do_not_track">Request \'Do Not Track\'</string>
|
||||
@ -223,7 +219,6 @@
|
||||
<string name="action_add_to_homescreen">Add to home screen</string>
|
||||
<string name="message_added_to_homescreen">Shortcut added to home screen</string>
|
||||
<string name="action_delete_all_bookmarks">Delete all bookmarks</string>
|
||||
<string name="flash_not_supported">Flash Player is not supported by your system</string>
|
||||
<string name="upsell_plus_version">Upgrade to Lightning Plus to block ads</string>
|
||||
<string name="message_open_download_fail">This file doesn\'t exist anymore</string>
|
||||
|
||||
|
@ -2,14 +2,6 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_general">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="cb_flash"
|
||||
android:title="@string/flash" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="cb_ads"
|
||||
android:title="@string/block_ads" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="cb_images"
|
||||
|
@ -24,6 +24,5 @@ ext {
|
||||
buildToolsVersion = '26.0.3'
|
||||
|
||||
versionName = '4.5.1'
|
||||
versionCode_lite = 98
|
||||
versionCode_plus = 96
|
||||
versionCode = 96
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user