X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FMainWebView.java;h=2e5503b639c752084ff3d11305defe99fd0b1613;hb=e59f99e8ba2f66916186c13dabea9686e1b6f70f;hp=b9c2746a828aa923e24178784fc8a16afa786345;hpb=c3c399fcc6ada5f970e3d75102ad8e61303903a0;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java index b9c2746a..2e5503b6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java @@ -1,5 +1,5 @@ /** - * Copyright 2015-2016 Soren Stoutner . + * Copyright 2015-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -127,7 +127,6 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN public static SslCertificate sslCertificate; - // `drawerLayout` is used in `onCreate()`, `onNewIntent()`, and `onBackPressed()`. private DrawerLayout drawerLayout; @@ -529,14 +528,16 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN // Create a variable to track if this is an ad server. boolean requestHostIsAdServer = false; - // Check all the subdomains of `requestHost`. - while (requestHost.contains(".")) { - if (adServersSet.contains(requestHost)) { - requestHostIsAdServer = true; - } + // Check all the subdomains of `requestHost` if it is not null. + if (requestHost != null) { + while (requestHost.contains(".")) { + if (adServersSet.contains(requestHost)) { + requestHostIsAdServer = true; + } - // Strip out the lowest subdomain of `requestHost`. - requestHost = requestHost.substring(requestHost.indexOf(".") + 1); + // Strip out the lowest subdomain of `requestHost`. + requestHost = requestHost.substring(requestHost.indexOf(".") + 1); + } } if (requestHostIsAdServer) { // It is an ad server. @@ -1518,7 +1519,7 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN String fileName = downloadFileNameEditText.getText().toString(); // Once we have `WRITE_EXTERNAL_STORAGE` permissions we can use `setDestinationInExternalPublicDir`. - if (Build.VERSION.SDK_INT >= 23) { // If API >= 23, set the download save in the the `DIRECTORY_DOWNLOADS` using `fileName`. + if (Build.VERSION.SDK_INT >= 23) { // If API >= 23, set the download location to `/sdcard/Android/data/com.stoutner.privacybrowser.standard/files` named `fileName`. downloadRequest.setDestinationInExternalFilesDir(this, "/", fileName); } else { // Only set the title using `fileName`. downloadRequest.setTitle(fileName); @@ -1716,7 +1717,7 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN String defaultFontSizeString = sharedPreferences.getString("default_font_size", "100"); swipeToRefreshEnabled = sharedPreferences.getBoolean("swipe_to_refresh_enabled", false); adBlockerEnabled = sharedPreferences.getBoolean("block_ads", true); - boolean doNotTrackEnabled = sharedPreferences.getBoolean("do_not_track", true); + boolean doNotTrackEnabled = sharedPreferences.getBoolean("do_not_track", false); boolean proxyThroughOrbot = sharedPreferences.getBoolean("proxy_through_orbot", false); fullScreenBrowsingModeEnabled = sharedPreferences.getBoolean("enable_full_screen_browsing_mode", false); hideSystemBarsOnFullscreen = sharedPreferences.getBoolean("hide_system_bars", false);