]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Make first-party cookies tab aware.
authorSoren Stoutner <soren@stoutner.com>
Tue, 16 Apr 2019 23:54:39 +0000 (16:54 -0700)
committerSoren Stoutner <soren@stoutner.com>
Tue, 16 Apr 2019 23:54:39 +0000 (16:54 -0700)
41 files changed:
app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/AboutViewSourceDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadLocationPermissionDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/PinnedMismatchDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/SaveLogcatDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/StoragePermissionDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java
app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java
app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainsListFragment.java
app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java
app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java
app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java
app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java
app/src/main/res/values-de/strings.xml
app/src/main/res/values-es/strings.xml
app/src/main/res/values-it/strings.xml
app/src/main/res/values-ru/strings.xml
app/src/main/res/values-tr/strings.xml
app/src/main/res/values/strings.xml

index 3508b7521f3de43efec13ac42c3ca111abaabaa8..e15bfe79a0bb77b38617dbc496ea3e639d3b6711 100644 (file)
@@ -19,7 +19,9 @@
 
 package com.stoutner.privacybrowser.activities;
 
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.WindowManager;
 
 import androidx.appcompat.app.ActionBar;
@@ -38,13 +40,20 @@ import com.stoutner.privacybrowser.R;
 public class AboutActivity extends AppCompatActivity {
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark_SecondaryActivity);
         } else {
             setTheme(R.style.PrivacyBrowserLight_SecondaryActivity);
index 232e3be73b3376ecc62d4e793dc938ba2926e7d9..d29e54c4cc6e8b9ddcdfeebabf9ef96d6098a8e8 100644 (file)
@@ -23,6 +23,7 @@ import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
@@ -30,6 +31,7 @@ import android.graphics.Typeface;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.util.SparseBooleanArray;
 import android.view.ActionMode;
 import android.view.Menu;
@@ -121,13 +123,20 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the activity theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark_SecondaryActivity);
         } else {
             setTheme(R.style.PrivacyBrowserLight_SecondaryActivity);
@@ -948,6 +957,12 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
     }
 
     private void updateMoveIcons() {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Get a long array of the selected bookmarks.
         long[] selectedBookmarksLongArray = bookmarksListView.getCheckedItemIds();
 
@@ -969,7 +984,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
             moveBookmarkUpMenuItem.setEnabled(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_dark);
             } else {
                 moveBookmarkUpMenuItem.setIcon(R.drawable.move_up_enabled_light);
@@ -988,7 +1003,7 @@ public class BookmarksActivity extends AppCompatActivity implements CreateBookma
             moveBookmarkDownMenuItem.setEnabled(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_dark);
             } else {
                 moveBookmarkDownMenuItem.setIcon(R.drawable.move_down_enabled_light);
index abff463207370a977e7ed07390ab950fd4b41653..3cdc67923370809053db8bf92d72bc2e73eb6459 100644 (file)
@@ -22,6 +22,7 @@ package com.stoutner.privacybrowser.activities;
 import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.database.MatrixCursor;
 import android.database.MergeCursor;
@@ -31,6 +32,7 @@ import android.graphics.Typeface;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.util.SparseBooleanArray;
 import android.view.ActionMode;
 import android.view.Menu;
@@ -100,13 +102,20 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the activity theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark_SecondaryActivity);
         } else {
             setTheme(R.style.PrivacyBrowserLight_SecondaryActivity);
@@ -324,7 +333,7 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements
                     bookmarkParentFolderTextView.setText(bookmarkParentFolder);
 
                     // Set the text color according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.gray_300));
                     } else {
                         bookmarkParentFolderTextView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.black));
@@ -584,9 +593,16 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements
 
     @Override
     public boolean onOptionsItemSelected(MenuItem menuItem) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Get the ID of the menu item that was selected.
         int menuItemId = menuItem.getItemId();
 
+        // Run the command that corresponds to the selected menu item.
         switch (menuItemId) {
             case android.R.id.home:  // The home arrow is identified as `android.R.id.home`, not just `R.id.home`.
                 // Exit the activity.
@@ -603,7 +619,7 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements
                 // Update the icon and display a snackbar.
                 if (sortByDisplayOrder) {  // Sort by display order.
                     // Update the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         menuItem.setIcon(R.drawable.sort_selected_dark);
                     } else {
                         menuItem.setIcon(R.drawable.sort_selected_light);
@@ -613,7 +629,7 @@ public class BookmarksDatabaseViewActivity extends AppCompatActivity implements
                     Snackbar.make(bookmarksListView, R.string.sorted_by_display_order, Snackbar.LENGTH_SHORT).show();
                 } else {  // Sort by database id.
                     // Update the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         menuItem.setIcon(R.drawable.sort_dark);
                     } else {
                         menuItem.setIcon(R.drawable.sort_light);
index 520e6969c11b3bd30f3638c42b3787f6988d3926..11a73078cecbf83979a45c0a25e90c462a6f056e 100644 (file)
@@ -23,11 +23,13 @@ import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.content.res.Resources;
 import android.database.Cursor;
 import android.net.http.SslCertificate;
 import android.os.Bundle;
 import android.os.Handler;
+import android.preference.PreferenceManager;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -118,13 +120,20 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the activity theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark_SecondaryActivity);
         } else {
             setTheme(R.style.PrivacyBrowserLight_SecondaryActivity);
@@ -492,11 +501,17 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo
                                             Runnable enableDeleteMenuItemRunnable = () -> {
                                                 // Enable `deleteMenuItem` according to the display mode.
                                                 if (twoPanedMode) {  // Two-paned mode.
-                                                    // Enable `deleteMenuItem`.
+                                                    // Enable the delete menu item.
                                                     deleteMenuItem.setEnabled(true);
 
+                                                    // Get a handle for the shared preferences.
+                                                    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+
+                                                    // Get the theme preferences.
+                                                    boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
                                                     // Set the delete icon according to the theme.
-                                                    if (MainWebViewActivity.darkTheme) {
+                                                    if (darkTheme) {
                                                         deleteMenuItem.setIcon(R.drawable.delete_dark);
                                                     } else {
                                                         deleteMenuItem.setIcon(R.drawable.delete_light);
@@ -823,8 +838,14 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo
             // Enable the delete options menu items.
             deleteMenuItem.setEnabled(true);
 
+            // Get a handle for the shared preferences.
+            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+            // Get the theme and screenshot preferences.
+            boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
             // Set the delete icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 deleteMenuItem.setIcon(R.drawable.delete_dark);
             } else {
                 deleteMenuItem.setIcon(R.drawable.delete_light);
index 0f73f06556bd0bcfb3d185fa1e0c546f0281d70b..bd459471876c591dd4f634cae61ed350377848cd 100644 (file)
@@ -19,7 +19,9 @@
 
 package com.stoutner.privacybrowser.activities;
 
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.WindowManager;
 
 import androidx.appcompat.app.ActionBar;
@@ -38,13 +40,20 @@ import com.stoutner.privacybrowser.R;
 public class GuideActivity extends AppCompatActivity {
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark_SecondaryActivity);
         } else {
             setTheme(R.style.PrivacyBrowserLight_SecondaryActivity);
index 3f7d2962e1bb02973ff2516e23e8754930f13ebd..9263f622615e7faf52412b45ff5b64050c270d0d 100644 (file)
@@ -22,12 +22,14 @@ package com.stoutner.privacybrowser.activities;
 import android.Manifest;
 import android.app.Activity;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.media.MediaScannerConnection;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Environment;
+import android.preference.PreferenceManager;
 import android.provider.DocumentsContract;
 import android.text.Editable;
 import android.text.TextWatcher;
@@ -88,13 +90,20 @@ public class ImportExportActivity extends AppCompatActivity implements StoragePe
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the activity theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark_SecondaryActivity);
         } else {
             setTheme(R.style.PrivacyBrowserLight_SecondaryActivity);
index a615a541dd45c9be93e45904ce23925ed3313a71..eb0ba2dc16294295649d4b110a82965cbf6c7ebb 100644 (file)
@@ -25,12 +25,14 @@ import android.app.Dialog;
 import android.content.ClipData;
 import android.content.ClipboardManager;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.media.MediaScannerConnection;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Environment;
+import android.preference.PreferenceManager;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.WindowManager;
@@ -68,13 +70,20 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme and screenshot preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the activity theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark_SecondaryActivity);
         } else {
             setTheme(R.style.PrivacyBrowserLight_SecondaryActivity);
@@ -107,7 +116,7 @@ public class LogcatActivity extends AppCompatActivity implements SaveLogcatDialo
         });
 
         // Set the swipe to refresh color according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             swipeRefreshLayout.setColorSchemeResources(R.color.blue_600);
             swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.gray_800);
         } else {
index e08fa8fa764a13d8e0ce06ce81b405dfc464d9ae..2be23411215e66acec896f251ef7cdefbcfe29f1 100644 (file)
@@ -156,6 +156,7 @@ import java.util.Set;
 
 // TODO.  Store up reloads for tabs that are not visible.
 // TODO.  New tabs are white in dark mode.
+// TODO.  Hide the tabs in full screen mode.
 
 // AppCompatActivity from android.support.v7.app.AppCompatActivity must be used to have access to the SupportActionBar until the minimum API is >= 21.
 public class MainWebViewActivity extends AppCompatActivity implements CreateBookmarkDialog.CreateBookmarkListener, CreateBookmarkFolderDialog.CreateBookmarkFolderListener,
@@ -163,12 +164,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         EditBookmarkFolderDialog.EditBookmarkFolderListener, HttpAuthenticationDialog.HttpAuthenticationListener, NavigationView.OnNavigationItemSelectedListener, WebViewTabFragment.NewTabListener,
         PinnedMismatchDialog.PinnedMismatchListener, SslCertificateErrorDialog.SslCertificateErrorListener, UrlHistoryDialog.UrlHistoryListener {
 
-    // `darkTheme` is public static so it can be accessed from everywhere.
-    public static boolean darkTheme;
-
-    // `allowScreenshots` is public static so it can be accessed from everywhere.  It is also used in `onCreate()`.
-    public static boolean allowScreenshots;
-
     // `orbotStatus` is public static so it can be accessed from `OrbotProxyHelper`.  It is also used in `onCreate()`, `onResume()`, and `applyProxyThroughOrbot()`.
     public static String orbotStatus;
 
@@ -185,7 +180,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
     // `restartFromBookmarksActivity` is public static so it can be accessed from `BookmarksActivity`.  It is also used in `onRestart()`.
     public static boolean restartFromBookmarksActivity;
 
-    // The blocklist versions are public static so they can be accessed from `AboutTabFragment`.  They are also used in `onCreate()`.
+    // The blocklist versions are public static so they can be accessed from `AboutTabFragment`.  They are also used in `onCreate()`.  // TODO.
     public static String easyListVersion;
     public static String easyPrivacyVersion;
     public static String fanboysAnnoyanceVersion;
@@ -216,14 +211,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
     // `customHeader` is used in `onCreate()`, `onOptionsItemSelected()`, `onCreateContextMenu()`, and `loadUrl()`.
     private final Map<String, String> customHeaders = new HashMap<>();
 
-    // `firstPartyCookiesEnabled` is used in `onCreate()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, `onDownloadImage()`, `onDownloadFile()`, and `applyDomainSettings()`.
-    private boolean firstPartyCookiesEnabled;
-
-    // 'homepage' is used in `onCreate()`, `onNavigationItemSelected()`, and `applyProxyThroughOrbot()`.
-    private String homepage;  // TODO ?
-
-    // `searchURL` is used in `loadURLFromTextBox()` and `applyProxyThroughOrbot()`.
-    private String searchURL;  // TODO ?
+    // The search URL is set in `applyProxyThroughOrbot()` and used in `onCreate()`, `onNewIntent()`, `loadURLFromTextBox()`, and `initializeWebView()`.
+    private String searchURL;
 
     // The options menu is set in `onCreateOptionsMenu()` and used in `onOptionsItemSelected()`, `updatePrivacyIcons()`, and `initializeWebView()`.
     private Menu optionsMenu;
@@ -348,8 +337,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
 
         // Get the theme and screenshot preferences.
-        darkTheme = sharedPreferences.getBoolean("dark_theme", false);
-        allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
 
         // Disable screenshots if not allowed.
         if (!allowScreenshots) {
@@ -474,8 +463,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                         // Load the URL from the intent.
                         loadUrl(launchingIntentUriData.toString());
                     } else {  // The is no URL in the intent.
-                        // Load the homepage.
-                        loadUrl(homepage);
+                        // Select the homepage based on the proxy through Orbot status.
+                        if (proxyThroughOrbot) {
+                            // Load the Tor homepage.
+                            loadUrl(sharedPreferences.getString("tor_homepage", getString(R.string.tor_homepage_default_value)));
+                        } else {
+                            // Load the normal homepage.
+                            loadUrl(sharedPreferences.getString("homepage", getString(R.string.homepage_default_value)));
+                        }
                     }
                 }
             }
@@ -836,9 +831,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         // Initialize `inFullScreenBrowsingMode`, which is always false at this point because Privacy Browser never starts in full screen browsing mode.
         inFullScreenBrowsingMode = false;
 
-        // Initialize the privacy settings variables.
-        firstPartyCookiesEnabled = false;
-
         // Inflate a bare WebView to get the default user agent.  It is not used to render content on the screen.
         @SuppressLint("InflateParams") View webViewLayout = getLayoutInflater().inflate(R.layout.bare_webview, null, false);
 
@@ -1144,8 +1136,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         // Get the shared preference values.
         SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
 
-        // Get the status of the additional AppBar icons.
+        // Get the dark theme and app bar preferences..
         boolean displayAdditionalAppBarIcons = sharedPreferences.getBoolean("display_additional_app_bar_icons", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
 
         // Set the status of the additional app bar icons.  Setting the refresh menu item to `SHOW_AS_ACTION_ALWAYS` makes it appear even on small devices like phones.
         if (displayAdditionalAppBarIcons) {
@@ -1244,7 +1237,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 thirdPartyCookiesMenuItem.setChecked(cookieManager.acceptThirdPartyCookies(currentWebView));
 
                 // Enable third-party cookies if first-party cookies are enabled.
-                thirdPartyCookiesMenuItem.setEnabled(firstPartyCookiesEnabled);
+                thirdPartyCookiesMenuItem.setEnabled(cookieManager.acceptCookie());
             }
 
             // Enable DOM Storage if JavaScript is enabled.
@@ -1252,7 +1245,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         }
 
         // Set the status of the menu item checkboxes.
-        firstPartyCookiesMenuItem.setChecked(firstPartyCookiesEnabled);
+        firstPartyCookiesMenuItem.setChecked(cookieManager.acceptCookie());
         proxyThroughOrbotMenuItem.setChecked(proxyThroughOrbot);
 
         // Enable Clear Cookies if there are any.
@@ -1385,8 +1378,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
     @Override
     // Remove Android Studio's warning about the dangers of using SetJavaScriptEnabled.
     @SuppressLint("SetJavaScriptEnabled")
-    // removeAllCookies is deprecated, but it is required for API < 21.
-    @SuppressWarnings("deprecation")
     public boolean onOptionsItemSelected(MenuItem menuItem) {
         // Reenter full screen browsing mode if it was interrupted by the options menu.  <https://redmine.stoutner.com/issues/389>
         if (inFullScreenBrowsingMode) {
@@ -1426,7 +1417,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 // Display a `Snackbar`.
                 if (currentWebView.getSettings().getJavaScriptEnabled()) {  // JavaScrip is enabled.
                     Snackbar.make(findViewById(R.id.webviewpager), R.string.javascript_enabled, Snackbar.LENGTH_SHORT).show();
-                } else if (firstPartyCookiesEnabled) {  // JavaScript is disabled, but first-party cookies are enabled.
+                } else if (cookieManager.acceptCookie()) {  // JavaScript is disabled, but first-party cookies are enabled.
                     Snackbar.make(findViewById(R.id.webviewpager), R.string.javascript_disabled, Snackbar.LENGTH_SHORT).show();
                 } else {  // Privacy mode.
                     Snackbar.make(findViewById(R.id.webviewpager), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show();
@@ -1489,20 +1480,20 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 return true;
 
             case R.id.toggle_first_party_cookies:
-                // Switch the status of firstPartyCookiesEnabled.
-                firstPartyCookiesEnabled = !firstPartyCookiesEnabled;
+                // Switch the first-party cookie status.
+                cookieManager.setAcceptCookie(!cookieManager.acceptCookie());
 
-                // Update the menu checkbox.
-                menuItem.setChecked(firstPartyCookiesEnabled);
+                // Store the first-party cookie status.
+                currentWebView.setAcceptFirstPartyCookies(cookieManager.acceptCookie());
 
-                // Apply the new cookie status.
-                cookieManager.setAcceptCookie(firstPartyCookiesEnabled);
+                // Update the menu checkbox.
+                menuItem.setChecked(cookieManager.acceptCookie());
 
                 // Update the privacy icon.  `true` runs `invalidateOptionsMenu` as the last step.
                 updatePrivacyIcons(true);
 
-                // Display a `Snackbar`.
-                if (firstPartyCookiesEnabled) {  // First-party cookies are enabled.
+                // Display a snackbar.
+                if (cookieManager.acceptCookie()) {  // First-party cookies are enabled.
                     Snackbar.make(findViewById(R.id.webviewpager), R.string.first_party_cookies_enabled, Snackbar.LENGTH_SHORT).show();
                 } else if (currentWebView.getSettings().getJavaScriptEnabled()) {  // JavaScript is still enabled.
                     Snackbar.make(findViewById(R.id.webviewpager), R.string.first_party_cookies_disabled, Snackbar.LENGTH_SHORT).show();
@@ -2010,16 +2001,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 return true;
 
             case R.id.print:
-                // Get a `PrintManager` instance.
+                // Get a print manager instance.
                 PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE);
 
-                // Create a print document adapter form the current WebView.
-                PrintDocumentAdapter printDocumentAdapter = currentWebView.createPrintDocumentAdapter();
-
-                // Remove the lint error below that `printManager` might be `null`.
+                // Remove the lint error below that print manager might be null.
                 assert printManager != null;
 
-                // Print the document.  The print attributes are `null`.
+                // Create a print document adapter from the current WebView.
+                PrintDocumentAdapter printDocumentAdapter = currentWebView.createPrintDocumentAdapter();
+
+                // Print the document.
                 printManager.print(getString(R.string.privacy_browser_web_page), printDocumentAdapter, null);
                 return true;
 
@@ -2077,6 +2068,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         // Get the menu item ID.
         int menuItemId = menuItem.getItemId();
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
         // Run the commands that correspond to the selected menu item.
         switch (menuItemId) {
             case R.id.close_tab:
@@ -2101,9 +2095,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 bookmarksCursor.close();
                 bookmarksDatabaseHelper.close();
 
-                // Get a handle for the shared preferences.
-                SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
-
                 // Get the status of the clear everything preference.
                 boolean clearEverything = sharedPreferences.getBoolean("clear_everything", true);
 
@@ -2270,7 +2261,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 break;
 
             case R.id.home:
-                loadUrl(homepage);
+                // Select the homepage based on the proxy through Orbot status.
+                if (proxyThroughOrbot) {
+                    // Load the Tor homepage.
+                    loadUrl(sharedPreferences.getString("tor_homepage", getString(R.string.tor_homepage_default_value)));
+                } else {
+                    // Load the normal homepage.
+                    loadUrl(sharedPreferences.getString("homepage", getString(R.string.homepage_default_value)));
+                }
                 break;
 
             case R.id.back:
@@ -2995,11 +2993,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             // Parse `imageUrl`.
             DownloadManager.Request downloadRequest = new DownloadManager.Request(Uri.parse(imageUrl));
 
+            // Get a handle for the cookie manager.
+            CookieManager cookieManager = CookieManager.getInstance();
+
             // Pass cookies to download manager if cookies are enabled.  This is required to download images from websites that require a login.
             // Code contributed 2017 Hendrik Knackstedt.  Copyright assigned to Soren Stoutner <soren@stoutner.com>.
-            if (firstPartyCookiesEnabled) {
+            if (cookieManager.acceptCookie()) {
                 // Get the cookies for `imageUrl`.
-                String cookies = CookieManager.getInstance().getCookie(imageUrl);
+                String cookies = cookieManager.getCookie(imageUrl);
 
                 // Add the cookies to `downloadRequest`.  In the HTTP request header, cookies are named `Cookie`.
                 downloadRequest.addRequestHeader("Cookie", cookies);
@@ -3047,11 +3048,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             // Parse `downloadUrl`.
             DownloadManager.Request downloadRequest = new DownloadManager.Request(Uri.parse(downloadUrl));
 
+            // Get a handle for the cookie manager.
+            CookieManager cookieManager = CookieManager.getInstance();
+
             // Pass cookies to download manager if cookies are enabled.  This is required to download files from websites that require a login.
             // Code contributed 2017 Hendrik Knackstedt.  Copyright assigned to Soren Stoutner <soren@stoutner.com>.
-            if (firstPartyCookiesEnabled) {
+            if (cookieManager.acceptCookie()) {
                 // Get the cookies for `downloadUrl`.
-                String cookies = CookieManager.getInstance().getCookie(downloadUrl);
+                String cookies = cookieManager.getCookie(downloadUrl);
 
                 // Add the cookies to `downloadRequest`.  In the HTTP request header, cookies are named `Cookie`.
                 downloadRequest.addRequestHeader("Cookie", cookies);
@@ -3529,6 +3533,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             String defaultUserAgentName = sharedPreferences.getString("user_agent", getString(R.string.user_agent_default_value));
             boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true);
             boolean displayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true);
+            boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
 
             // Get a handle for the cookie manager.
             CookieManager cookieManager = CookieManager.getInstance();
@@ -3549,7 +3554,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 // Get the settings from the cursor.
                 nestedScrollWebView.setDomainSettingsDatabaseId(currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper._ID)));
                 boolean domainJavaScriptEnabled = (currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_JAVASCRIPT)) == 1);
-                firstPartyCookiesEnabled = (currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FIRST_PARTY_COOKIES)) == 1);  // TODO.
+                nestedScrollWebView.setAcceptFirstPartyCookies(currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FIRST_PARTY_COOKIES)) == 1);
                 boolean domainThirdPartyCookiesEnabled = (currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_THIRD_PARTY_COOKIES)) == 1);
                 nestedScrollWebView.getSettings().setDomStorageEnabled(currentDomainSettingsCursor.getInt(currentDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_DOM_STORAGE)) == 1);
                 // Form data can be removed once the minimum API >= 26.
@@ -3641,11 +3646,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     nestedScrollWebView.getSettings().setJavaScriptEnabled(domainJavaScriptEnabled);
                 }
 
-                // Close `currentHostDomainSettingsCursor`.
+                // Close the current host domain settings cursor.
                 currentDomainSettingsCursor.close();
 
                 // Apply the domain settings.
-                cookieManager.setAcceptCookie(firstPartyCookiesEnabled);  //TODO  This could be bad.
+                cookieManager.setAcceptCookie(nestedScrollWebView.getAcceptFirstPartyCookies());
+
+                // Set third-party cookies status if API >= 21.
+                if (Build.VERSION.SDK_INT >= 21) {
+                    cookieManager.setAcceptThirdPartyCookies(nestedScrollWebView, domainThirdPartyCookiesEnabled);
+                }
 
                 // Apply the form data setting if the API < 26.
                 if (Build.VERSION.SDK_INT < 26) {
@@ -3659,11 +3669,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     nestedScrollWebView.getSettings().setTextZoom(fontSize);
                 }
 
-                // Set third-party cookies status if API >= 21.
-                if (Build.VERSION.SDK_INT >= 21) {
-                    cookieManager.setAcceptThirdPartyCookies(nestedScrollWebView, domainThirdPartyCookiesEnabled);
-                }
-
                 // Only set the user agent if the webpage is not currently loading.  Otherwise, changing the user agent on redirects can cause the original website to reload.
                 // <https://redmine.stoutner.com/issues/160>
                 if (nestedScrollWebView.getProgress() == 100) {  // A URL is not loading.
@@ -3764,7 +3769,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             } else {  // The new URL does not have custom domain settings.  Load the defaults.
                 // Store the values from the shared preferences.
                 boolean defaultJavaScriptEnabled = sharedPreferences.getBoolean("javascript", false);
-                firstPartyCookiesEnabled = sharedPreferences.getBoolean("first_party_cookies", false);  // TODO.
+                nestedScrollWebView.setAcceptFirstPartyCookies(sharedPreferences.getBoolean("first_party_cookies", false));
                 boolean defaultThirdPartyCookiesEnabled = sharedPreferences.getBoolean("third_party_cookies", false);
                 nestedScrollWebView.getSettings().setDomStorageEnabled(sharedPreferences.getBoolean("dom_storage", false));
                 boolean saveFormData = sharedPreferences.getBoolean("save_form_data", false);  // Form data can be removed once the minimum API >= 26.
@@ -3786,20 +3791,20 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 }
 
                 // Apply the default settings.
-                cookieManager.setAcceptCookie(firstPartyCookiesEnabled);  // TODO.
+                cookieManager.setAcceptCookie(nestedScrollWebView.getAcceptFirstPartyCookies());
                 nestedScrollWebView.getSettings().setTextZoom(Integer.valueOf(defaultFontSizeString));
 
+                // Apply the form data setting if the API < 26.
+                if (Build.VERSION.SDK_INT < 26) {
+                    nestedScrollWebView.getSettings().setSaveFormData(saveFormData);
+                }
+
                 // Store the swipe to refresh status in the nested scroll WebView.
                 nestedScrollWebView.setSwipeToRefresh(defaultSwipeToRefresh);
 
                 // Apply swipe to refresh according to the default.
                 swipeRefreshLayout.setEnabled(defaultSwipeToRefresh);
 
-                // Apply the form data setting if the API < 26.
-                if (Build.VERSION.SDK_INT < 26) {
-                    nestedScrollWebView.getSettings().setSaveFormData(saveFormData);
-                }
-
                 // Reset the pinned variables.
                 nestedScrollWebView.setDomainSettingsDatabaseId(-1);
 
@@ -3864,13 +3869,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         // Get a handle for the shared preferences.
         SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
 
-        // Get the search preferences.
-        String homepageString = sharedPreferences.getString("homepage", getString(R.string.homepage_default_value));
-        String torHomepageString = sharedPreferences.getString("tor_homepage", getString(R.string.tor_homepage_default_value));
+        // Get the search and theme preferences.
         String torSearchString = sharedPreferences.getString("tor_search", getString(R.string.tor_search_default_value));
         String torSearchCustomUrlString = sharedPreferences.getString("tor_search_custom_url", getString(R.string.tor_search_custom_url_default_value));
         String searchString = sharedPreferences.getString("search", getString(R.string.search_default_value));
         String searchCustomUrlString = sharedPreferences.getString("search_custom_url", getString(R.string.search_custom_url_default_value));
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
 
         // Get a handle for the action bar.  `getSupportActionBar()` must be used until the minimum API >= 21.
         ActionBar actionBar = getSupportActionBar();
@@ -3880,9 +3884,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
         // Set the homepage, search, and proxy options.
         if (proxyThroughOrbot) {  // Set the Tor options.
-            // Set `torHomepageString` as `homepage`.
-            homepage = torHomepageString;
-
             // Set the search URL.
             if (torSearchString.equals("Custom URL")) {  // Get the custom URL string.
                 searchURL = torSearchCustomUrlString;
@@ -3915,9 +3916,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 currentWebView.reload();
             }
         } else {  // Set the non-Tor options.
-            // Set `homepageString` as `homepage`.
-            homepage = homepageString;
-
             // Set the search URL.
             if (searchString.equals("Custom URL")) {  // Get the custom URL string.
                 searchURL = searchCustomUrlString;
@@ -3964,6 +3962,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
     private void updatePrivacyIcons(boolean runInvalidateOptionsMenu) {
         // Only update the privacy icons if the options menu and the current WebView have already been populated.
         if ((optionsMenu != null) && (currentWebView != null)) {
+            // Get a handle for the shared preferences.
+            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+            // Get the theme and screenshot preferences.
+            boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
             // Get handles for the menu items.
             MenuItem privacyMenuItem = optionsMenu.findItem(R.id.toggle_javascript);
             MenuItem firstPartyCookiesMenuItem = optionsMenu.findItem(R.id.toggle_first_party_cookies);
@@ -3973,14 +3977,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             // Update the privacy icon.
             if (currentWebView.getSettings().getJavaScriptEnabled()) {  // JavaScript is enabled.
                 privacyMenuItem.setIcon(R.drawable.javascript_enabled);
-            } else if (firstPartyCookiesEnabled) {  // JavaScript is disabled but cookies are enabled.
+            } else if (currentWebView.getAcceptFirstPartyCookies()) {  // JavaScript is disabled but cookies are enabled.
                 privacyMenuItem.setIcon(R.drawable.warning);
             } else {  // All the dangerous features are disabled.
                 privacyMenuItem.setIcon(R.drawable.privacy_mode);
             }
 
             // Update the first-party cookies icon.
-            if (firstPartyCookiesEnabled) {  // First-party cookies are enabled.
+            if (currentWebView.getAcceptFirstPartyCookies()) {  // First-party cookies are enabled.
                 firstPartyCookiesMenuItem.setIcon(R.drawable.cookies_enabled);
             } else {  // First-party cookies are disabled.
                 if (darkTheme) {
@@ -4209,6 +4213,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
     }
 
     private void setCurrentWebView(int pageNumber) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
+        // Get the theme preference.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Get handles for the URL views.
         RelativeLayout urlRelativeLayout = findViewById(R.id.url_relativelayout);
         EditText urlEditText = findViewById(R.id.url_edittext);
@@ -4243,6 +4253,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
             swipeRefreshLayout.setEnabled(false);
         }
 
+        // Get a handle for the cookie manager.
+        CookieManager cookieManager = CookieManager.getInstance();
+
+        // Set the first-party cookie status.
+        cookieManager.setAcceptCookie(currentWebView.getAcceptFirstPartyCookies());
+
         // Update the privacy icons.  `true` redraws the icons in the app bar.
         updatePrivacyIcons(true);
 
@@ -5072,6 +5088,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
 
             @Override
             public void onPageStarted(WebView view, String url, Bitmap favicon) {
+                // Get the theme preference.
+                boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
                 // Reset the list of resource requests.
                 nestedScrollWebView.clearResourceRequests();
 
@@ -5125,7 +5144,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                         // Set the title.
                         refreshMenuItem.setTitle(R.string.stop);
 
-                        // Get the status of the additional AppBar icons.
+                        // Get the app bar and theme preferences.
                         boolean displayAdditionalAppBarIcons = sharedPreferences.getBoolean("display_additional_app_bar_icons", false);
 
                         // If the icon is displayed in the AppBar, set it according to the theme.
@@ -5148,8 +5167,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     nestedScrollWebView.getSettings().setUseWideViewPort(url.startsWith("http"));
                 }
 
-                // Flush any cookies to persistent storage.  `CookieManager` has become very lazy about flushing cookies in recent versions.
-                if (firstPartyCookiesEnabled && Build.VERSION.SDK_INT >= 21) {
+                // Flush any cookies to persistent storage.  The cookie manager has become very lazy about flushing cookies in recent versions.
+                if (nestedScrollWebView.getAcceptFirstPartyCookies() && Build.VERSION.SDK_INT >= 21) {
                     CookieManager.getInstance().flush();
                 }
 
@@ -5161,8 +5180,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     // Reset the Refresh title.
                     refreshMenuItem.setTitle(R.string.refresh);
 
-                    // Get the status of the additional AppBar icons.
+                    // Get the app bar and theme preferences.
                     boolean displayAdditionalAppBarIcons = sharedPreferences.getBoolean("display_additional_app_bar_icons", false);
+                    boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
 
                     // If the icon is displayed in the AppBar, reset it according to the theme.
                     if (displayAdditionalAppBarIcons) {
@@ -5174,7 +5194,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     }
                 }
 
-
                 // Clear the cache and history if Incognito Mode is enabled.
                 if (incognitoModeEnabled) {
                     // Clear the cache.  `true` includes disk files.
@@ -5313,8 +5332,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     // Load the URL from the intent.
                     loadUrl(launchingIntentUriData.toString());
                 } else {  // The is no URL in the intent.
-                    // Load the homepage.
-                    loadUrl(homepage);
+                    // Select the homepage based on the proxy through Orbot status.
+                    if (proxyThroughOrbot) {
+                        // Load the Tor homepage.
+                        loadUrl(sharedPreferences.getString("tor_homepage", getString(R.string.tor_homepage_default_value)));
+                    } else {
+                        // Load the normal homepage.
+                        loadUrl(sharedPreferences.getString("homepage", getString(R.string.homepage_default_value)));
+                    }
                 }
             }
         }
index 2687ab1facfae4082212401a83b589653d26b7cc..8409912b96ff59d0a8e994d3680a8eacd0ad9183 100644 (file)
@@ -19,7 +19,9 @@
 
 package com.stoutner.privacybrowser.activities;
 
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.WindowManager;
 
 import androidx.appcompat.app.AppCompatActivity;
@@ -30,13 +32,20 @@ import com.stoutner.privacybrowser.fragments.SettingsFragment;
 public class SettingsActivity extends AppCompatActivity {
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the activity theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserSettingsDark);
         } else {
             setTheme(R.style.PrivacyBrowserSettingsLight);
@@ -48,4 +57,4 @@ public class SettingsActivity extends AppCompatActivity {
         // Display the settings fragment.
         getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
     }
-}
+}
\ No newline at end of file
index 2bc431d358ef50517ca09d89166b29591975c0e7..905e91ee32d33adfdb21e60c9362337aba929fb7 100644 (file)
 package com.stoutner.privacybrowser.activities;
 
 import android.app.Activity;
-import android.app.DialogFragment;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.Spanned;
 import android.text.style.ForegroundColorSpan;
 import android.view.KeyEvent;
@@ -38,6 +39,7 @@ import androidx.appcompat.app.ActionBar;
 import androidx.appcompat.app.AppCompatActivity;
 import androidx.appcompat.widget.Toolbar;  // The AndroidX toolbar must be used until the minimum API is >= 21.
 import androidx.core.app.NavUtils;
+import androidx.fragment.app.DialogFragment;
 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
 
 import com.stoutner.privacybrowser.R;
@@ -55,13 +57,20 @@ public class ViewSourceActivity extends AppCompatActivity {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
         // Set the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             setTheme(R.style.PrivacyBrowserDark);
         } else {
             setTheme(R.style.PrivacyBrowserLight);
@@ -180,7 +189,7 @@ public class ViewSourceActivity extends AppCompatActivity {
         });
 
         // Set the swipe to refresh color according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             swipeRefreshLayout.setColorSchemeResources(R.color.blue_600);
             swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.gray_800);
         } else {
@@ -208,7 +217,7 @@ public class ViewSourceActivity extends AppCompatActivity {
         DialogFragment aboutDialogFragment = new AboutViewSourceDialog();
 
         // Show the about alert dialog.
-        aboutDialogFragment.show(getFragmentManager(), getString(R.string.about));
+        aboutDialogFragment.show(getSupportFragmentManager(), getString(R.string.about));
 
         // Consume the event.
         return true;
index 7edc2db0a436e14eb216d074671135d641011136..e4f558b6032ee65fcbe4200e9fce386f660e6e1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2018 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2018-2019 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
  *
@@ -21,21 +21,32 @@ package com.stoutner.privacybrowser.dialogs;
 
 import android.app.AlertDialog;
 import android.app.Dialog;
-import android.app.DialogFragment;
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.WindowManager;
 
+import androidx.annotation.NonNull;
+import androidx.fragment.app.DialogFragment;
+
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 public class AboutViewSourceDialog extends DialogFragment {
     @Override
+    @NonNull
     public Dialog onCreateDialog(Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Use a builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
         // Set the style and the icon according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
             dialogBuilder.setIcon(R.drawable.about_dark);
         } else {
@@ -56,7 +67,7 @@ public class AboutViewSourceDialog extends DialogFragment {
         final AlertDialog alertDialog = dialogBuilder.create();
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             // Remove the warning below that `getWindow()` might be null.
             assert alertDialog.getWindow() != null;
 
index 59c36ede3ae0270e8c9899663bef095ab018487c..39a92c67568ec06709377aa5d91d4f02b9c03539 100644 (file)
@@ -24,8 +24,10 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.net.Uri;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.KeyEvent;
@@ -39,7 +41,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper;
 
 public class AddDomainDialog extends DialogFragment {
@@ -94,8 +95,15 @@ public class AddDomainDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -128,7 +136,7 @@ public class AddDomainDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index 9c8411b1e5edb94dc010c85c06d3b2b49ef4a528..b198a888fd40daafea989926b2b67c738aaa5e92 100644 (file)
@@ -24,10 +24,12 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.KeyEvent;
@@ -41,7 +43,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 
 import java.io.ByteArrayOutputStream;
@@ -111,8 +112,15 @@ public class CreateBookmarkFolderDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -146,7 +154,7 @@ public class CreateBookmarkFolderDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index 1fd2fd775cbbc78d9c6d1c0220dbb87824a474f1..0553f80484b99822e69cac8ea958abfdf6d4a540 100644 (file)
@@ -24,8 +24,10 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.net.Uri;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -37,7 +39,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 import java.util.Locale;
 
@@ -122,8 +123,15 @@ public class DownloadFileDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -153,7 +161,7 @@ public class DownloadFileDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index eb2624f34912a4a613a119b7ba0cb0b2c6ed7100..06d765c22276cc529ec442fb6ff56e9b1dd4156a 100644 (file)
@@ -24,8 +24,10 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.net.Uri;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -36,7 +38,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 public class DownloadImageDialog extends DialogFragment {
     // `downloadImageListener` is used in `onAttach()` and `onCreateDialog()`.
@@ -99,8 +100,15 @@ public class DownloadImageDialog extends DialogFragment {
         // Use and alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -131,7 +139,7 @@ public class DownloadImageDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index c5059732b068bd352181986915367e1d36e9960e..de9dd77ff8554f3e3d219661c11f0ef0a831cfe7 100644 (file)
@@ -23,11 +23,12 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.WindowManager;
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
@@ -79,8 +80,15 @@ public class DownloadLocationPermissionDialog extends DialogFragment {
         // Use a builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Set the style and the icon according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
             dialogBuilder.setIcon(R.drawable.downloads_dark);
         } else {
@@ -104,7 +112,7 @@ public class DownloadLocationPermissionDialog extends DialogFragment {
         final AlertDialog alertDialog = dialogBuilder.create();
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             // Remove the warning below that `getWindow()` might be null.
             assert alertDialog.getWindow() != null;
 
index d58ae113b619ec83ba42caade9c5ae118c1a287f..656e0d5746939b5d4f7e8fb6836ee6a95462eec5 100644 (file)
@@ -24,12 +24,14 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.database.MatrixCursor;
 import android.database.MergeCursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.KeyEvent;
@@ -46,7 +48,6 @@ import android.widget.Spinner;
 import android.widget.TextView;
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 
 import java.io.ByteArrayOutputStream;
@@ -138,8 +139,15 @@ public class EditBookmarkDatabaseViewDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -172,7 +180,7 @@ public class EditBookmarkDatabaseViewDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index daeb1d64a578a27ca4d3263329c1c37b21b77121..0b6cd716b311d1ca59091dbc14fb9aefdad6d5fb 100644 (file)
@@ -24,10 +24,12 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.KeyEvent;
@@ -43,7 +45,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 
 import java.io.ByteArrayOutputStream;
@@ -126,8 +127,15 @@ public class EditBookmarkDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -160,7 +168,7 @@ public class EditBookmarkDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index 5033ece87bcb22c59b7f234e91727f3979a8ed1e..1b7c3d70849b499158fdb2281a2ec3e18da7a736 100644 (file)
@@ -24,6 +24,7 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.database.DatabaseUtils;
 import android.database.MatrixCursor;
@@ -31,6 +32,7 @@ import android.database.MergeCursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.util.Log;
@@ -52,7 +54,6 @@ import androidx.core.content.ContextCompat;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 
 import java.io.ByteArrayOutputStream;
@@ -139,8 +140,15 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -173,7 +181,7 @@ public class EditBookmarkFolderDatabaseViewDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index 4e606f0dcf8b529d3ecd73cea72a2858ca052a70..19f9db9096fc6878daccafa1c6c089d006587b04 100644 (file)
@@ -24,10 +24,12 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.KeyEvent;
@@ -43,7 +45,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 
 import java.io.ByteArrayOutputStream;
@@ -126,8 +127,15 @@ public class EditBookmarkFolderDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -160,7 +168,7 @@ public class EditBookmarkFolderDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
index 6099d2b3e47e4130292dd412ad9e89bb650584c3..c04bf8fff7db41a68c05763388c2de66c8cd74b3 100644 (file)
@@ -24,7 +24,9 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.ForegroundColorSpan;
@@ -35,12 +37,11 @@ import android.view.WindowManager;
 import android.widget.EditText;
 import android.widget.TextView;
 
-import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
-
 import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
+import com.stoutner.privacybrowser.R;
+
 public class HttpAuthenticationDialog extends DialogFragment{
     // `httpAuthenticationListener` is used in `onAttach()` and `onCreateDialog()`
     private HttpAuthenticationListener httpAuthenticationListener;
@@ -92,8 +93,15 @@ public class HttpAuthenticationDialog extends DialogFragment{
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             // Set the dialog theme.
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
 
@@ -132,7 +140,7 @@ public class HttpAuthenticationDialog extends DialogFragment{
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
@@ -152,7 +160,7 @@ public class HttpAuthenticationDialog extends DialogFragment{
         realmTextView.setText(httpAuthRealm);
 
         // Set the realm text color according to the theme.  The deprecated `.getColor()` must be used until API >= 23.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             //noinspection deprecation
             realmTextView.setTextColor(getResources().getColor(R.color.gray_300));
         } else {
@@ -168,7 +176,7 @@ public class HttpAuthenticationDialog extends DialogFragment{
         ForegroundColorSpan blueColorSpan;
 
         // Set `blueColorSpan` according to the theme.  The deprecated `getColor()` must be used until API >= 23.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             //noinspection deprecation
             blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
         } else {
@@ -219,4 +227,4 @@ public class HttpAuthenticationDialog extends DialogFragment{
         // `onCreateDialog()` requires the return of an `AlertDialog`.
         return alertDialog;
     }
-}
+}
\ No newline at end of file
index 9f57519eb545c9a869e0ace5697d7705c8508daf..55f29d6381be777e4cb16cdaa719a2eb51d92404 100644 (file)
@@ -24,6 +24,7 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.database.DatabaseUtils;
 import android.database.MatrixCursor;
@@ -33,6 +34,7 @@ import android.graphics.BitmapFactory;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.WindowManager;
@@ -49,7 +51,6 @@ import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment mu
 
 import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.activities.BookmarksActivity;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper;
 
 import java.io.ByteArrayOutputStream;
@@ -84,8 +85,15 @@ public class MoveToFolderDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -115,7 +123,7 @@ public class MoveToFolderDialog extends DialogFragment {
         final AlertDialog alertDialog = dialogBuilder.create();
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             // Remove the warning below that `getWindow()` might be null.
             assert alertDialog.getWindow() != null;
 
@@ -172,7 +180,7 @@ public class MoveToFolderDialog extends DialogFragment {
             foldersCursorAdapter = new CursorAdapter(alertDialog.getContext(), foldersCursor, false) {
                 @Override
                 public View newView(Context context, Cursor cursor, ViewGroup parent) {
-                    // Remove the incorrect lint warning that `.getLayoutInflator()` might be false.
+                    // Remove the incorrect lint warning that `.getLayoutInflater()` might be false.
                     assert getActivity() != null;
 
                     // Inflate the individual item layout.  `false` does not attach it to the root.
@@ -245,7 +253,7 @@ public class MoveToFolderDialog extends DialogFragment {
             foldersCursorAdapter = new CursorAdapter(alertDialog.getContext(), foldersMergeCursor, false) {
                 @Override
                 public View newView(Context context, Cursor cursor, ViewGroup parent) {
-                    // Remove the incorrect lint warning that `.getLayoutInflator()` might be false.
+                    // Remove the incorrect lint warning that `.getLayoutInflater()` might be false.
                     assert getActivity() != null;
 
                     // Inflate the individual item layout.  `false` does not attach it to the root.
index 5d2fdc7afbe15e4abdfa85e96576c7311ef089f3..fbc3293d5d072058c25de616e266aa8f10ec08c6 100644 (file)
@@ -24,12 +24,14 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.net.http.SslCertificate;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.ForegroundColorSpan;
@@ -131,8 +133,15 @@ public class PinnedMismatchDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             // Set the dialog theme.
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
@@ -164,7 +173,7 @@ public class PinnedMismatchDialog extends DialogFragment {
         // Set the favorite icon as the dialog icon if it exists.
         if (favoriteIconBitmap.sameAs(defaultFavoriteIconBitmap)) {  // There is no website favorite icon.
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_dark);
             } else {
                 dialogBuilder.setIcon(R.drawable.ssl_certificate_enabled_light);
@@ -242,7 +251,7 @@ public class PinnedMismatchDialog extends DialogFragment {
         final AlertDialog alertDialog = dialogBuilder.create();
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             // Remove the warning below that `getWindow()` might be null.
             assert alertDialog.getWindow() != null;
 
@@ -412,6 +421,12 @@ public class PinnedMismatchDialog extends DialogFragment {
                 }
             }
 
+            // Get a handle for the shared preferences.
+            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+            // Get the screenshot and theme preferences.
+            boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
             // Create a red foreground color span.  The deprecated `getResources().getColor` must be used until the minimum API >= 23.
             @SuppressWarnings("deprecation") ForegroundColorSpan redColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.red_a700));
 
@@ -419,7 +434,7 @@ public class PinnedMismatchDialog extends DialogFragment {
             ForegroundColorSpan blueColorSpan;
 
             // Set the blue color span according to the theme.  The deprecated `getResources().getColor` must be used until the minimum API >= 23.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 //noinspection deprecation
                 blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
             } else {
index 56c9d0217c309ceab0703d8bea83d8a81c7fc49e..ec1ef33c3648f1453a0823ca02f0417f096e15d0 100644 (file)
@@ -26,10 +26,12 @@ import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Environment;
+import android.preference.PreferenceManager;
 import android.provider.DocumentsContract;
 import android.text.Editable;
 import android.text.TextWatcher;
@@ -39,13 +41,12 @@ import android.widget.Button;
 import android.widget.EditText;
 import android.widget.TextView;
 
-import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
-
 import androidx.annotation.NonNull;
 import androidx.core.content.ContextCompat;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment is required or an error is produced on API <=22.  It is also required for the browse button to work correctly.
 
+import com.stoutner.privacybrowser.R;
+
 public class SaveLogcatDialog extends DialogFragment {
     // Instantiate the class variables.
     private SaveLogcatListener saveLogcatListener;
@@ -75,8 +76,15 @@ public class SaveLogcatDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -92,7 +100,7 @@ public class SaveLogcatDialog extends DialogFragment {
         dialogBuilder.setView(getActivity().getLayoutInflater().inflate(R.layout.save_logcat_dialog, null));
 
         // Set the icon according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder.setIcon(R.drawable.save_dialog_dark);
         } else {
             dialogBuilder.setIcon(R.drawable.save_dialog_light);
@@ -116,7 +124,7 @@ public class SaveLogcatDialog extends DialogFragment {
         assert alertDialog.getWindow() != null;
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         }
 
@@ -194,4 +202,4 @@ public class SaveLogcatDialog extends DialogFragment {
         // Return the alert dialog.
         return alertDialog;
     }
-}
+}
\ No newline at end of file
index 602ee2c9d007bc4b2fd1042804e27c864254889e..5f46d4f13e42524ab9b507ef70cdad5a545f81f8 100644 (file)
@@ -25,11 +25,13 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.net.Uri;
 import android.net.http.SslCertificate;
 import android.net.http.SslError;
 import android.os.AsyncTask;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.ForegroundColorSpan;
@@ -41,7 +43,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 import java.lang.ref.WeakReference;
 import java.net.InetAddress;
@@ -131,8 +132,15 @@ public class SslCertificateErrorDialog extends DialogFragment {
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style and icon according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             // Set the style.
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
 
@@ -163,7 +171,7 @@ public class SslCertificateErrorDialog extends DialogFragment {
         AlertDialog alertDialog = dialogBuilder.create();
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             // Remove the warning below that `getWindow()` might be null.
             assert alertDialog.getWindow() != null;
 
@@ -220,7 +228,7 @@ public class SslCertificateErrorDialog extends DialogFragment {
         ForegroundColorSpan blueColorSpan;
 
         // Set a blue color span according to the theme.  The deprecated `getResources().getColor` must be used until the minimum API >= 23.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             //noinspection deprecation
             blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
         } else {
@@ -372,11 +380,17 @@ public class SslCertificateErrorDialog extends DialogFragment {
             // Create a spannable string builder.
             SpannableStringBuilder ipAddressesStringBuilder = new SpannableStringBuilder(ipAddressesLabel + ipAddresses);
 
+            // Get a handle for the shared preferences.
+            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
+
+            // Get the screenshot and theme preferences.
+            boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
             // Create a blue foreground color span.
             ForegroundColorSpan blueColorSpan;
 
             // Set the blue color span according to the theme.  The deprecated `getColor()` must be used until the minimum API >= 23.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 //noinspection deprecation
                 blueColorSpan = new ForegroundColorSpan(activity.getResources().getColor(R.color.blue_400));
             } else {
index fbff4d295c1f569522c9de3d14aadd493747f07e..e7440130c8c40ab2087caaf3b380501d70fa0160 100644 (file)
@@ -23,14 +23,15 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.WindowManager;
 
 import androidx.annotation.NonNull;
 import androidx.fragment.app.DialogFragment;
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 public class StoragePermissionDialog extends DialogFragment {
     // The listener is used in `onAttach()` and `onCreateDialog()`.
@@ -56,8 +57,15 @@ public class StoragePermissionDialog extends DialogFragment {
         // Use a builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style and the icon according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
             dialogBuilder.setIcon(R.drawable.import_export_dark);
         } else {
@@ -81,7 +89,7 @@ public class StoragePermissionDialog extends DialogFragment {
         final AlertDialog alertDialog = dialogBuilder.create();
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             // Remove the warning below that `getWindow()` might be null.
             assert alertDialog.getWindow() != null;
 
@@ -92,4 +100,4 @@ public class StoragePermissionDialog extends DialogFragment {
         // `onCreateDialog()` requires the return of an `AlertDialog`.
         return alertDialog;
     }
-}
+}
\ No newline at end of file
index 87902b973a0b7d0aa13b0ccfb05b44e77ee88cf8..13b8c3311e49b4233b540b1a379682b06e0fa3e4 100644 (file)
@@ -24,11 +24,13 @@ import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.SharedPreferences;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.util.Base64;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -42,7 +44,6 @@ import androidx.core.content.ContextCompat;
 import androidx.fragment.app.DialogFragment;  // The AndroidX dialog fragment must be used or an error is produced on API <=22.
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 import com.stoutner.privacybrowser.adapters.HistoryArrayAdapter;
 import com.stoutner.privacybrowser.definitions.History;
 
@@ -200,8 +201,15 @@ public class UrlHistoryDialog extends DialogFragment{
         // Use an alert dialog builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -228,7 +236,7 @@ public class UrlHistoryDialog extends DialogFragment{
         final AlertDialog alertDialog = dialogBuilder.create();
 
         // Disable screenshots if not allowed.
-        if (!MainWebViewActivity.allowScreenshots) {
+        if (!allowScreenshots) {
             // Remove the warning below that `getWindow()` might be null.
             assert alertDialog.getWindow() != null;
 
index 28f76309e6df23f90c509b5a0e9c89d2227edf50..a24dedd1021a15da9fb07508f12fbdcd9920ea00 100644 (file)
@@ -22,13 +22,13 @@ package com.stoutner.privacybrowser.dialogs;
 import android.annotation.SuppressLint;
 import android.app.AlertDialog;
 import android.app.Dialog;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
+import android.content.SharedPreferences;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.net.http.SslCertificate;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.ForegroundColorSpan;
@@ -45,7 +45,6 @@ import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.fragments.WebViewTabFragment;
 import com.stoutner.privacybrowser.views.NestedScrollWebView;
 
-import java.io.ByteArrayOutputStream;
 import java.text.DateFormat;
 import java.util.Calendar;
 import java.util.Date;
@@ -102,8 +101,15 @@ public class ViewSslCertificateDialog extends DialogFragment {
         // Use a builder to create the alert dialog.
         AlertDialog.Builder dialogBuilder;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the screenshot and theme preferences.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+
         // Set the style according to the theme.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogDark);
         } else {
             dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.PrivacyBrowserAlertDialogLight);
@@ -133,7 +139,7 @@ public class ViewSslCertificateDialog extends DialogFragment {
             final AlertDialog alertDialog = dialogBuilder.create();
 
             // Disable screenshots if not allowed.
-            if (!MainWebViewActivity.allowScreenshots) {
+            if (!allowScreenshots) {
                 // Remove the warning below that `getWindow()` might be null.
                 assert alertDialog.getWindow() != null;
 
@@ -155,7 +161,7 @@ public class ViewSslCertificateDialog extends DialogFragment {
             final AlertDialog alertDialog = dialogBuilder.create();
 
             // Disable screenshots if not allowed.
-            if (!MainWebViewActivity.allowScreenshots) {
+            if (!allowScreenshots) {
                 // Remove the warning below that `getWindow()` might be null.
                 assert alertDialog.getWindow() != null;
 
@@ -222,7 +228,7 @@ public class ViewSslCertificateDialog extends DialogFragment {
             ForegroundColorSpan blueColorSpan;
 
             // Set the blue color span according to the theme.  The deprecated `getColor()` must be used until the minimum API >= 23.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 //noinspection deprecation
                 blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
             } else {
index 5c811e8d42ef1e6202f0e1adbd8f3dfb41054976..8c48825469861e614119463028bda7c1ed602195 100644 (file)
@@ -21,10 +21,12 @@ package com.stoutner.privacybrowser.fragments;
 
 import android.annotation.SuppressLint;
 import android.content.Context;
+import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.content.pm.Signature;
 import android.os.Build;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.ForegroundColorSpan;
@@ -92,6 +94,12 @@ public class AboutTabFragment extends Fragment {
         Context context = getContext();
         assert context != null;
 
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
+
+        // Get the theme preference.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Load the tabs.  Tab numbers start at 0.
         if (tabNumber == 0) {  // Load the about tab.
             // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.  The fragment will take care of attaching the root automatically.
@@ -201,7 +209,7 @@ public class AboutTabFragment extends Fragment {
             ForegroundColorSpan blueColorSpan;
 
             // Set `blueColorSpan` according to the theme.  We have to use the deprecated `getColor()` until API >= 23.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 //noinspection deprecation
                 blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400));
             } else {
@@ -346,7 +354,7 @@ public class AboutTabFragment extends Fragment {
             WebView tabWebView = (WebView) tabLayout;
 
             // Load the tabs according to the theme.
-            if (MainWebViewActivity.darkTheme) {  // The dark theme is applied.
+            if (darkTheme) {  // The dark theme is applied.
                 // Set the background color.  The deprecated `.getColor()` must be used until the minimum API >= 23.
                 //noinspection deprecation
                 tabWebView.setBackgroundColor(getResources().getColor(R.color.gray_850));
index 43032f84933c3481c443c95c2e0f16ec3b1c3215..bd880d44156f3f898fdd9c494c04427da6111c65 100644 (file)
@@ -99,6 +99,7 @@ public class DomainSettingsFragment extends Fragment {
         boolean defaultSwipeToRefresh = sharedPreferences.getBoolean("swipe_to_refresh", true);
         final boolean defaultNightMode = sharedPreferences.getBoolean("night_mode", false);
         final boolean defaultDisplayWebpageImages = sharedPreferences.getBoolean("display_webpage_images", true);
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
 
         // Get handles for the views in the fragment.
         final EditText domainNameEditText = domainSettingsView.findViewById(R.id.domain_settings_name_edittext);
@@ -287,7 +288,7 @@ public class DomainSettingsFragment extends Fragment {
         final ForegroundColorSpan blueColorSpan;
 
         // Set the blue color span according to the theme.  The deprecated `resources.getColor` must be used until the minimum API >= 23.
-        if (MainWebViewActivity.darkTheme) {
+        if (darkTheme) {
             //noinspection deprecation
             blueColorSpan = new ForegroundColorSpan(resources.getColor(R.color.blue_400));
         } else {
@@ -387,7 +388,7 @@ public class DomainSettingsFragment extends Fragment {
             firstPartyCookiesEnabledSwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
             } else {
                 firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
@@ -406,7 +407,7 @@ public class DomainSettingsFragment extends Fragment {
                     thirdPartyCookiesEnabledSwitch.setChecked(false);
 
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
                     } else {
                         thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
@@ -424,7 +425,7 @@ public class DomainSettingsFragment extends Fragment {
                 thirdPartyCookiesEnabledSwitch.setEnabled(false);
 
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_dark));
                 } else {
                     thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_light));
@@ -449,7 +450,7 @@ public class DomainSettingsFragment extends Fragment {
                 domStorageEnabledSwitch.setChecked(false);
 
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
                 } else {
                     domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
@@ -467,7 +468,7 @@ public class DomainSettingsFragment extends Fragment {
             }
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark));
             } else {
                 domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light));
@@ -487,7 +488,7 @@ public class DomainSettingsFragment extends Fragment {
                 formDataEnabledSwitch.setChecked(false);
 
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
                 } else {
                     formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
@@ -501,7 +502,7 @@ public class DomainSettingsFragment extends Fragment {
             easyListSwitch.setChecked(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark));
             } else {
                 easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light));
@@ -511,7 +512,7 @@ public class DomainSettingsFragment extends Fragment {
             easyListSwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark));
             } else {
                 easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light));
@@ -524,7 +525,7 @@ public class DomainSettingsFragment extends Fragment {
             easyPrivacySwitch.setChecked(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
             } else {
                 easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
@@ -534,7 +535,7 @@ public class DomainSettingsFragment extends Fragment {
             easyPrivacySwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
             } else {
                 easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
@@ -547,7 +548,7 @@ public class DomainSettingsFragment extends Fragment {
             fanboysAnnoyanceListSwitch.setChecked(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
             } else {
                 fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
@@ -557,7 +558,7 @@ public class DomainSettingsFragment extends Fragment {
             fanboysAnnoyanceListSwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
             } else {
                 fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
@@ -573,7 +574,7 @@ public class DomainSettingsFragment extends Fragment {
                 fanboysSocialBlockingListSwitch.setChecked(true);
 
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
                 } else {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
@@ -584,7 +585,7 @@ public class DomainSettingsFragment extends Fragment {
                 fanboysSocialBlockingListSwitch.setChecked(false);
 
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
                 } else {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
@@ -603,7 +604,7 @@ public class DomainSettingsFragment extends Fragment {
             }
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark));
             } else {
                 fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light));
@@ -616,7 +617,7 @@ public class DomainSettingsFragment extends Fragment {
             ultraPrivacySwitch.setChecked(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
             } else {
                 ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
@@ -626,7 +627,7 @@ public class DomainSettingsFragment extends Fragment {
             ultraPrivacySwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
             } else {
                 ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
@@ -639,7 +640,7 @@ public class DomainSettingsFragment extends Fragment {
             blockAllThirdPartyRequestsSwitch.setChecked(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_dark));
             } else {
                 blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_light));
@@ -649,7 +650,7 @@ public class DomainSettingsFragment extends Fragment {
             blockAllThirdPartyRequestsSwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_dark));
             } else {
                 blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_light));
@@ -770,14 +771,14 @@ public class DomainSettingsFragment extends Fragment {
             case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT:
                 if (defaultSwipeToRefresh) {  // Swipe to refresh is enabled by default.
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                     } else {
                         swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
                     }
                 } else {  // Swipe to refresh is disabled by default
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                     } else {
                         swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
@@ -790,7 +791,7 @@ public class DomainSettingsFragment extends Fragment {
 
             case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED:
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                 } else {
                     swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
@@ -802,7 +803,7 @@ public class DomainSettingsFragment extends Fragment {
 
             case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED:
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                 } else {
                     swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
@@ -833,14 +834,14 @@ public class DomainSettingsFragment extends Fragment {
             case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT:
                 if (defaultNightMode) {  // Night mode enabled by default.
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
                     } else {
                         nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
                     }
                 } else {  // Night mode disabled by default.
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
                     } else {
                         nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
@@ -853,7 +854,7 @@ public class DomainSettingsFragment extends Fragment {
 
             case DomainsDatabaseHelper.NIGHT_MODE_ENABLED:
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
                 } else {
                     nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
@@ -865,7 +866,7 @@ public class DomainSettingsFragment extends Fragment {
 
             case DomainsDatabaseHelper.NIGHT_MODE_DISABLED:
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
                 } else {
                     nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
@@ -897,14 +898,14 @@ public class DomainSettingsFragment extends Fragment {
             case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT:
                 if (defaultDisplayWebpageImages) {  // Display webpage images enabled by default.
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
                     } else {
                         displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
                     }
                 } else {  // Display webpage images disabled by default.
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
                     } else {
                         displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
@@ -917,7 +918,7 @@ public class DomainSettingsFragment extends Fragment {
 
             case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED:
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
                 } else {
                     displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
@@ -929,7 +930,7 @@ public class DomainSettingsFragment extends Fragment {
 
             case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED:
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
                 } else {
                     displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
@@ -952,7 +953,7 @@ public class DomainSettingsFragment extends Fragment {
             pinnedSslCertificateSwitch.setChecked(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark));
             } else {
                 pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light));
@@ -962,7 +963,7 @@ public class DomainSettingsFragment extends Fragment {
             pinnedSslCertificateSwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark));
             } else {
                 pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light));
@@ -1112,7 +1113,7 @@ public class DomainSettingsFragment extends Fragment {
                 currentWebsiteCertificateRadioButton.setChecked(false);
 
                 // Darken the background of the current website SSL certificate linear layout according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
                 } else {
                     currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1145,7 +1146,7 @@ public class DomainSettingsFragment extends Fragment {
             pinnedIpAddressesSwitch.setChecked(true);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark));
             } else {
                 pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light));
@@ -1155,7 +1156,7 @@ public class DomainSettingsFragment extends Fragment {
             pinnedIpAddressesSwitch.setChecked(false);
 
             // Set the icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark));
             } else {
                 pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light));
@@ -1187,7 +1188,7 @@ public class DomainSettingsFragment extends Fragment {
                 currentIpAddressesRadioButton.setChecked(false);
 
                 // Darken the background of the current IP addresses linear layout according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
                 } else {
                     currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1224,7 +1225,7 @@ public class DomainSettingsFragment extends Fragment {
                     domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled));
                 } else {  // DOM storage is disabled.
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
                     } else {
                         domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
@@ -1238,7 +1239,7 @@ public class DomainSettingsFragment extends Fragment {
                 domStorageEnabledSwitch.setEnabled(false);
 
                 // Set the DOM storage icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark));
                 } else {
                     domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light));
@@ -1260,7 +1261,7 @@ public class DomainSettingsFragment extends Fragment {
                     thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
                 } else {  // Third-party cookies are disabled.
                     // Set the third-party cookies icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
                     } else {
                         thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
@@ -1268,7 +1269,7 @@ public class DomainSettingsFragment extends Fragment {
                 }
             } else {  // First-party cookies are disabled.
                 // Update the first-party cookies icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
                 } else {
                     firstPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
@@ -1278,7 +1279,7 @@ public class DomainSettingsFragment extends Fragment {
                 thirdPartyCookiesEnabledSwitch.setEnabled(false);
 
                 // Set the third-party cookies icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_dark));
                 } else {
                     thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_ghosted_light));
@@ -1293,7 +1294,7 @@ public class DomainSettingsFragment extends Fragment {
                 thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
             } else {
                 // Update the third-party cookies icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_dark));
                 } else {
                     thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_disabled_light));
@@ -1308,7 +1309,7 @@ public class DomainSettingsFragment extends Fragment {
                 domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_enabled));
             } else {
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
                 } else {
                     domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
@@ -1324,7 +1325,7 @@ public class DomainSettingsFragment extends Fragment {
                     formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
                 } else {
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
                     } else {
                         formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
@@ -1338,14 +1339,14 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon.
             if (isChecked) {  // EasyList is on.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark));
                 } else {
                     easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light));
                 }
             } else {  // EasyList is off.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark));
                 } else {
                     easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light));
@@ -1358,14 +1359,14 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon.
             if (isChecked) {  // EasyPrivacy is on.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
                 } else {
                     easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
                 }
             } else {  // EasyPrivacy is off.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
                 } else {
                     easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
@@ -1378,7 +1379,7 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon and Fanboy's Social Blocking List.
             if (isChecked) {  // Fanboy's Annoyance List is on.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
                 } else {
                     fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
@@ -1388,14 +1389,14 @@ public class DomainSettingsFragment extends Fragment {
                 fanboysSocialBlockingListSwitch.setEnabled(false);
 
                 // Update the Fanboy's Social Blocking List icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark));
                 } else {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light));
                 }
             } else {  // Fanboy's Annoyance List is off.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
                 } else {
                     fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
@@ -1407,14 +1408,14 @@ public class DomainSettingsFragment extends Fragment {
                 // Update the Fanboy's Social Blocking List icon.
                 if (fanboysSocialBlockingListSwitch.isChecked()) {  // Fanboy's Social Blocking List is on.
                     // Update the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
                     } else {
                         fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
                     }
                 } else {  // Fanboy's Social Blocking List is off.
                     // Update the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
                     } else {
                         fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
@@ -1429,14 +1430,14 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon.
             if (isChecked) {  // Fanboy's Social Blocking List is on.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
                 } else {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
                 }
             } else {  // Fanboy's Social Blocking List is off.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
                 } else {
                     fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
@@ -1449,14 +1450,14 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon.
             if (isChecked) {  // UltraPrivacy is on.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
                 } else {
                     ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
                 }
             } else {  // UltraPrivacy is off.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
                 } else {
                     ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
@@ -1469,14 +1470,14 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon.
             if (isChecked) {  // Blocking all third-party requests is on.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_dark));
                 } else {
                     blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_light));
                 }
             } else {  // Blocking all third-party requests is off.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_dark));
                 } else {
                     blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_light));
@@ -1581,14 +1582,14 @@ public class DomainSettingsFragment extends Fragment {
                     case DomainsDatabaseHelper.SWIPE_TO_REFRESH_SYSTEM_DEFAULT:
                         if (defaultSwipeToRefresh) {  // Swipe to refresh enabled by default.
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                             } else {
                                 swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
                             }
                         } else {  // Swipe to refresh disabled by default.
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                             } else {
                                 swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
@@ -1601,7 +1602,7 @@ public class DomainSettingsFragment extends Fragment {
 
                     case DomainsDatabaseHelper.SWIPE_TO_REFRESH_ENABLED:
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_dark));
                         } else {
                             swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_enabled_light));
@@ -1613,7 +1614,7 @@ public class DomainSettingsFragment extends Fragment {
 
                     case DomainsDatabaseHelper.SWIPE_TO_REFRESH_DISABLED:
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_dark));
                         } else {
                             swipeToRefreshImageView.setImageDrawable(resources.getDrawable(R.drawable.refresh_disabled_light));
@@ -1639,14 +1640,14 @@ public class DomainSettingsFragment extends Fragment {
                     case DomainsDatabaseHelper.NIGHT_MODE_SYSTEM_DEFAULT:
                         if (defaultNightMode) {  // Night mode enabled by default.
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
                             } else {
                                 nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
                             }
                         } else {  // Night mode disabled by default.
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
                             } else {
                                 nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
@@ -1659,7 +1660,7 @@ public class DomainSettingsFragment extends Fragment {
 
                     case DomainsDatabaseHelper.NIGHT_MODE_ENABLED:
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_dark));
                         } else {
                             nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_light));
@@ -1671,7 +1672,7 @@ public class DomainSettingsFragment extends Fragment {
 
                     case DomainsDatabaseHelper.NIGHT_MODE_DISABLED:
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_dark));
                         } else {
                             nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_light));
@@ -1713,7 +1714,7 @@ public class DomainSettingsFragment extends Fragment {
                         domStorageEnabledSwitch.setChecked(false);
 
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_dark));
                         } else {
                             domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_disabled_light));
@@ -1731,7 +1732,7 @@ public class DomainSettingsFragment extends Fragment {
                     }
 
                     // Set the icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_dark));
                     } else {
                         domStorageImageView.setImageDrawable(resources.getDrawable(R.drawable.dom_storage_ghosted_light));
@@ -1754,14 +1755,14 @@ public class DomainSettingsFragment extends Fragment {
                     case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_SYSTEM_DEFAULT:
                         if (defaultDisplayWebpageImages) {
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
                             } else {
                                 displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
                             }
                         } else {
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
                             } else {
                                 displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
@@ -1774,7 +1775,7 @@ public class DomainSettingsFragment extends Fragment {
 
                     case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_ENABLED:
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_dark));
                         } else {
                             displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_enabled_light));
@@ -1786,7 +1787,7 @@ public class DomainSettingsFragment extends Fragment {
 
                     case DomainsDatabaseHelper.DISPLAY_WEBPAGE_IMAGES_DISABLED:
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_dark));
                         } else {
                             displayWebpageImagesImageView.setImageDrawable(resources.getDrawable(R.drawable.images_disabled_light));
@@ -1809,7 +1810,7 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon.
             if (isChecked) {  // SSL certificate pinning is enabled.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark));
                 } else {
                     pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light));
@@ -1849,7 +1850,7 @@ public class DomainSettingsFragment extends Fragment {
                     savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
 
                     // Darken the background of the current website SSL certificate linear layout according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
                     } else {
                         currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1868,7 +1869,7 @@ public class DomainSettingsFragment extends Fragment {
                     currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent);
 
                     // Darken the background of the saved SSL certificate linear layout according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
                     } else {
                         savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1886,7 +1887,7 @@ public class DomainSettingsFragment extends Fragment {
                 }
             } else {  // SSL certificate pinning is disabled.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark));
                 } else {
                     pinnedSslCertificateImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light));
@@ -1914,7 +1915,7 @@ public class DomainSettingsFragment extends Fragment {
             savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the current website SSL certificate linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1932,7 +1933,7 @@ public class DomainSettingsFragment extends Fragment {
             savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the current website SSL certificate linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1950,7 +1951,7 @@ public class DomainSettingsFragment extends Fragment {
             currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the saved SSL certificate linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1968,7 +1969,7 @@ public class DomainSettingsFragment extends Fragment {
             currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the saved SSL certificate linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -1980,7 +1981,7 @@ public class DomainSettingsFragment extends Fragment {
             // Update the icon.
             if (isChecked) {  // IP addresses pinning is enabled.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_dark));
                 } else {
                     pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_enabled_light));
@@ -2008,7 +2009,7 @@ public class DomainSettingsFragment extends Fragment {
                     savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent);
 
                     // Darken the background of the current IP addresses linear layout according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
                     } else {
                         currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -2024,7 +2025,7 @@ public class DomainSettingsFragment extends Fragment {
                     currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
 
                     // Darken the background of the saved IP addresses linear layout according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
                     } else {
                         savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -2035,7 +2036,7 @@ public class DomainSettingsFragment extends Fragment {
                 currentIpAddressesCardView.getParent().requestChildFocus(currentIpAddressesCardView, currentIpAddressesCardView);
             } else {  // IP addresses pinning is disabled.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_dark));
                 } else {
                     pinnedIpAddressesImageView.setImageDrawable(resources.getDrawable(R.drawable.ssl_certificate_disabled_light));
@@ -2062,7 +2063,7 @@ public class DomainSettingsFragment extends Fragment {
             savedIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the current IP addresses linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -2080,7 +2081,7 @@ public class DomainSettingsFragment extends Fragment {
             savedIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the current IP addresses linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 currentIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -2098,7 +2099,7 @@ public class DomainSettingsFragment extends Fragment {
             currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the saved IP addresses linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -2116,7 +2117,7 @@ public class DomainSettingsFragment extends Fragment {
             currentIpAddressesLinearLayout.setBackgroundResource(R.color.transparent);
 
             // Darken the background of the saved IP addresses linear layout according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_33);
             } else {
                 savedIpAddressesLinearLayout.setBackgroundResource(R.color.black_translucent_11);
@@ -2202,4 +2203,4 @@ public class DomainSettingsFragment extends Fragment {
 
         return domainNamesMatch;
     }
-}
+}
\ No newline at end of file
index 41613170b0f59e68795191aa5bd4b223e6cce650..2bf499e4d21ffb28d91d0bb92c92668031713da8 100644 (file)
@@ -20,7 +20,9 @@
 package com.stoutner.privacybrowser.fragments;
 
 import android.content.Context;
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -35,7 +37,6 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
 
 import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.activities.DomainsActivity;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 public class DomainsListFragment extends Fragment {
     // Instantiate the dismiss snackbar interface handle.
@@ -107,8 +108,14 @@ public class DomainsListFragment extends Fragment {
                     // Enable the delete menu item.
                     DomainsActivity.deleteMenuItem.setEnabled(true);
 
+                    // Get a handle for the shared preferences.
+                    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+                    // Get the theme preferences.
+                    boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
                     // Set the delete icon according to the theme.
-                    if (MainWebViewActivity.darkTheme) {
+                    if (darkTheme) {
                         DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_dark);
                     } else {
                         DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_light);
@@ -134,4 +141,4 @@ public class DomainsListFragment extends Fragment {
 
         return domainsListFragmentView;
     }
-}
+}
\ No newline at end of file
index 4a417b644be9dcff0244831b4168b8c632172dae..3f1988ed6c6fe3923c022b7daae45ce40aa8132a 100644 (file)
@@ -20,7 +20,9 @@
 package com.stoutner.privacybrowser.fragments;
 
 import android.annotation.SuppressLint;
+import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -30,7 +32,6 @@ import androidx.annotation.NonNull;
 import androidx.fragment.app.Fragment;
 
 import com.stoutner.privacybrowser.R;
-import com.stoutner.privacybrowser.activities.MainWebViewActivity;
 
 public class GuideTabFragment extends Fragment {
     // `tabNumber` is used in `onCreate()` and `onCreateView()`.
@@ -67,6 +68,12 @@ public class GuideTabFragment extends Fragment {
     @SuppressLint("SetJavaScriptEnabled")
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        // Get a handle for the shared preferences.
+        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
+
+        // Get the theme preference.
+        boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
         // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.  The fragment will take care of attaching the root automatically.
         View tabLayout = inflater.inflate(R.layout.bare_webview, container, false);
 
@@ -74,7 +81,7 @@ public class GuideTabFragment extends Fragment {
         WebView tabWebView = (WebView) tabLayout;
 
         // Load the tabs according to the theme.
-        if (MainWebViewActivity.darkTheme) {  // The dark theme is applied.
+        if (darkTheme) {  // The dark theme is applied.
             // Set the background color.  The deprecated `.getColor()` must be used until API >= 23.
             //noinspection deprecation
             tabWebView.setBackgroundColor(getResources().getColor(R.color.gray_850));
index b055eb5c563a37059af71ebff3f3cb37e3894ab8..c22da979983282c4ef40409db5ff6e17d954d9e5 100644 (file)
@@ -112,6 +112,7 @@ public class SettingsFragment extends PreferenceFragment {
         boolean proxyThroughOrbot = savedPreferences.getBoolean("proxy_through_orbot", false);
         boolean fullScreenBrowsingMode = savedPreferences.getBoolean("full_screen_browsing_mode", false);
         boolean clearEverything = savedPreferences.getBoolean("clear_everything", true);
+        boolean darkTheme = savedPreferences.getBoolean("dark_theme", false);
         final boolean nightMode = savedPreferences.getBoolean("night_mode", false);
 
         // Only enable the third-party cookies preference if first-party cookies are enabled and API >= 21.
@@ -237,7 +238,7 @@ public class SettingsFragment extends PreferenceFragment {
         if (firstPartyCookiesEnabled) {
             firstPartyCookiesPreference.setIcon(R.drawable.cookies_enabled);
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark);
             } else {
                 firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light);
@@ -249,14 +250,14 @@ public class SettingsFragment extends PreferenceFragment {
             if (thirdPartyCookiesEnabled) {
                 thirdPartyCookiesPreference.setIcon(R.drawable.cookies_warning);
             } else {
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark);
                 } else {
                     thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light);
                 }
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_dark);
             } else {
                 thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_light);
@@ -268,14 +269,14 @@ public class SettingsFragment extends PreferenceFragment {
             if (savedPreferences.getBoolean("dom_storage", false)) {  // DOM storage is enabled.
                 domStoragePreference.setIcon(R.drawable.dom_storage_enabled);
             } else {  // DOM storage is disabled.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark);
                 } else {
                     domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light);
                 }
             }
         } else {  // The preference is disabled.  The icon should be ghosted.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_dark);
             } else {
                 domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_light);
@@ -287,7 +288,7 @@ public class SettingsFragment extends PreferenceFragment {
             if (savedPreferences.getBoolean("save_form_data", false)) {
                 saveFormDataPreference.setIcon(R.drawable.form_data_enabled);
             } else {
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     saveFormDataPreference.setIcon(R.drawable.form_data_disabled_dark);
                 } else {
                     saveFormDataPreference.setIcon(R.drawable.form_data_disabled_light);
@@ -297,13 +298,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the custom user agent icon.
         if (customUserAgentPreference.isEnabled()) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_dark);
             } else {
                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_dark);
             } else {
                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_light);
@@ -312,13 +313,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the incognito mode icon.
         if (savedPreferences.getBoolean("incognito_mode", false)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_dark);
             } else {
                 incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_dark);
             } else {
                 incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_light);
@@ -327,13 +328,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the Do Not Track icon.
         if (savedPreferences.getBoolean("do_not_track", false)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_dark);
             } else {
                 doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_dark);
             } else {
                 doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_light);
@@ -342,13 +343,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the allow screenshots icon.
         if (savedPreferences.getBoolean("allow_screenshots", false)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_dark);
             } else {
                 allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_dark);
             } else {
                 allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_light);
@@ -357,13 +358,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the EasyList icon.
         if (savedPreferences.getBoolean("easylist", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyListPreference.setIcon(R.drawable.block_ads_enabled_dark);
             } else {
                 easyListPreference.setIcon(R.drawable.block_ads_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyListPreference.setIcon(R.drawable.block_ads_disabled_dark);
             } else {
                 easyListPreference.setIcon(R.drawable.block_ads_disabled_light);
@@ -372,13 +373,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the EasyPrivacy icon.
         if (savedPreferences.getBoolean("easyprivacy", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
             } else {
                 easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
             } else {
                 easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
@@ -387,7 +388,7 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the Fanboy lists icons.
         if (fanboyAnnoyanceListEnabled) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 // Set the Fanboy annoyance list icon.
                 fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_dark);
 
@@ -401,7 +402,7 @@ public class SettingsFragment extends PreferenceFragment {
                 fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 // Set the Fanboy annoyance list icon.
                 fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_dark);
 
@@ -426,13 +427,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the UltraPrivacy icon.
         if (savedPreferences.getBoolean("ultraprivacy", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
             } else {
                 ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
             } else {
                 ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
@@ -441,13 +442,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the block all third-party requests icon.
         if (savedPreferences.getBoolean("block_all_third_party_requests", false)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_dark);
             } else {
                 blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_dark);
             } else {
                 blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_light);
@@ -456,7 +457,7 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the Tor icons according to the theme.
         if (proxyThroughOrbot) {  // Proxying is enabled.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 proxyThroughOrbotPreference.setIcon(R.drawable.orbot_enabled_dark);
                 torHomepagePreference.setIcon(R.drawable.home_enabled_dark);
                 torSearchPreference.setIcon(R.drawable.search_enabled_dark);
@@ -480,7 +481,7 @@ public class SettingsFragment extends PreferenceFragment {
                 }
             }
         } else {  // Proxying is disabled.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 proxyThroughOrbotPreference.setIcon(R.drawable.orbot_disabled_dark);
                 torHomepagePreference.setIcon(R.drawable.home_ghosted_dark);
                 torSearchPreference.setIcon(R.drawable.search_ghosted_dark);
@@ -495,13 +496,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the search custom URL icon.
         if (searchCustomURLPreference.isEnabled()) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_dark);
             } else {
                 searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark);
             } else {
                 searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light);
@@ -511,7 +512,7 @@ public class SettingsFragment extends PreferenceFragment {
         // Set the full screen browsing mode icons.
         if (fullScreenBrowsingMode) {  // Full screen browsing mode is enabled.
             // Set the `fullScreenBrowsingModePreference` icon according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_dark);
             } else {
                 fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_light);
@@ -520,14 +521,14 @@ public class SettingsFragment extends PreferenceFragment {
             // Set the hide app bar icon.
             if (savedPreferences.getBoolean("hide_app_bar", true)) {  // Hide app bar is enabled.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark);
                 } else {
                     hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_light);
                 }
             } else {  // Hide app bar is disabled.
                 // Set the icon according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark);
                 } else {
                     hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_light);
@@ -535,7 +536,7 @@ public class SettingsFragment extends PreferenceFragment {
             }
         } else {  // Full screen browsing mode is disabled.
             // Set the icons according to the theme.
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_dark);
                 hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_dark);
             } else {
@@ -546,7 +547,7 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the clear everything preference icon.
         if (clearEverything) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_dark);
             } else {
                 clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_light);
@@ -557,7 +558,7 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the clear cookies preference icon.
         if (clearEverything || savedPreferences.getBoolean("clear_cookies", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 clearCookiesPreference.setIcon(R.drawable.cookies_cleared_dark);
             } else {
                 clearCookiesPreference.setIcon(R.drawable.cookies_cleared_light);
@@ -568,7 +569,7 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the clear DOM storage preference icon.
         if (clearEverything || savedPreferences.getBoolean("clear_dom_storage", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_dark);
             } else {
                 clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_light);
@@ -580,7 +581,7 @@ public class SettingsFragment extends PreferenceFragment {
         // Set the clear form data preference icon if the API < 26.  It has no effect on newer versions of Android.
         if (Build.VERSION.SDK_INT < 26) {
             if (clearEverything || savedPreferences.getBoolean("clear_form_data", true)) {
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
                 } else {
                     clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
@@ -592,7 +593,7 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the clear cache preference icon.
         if (clearEverything || savedPreferences.getBoolean("clear_cache", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 clearCachePreference.setIcon(R.drawable.cache_cleared_dark);
             } else {
                 clearCachePreference.setIcon(R.drawable.cache_cleared_light);
@@ -603,13 +604,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the swipe to refresh preference icon.
         if (savedPreferences.getBoolean("swipe_to_refresh", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_dark);
             } else {
                 swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_dark);
             } else {
                 swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_light);
@@ -618,13 +619,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the scroll app bar preference icon.
         if (savedPreferences.getBoolean("scroll_app_bar", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark);
             } else {
                 scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark);
             } else {
                 scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_light);
@@ -633,13 +634,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the display additional app bar icons preference icon.
         if (savedPreferences.getBoolean("display_additional_app_bar_icons", false)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_dark);
             } else {
                 displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_dark);
             } else {
                 displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_light);
@@ -648,13 +649,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the download with external app preference icon.
         if (savedPreferences.getBoolean("download_with_external_app", false)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_enabled_dark);
             } else {
                 downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_disabled_dark);
             } else {
                 downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_disabled_light);
@@ -670,13 +671,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the night mode preference icon.
         if (nightMode) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 nightModePreference.setIcon(R.drawable.night_mode_enabled_dark);
             } else {
                 nightModePreference.setIcon(R.drawable.night_mode_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 nightModePreference.setIcon(R.drawable.night_mode_disabled_dark);
             } else {
                 nightModePreference.setIcon(R.drawable.night_mode_disabled_light);
@@ -685,13 +686,13 @@ public class SettingsFragment extends PreferenceFragment {
 
         // Set the display webpage images preference icon.
         if (savedPreferences.getBoolean("display_webpage_images", true)) {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_dark);
             } else {
                 displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_light);
             }
         } else {
-            if (MainWebViewActivity.darkTheme) {
+            if (darkTheme) {
                 displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_dark);
             } else {
                 displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_light);
@@ -715,7 +716,7 @@ public class SettingsFragment extends PreferenceFragment {
                         if (sharedPreferences.getBoolean("dom_storage", false)) {
                             domStoragePreference.setIcon(R.drawable.dom_storage_enabled);
                         } else {
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark);
                             } else {
                                 domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light);
@@ -729,7 +730,7 @@ public class SettingsFragment extends PreferenceFragment {
                         domStoragePreference.setEnabled(false);
 
                         // Set the icon for DOM storage preference to be ghosted.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_dark);
                         } else {
                             domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_light);
@@ -748,14 +749,14 @@ public class SettingsFragment extends PreferenceFragment {
                             if (sharedPreferences.getBoolean("third_party_cookies", false)) {
                                 thirdPartyCookiesPreference.setIcon(R.drawable.cookies_warning);
                             } else {
-                                if (MainWebViewActivity.darkTheme) {
+                                if (darkTheme) {
                                     thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark);
                                 } else {
                                     thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light);
                                 }
                             }
                         } else {
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_dark);
                             } else {
                                 thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_light);
@@ -763,14 +764,14 @@ public class SettingsFragment extends PreferenceFragment {
                         }
                     } else {  // `first_party_cookies` is `false`.
                         // Update the icon for `first_party_cookies`.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark);
                         } else {
                             firstPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light);
                         }
 
                         // Set the icon for `third_party_cookies` to be ghosted.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_dark);
                         } else {
                             thirdPartyCookiesPreference.setIcon(R.drawable.cookies_ghosted_light);
@@ -786,7 +787,7 @@ public class SettingsFragment extends PreferenceFragment {
                     if (sharedPreferences.getBoolean("third_party_cookies", false)) {
                         thirdPartyCookiesPreference.setIcon(R.drawable.cookies_warning);
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_dark);
                         } else {
                             thirdPartyCookiesPreference.setIcon(R.drawable.cookies_disabled_light);
@@ -799,7 +800,7 @@ public class SettingsFragment extends PreferenceFragment {
                     if (sharedPreferences.getBoolean("dom_storage", false)) {
                         domStoragePreference.setIcon(R.drawable.dom_storage_enabled);
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark);
                         } else {
                             domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light);
@@ -813,7 +814,7 @@ public class SettingsFragment extends PreferenceFragment {
                     if (sharedPreferences.getBoolean("save_form_data", false)) {
                         saveFormDataPreference.setIcon(R.drawable.form_data_enabled);
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             saveFormDataPreference.setIcon(R.drawable.form_data_disabled_dark);
                         } else {
                             saveFormDataPreference.setIcon(R.drawable.form_data_disabled_light);
@@ -841,7 +842,7 @@ public class SettingsFragment extends PreferenceFragment {
                             customUserAgentPreference.setEnabled(false);
 
                             // Set the custom user agent preference icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_dark);
                             } else {
                                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_light);
@@ -856,7 +857,7 @@ public class SettingsFragment extends PreferenceFragment {
                             customUserAgentPreference.setEnabled(true);
 
                             // Set the custom user agent preference icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_dark);
                             } else {
                                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_light);
@@ -871,7 +872,7 @@ public class SettingsFragment extends PreferenceFragment {
                             customUserAgentPreference.setEnabled(false);
 
                             // Set the custom user agent preference icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_dark);
                             } else {
                                 customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_light);
@@ -887,13 +888,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "incognito_mode":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("incognito_mode", false)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_dark);
                         } else {
                             incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_dark);
                         } else {
                             incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_light);
@@ -904,13 +905,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "do_not_track":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("do_not_track", false)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_dark);
                         } else {
                             doNotTrackPreference.setIcon(R.drawable.block_tracking_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_dark);
                         } else {
                             doNotTrackPreference.setIcon(R.drawable.block_tracking_disabled_light);
@@ -922,13 +923,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "allow_screenshots":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("allow_screenshots", false)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_dark);
                         } else {
                             allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_dark);
                         } else {
                             allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_light);
@@ -951,13 +952,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "easylist":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("easylist", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             easyListPreference.setIcon(R.drawable.block_ads_enabled_dark);
                         } else {
                             easyListPreference.setIcon(R.drawable.block_ads_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             easyListPreference.setIcon(R.drawable.block_ads_disabled_dark);
                         } else {
                             easyListPreference.setIcon(R.drawable.block_ads_disabled_light);
@@ -968,13 +969,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "easyprivacy":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("easyprivacy", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
                         } else {
                             easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
                         } else {
                             easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
@@ -988,7 +989,7 @@ public class SettingsFragment extends PreferenceFragment {
 
                     // Update the Fanboy icons.
                     if (currentFanboyAnnoyanceList) {  // Fanboy's annoyance list is enabled.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             // Update the Fanboy's annoyance list icon.
                             fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_dark);
 
@@ -1002,7 +1003,7 @@ public class SettingsFragment extends PreferenceFragment {
                             fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_light);
                         }
                     } else {  // Fanboy's annoyance list is disabled.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             // Update the Fanboy's annoyance list icon.
                             fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_dark);
 
@@ -1032,13 +1033,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "fanboys_social_blocking_list":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("fanboys_social_blocking_list", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_dark);
                         } else {
                             fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_dark);
                         } else {
                             fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_light);
@@ -1049,13 +1050,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "ultraprivacy":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("ultraprivacy", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
                         } else {
                             ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
                         } else {
                             ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
@@ -1066,13 +1067,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "block_all_third_party_requests":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("block_all_third_party_requests", false)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_dark);
                         } else {
                             blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_dark);
                         } else {
                             blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_light);
@@ -1091,7 +1092,7 @@ public class SettingsFragment extends PreferenceFragment {
                     // Update the icons.
                     if (currentProxyThroughOrbot) {
                         // Set the Tor icons according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             proxyThroughOrbotPreference.setIcon(R.drawable.orbot_enabled_dark);
                             torHomepagePreference.setIcon(R.drawable.home_enabled_dark);
                             torSearchPreference.setIcon(R.drawable.search_enabled_dark);
@@ -1115,7 +1116,7 @@ public class SettingsFragment extends PreferenceFragment {
                             }
                         }
                     } else {  // Proxy through Orbot is disabled.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             proxyThroughOrbotPreference.setIcon(R.drawable.orbot_disabled_dark);
                             torHomepagePreference.setIcon(R.drawable.home_ghosted_dark);
                             torSearchPreference.setIcon(R.drawable.search_ghosted_dark);
@@ -1147,7 +1148,7 @@ public class SettingsFragment extends PreferenceFragment {
                         torSearchCustomURLPreference.setEnabled(true);
 
                         // Update the `torSearchCustomURLPreference` icon.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_dark);
                         } else {
                             torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_light);
@@ -1160,7 +1161,7 @@ public class SettingsFragment extends PreferenceFragment {
                         torSearchCustomURLPreference.setEnabled(false);
 
                         // Update the `torSearchCustomURLPreference` icon.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark);
                         } else {
                             torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light);
@@ -1186,7 +1187,7 @@ public class SettingsFragment extends PreferenceFragment {
                         searchCustomURLPreference.setEnabled(true);
 
                         // Set the `searchCustomURLPreference` according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_dark);
                         } else {
                             searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_light);
@@ -1199,7 +1200,7 @@ public class SettingsFragment extends PreferenceFragment {
                         searchCustomURLPreference.setEnabled(false);
 
                         // Set the `searchCustomURLPreference` according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark);
                         } else {
                             searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light);
@@ -1215,7 +1216,7 @@ public class SettingsFragment extends PreferenceFragment {
                 case "full_screen_browsing_mode":
                     if (sharedPreferences.getBoolean("full_screen_browsing_mode", false)) {  // Full screen browsing is enabled.
                         // Set the full screen browsing mode preference icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_dark);
                         } else {
                             fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_light);
@@ -1224,14 +1225,14 @@ public class SettingsFragment extends PreferenceFragment {
                         // Set the hide app bar preference icon.
                         if (sharedPreferences.getBoolean("hide_app_bar", true)) {  //  Hide app bar is enabled.
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark);
                             } else {
                                 hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_light);
                             }
                         } else {  // Hide app bar is disabled.
                             // Set the icon according to the theme.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark);
                             } else {
                                 hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_light);
@@ -1239,7 +1240,7 @@ public class SettingsFragment extends PreferenceFragment {
                         }
                     } else {  // Full screen browsing is disabled.
                         // Update the icons according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_dark);
                             hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_dark);
                         } else {
@@ -1253,14 +1254,14 @@ public class SettingsFragment extends PreferenceFragment {
                     // Update the icon.
                     if (sharedPreferences.getBoolean("hide_app_bar", true)) {  // Hide app bar is enabled.
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark);
                         } else {
                             hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_light);
                         }
                     } else {  // Hide app bar is disabled.
                         // Set the icon according to the theme.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark);
                         } else {
                             hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_light);
@@ -1280,7 +1281,7 @@ public class SettingsFragment extends PreferenceFragment {
 
                     // Update the `clearEverythingPreference` icon.
                     if (newClearEverythingBoolean) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_dark);
                         } else {
                             clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_light);
@@ -1291,7 +1292,7 @@ public class SettingsFragment extends PreferenceFragment {
 
                     // Update the `clearCookiesPreference` icon.
                     if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_cookies", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearCookiesPreference.setIcon(R.drawable.cookies_cleared_dark);
                         } else {
                             clearCookiesPreference.setIcon(R.drawable.cookies_cleared_light);
@@ -1302,7 +1303,7 @@ public class SettingsFragment extends PreferenceFragment {
 
                     // Update the `clearDomStoragePreference` icon.
                     if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_dom_storage", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_dark);
                         } else {
                             clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_light);
@@ -1314,7 +1315,7 @@ public class SettingsFragment extends PreferenceFragment {
                     // Update the clear form data preference icon if the API < 26.
                     if (Build.VERSION.SDK_INT < 26) {
                         if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_form_data", true)) {
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
                             } else {
                                 clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
@@ -1326,7 +1327,7 @@ public class SettingsFragment extends PreferenceFragment {
 
                     // Update the `clearCachePreference` icon.
                     if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_cache", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearCachePreference.setIcon(R.drawable.cache_cleared_dark);
                         } else {
                             clearCachePreference.setIcon(R.drawable.cache_cleared_light);
@@ -1339,7 +1340,7 @@ public class SettingsFragment extends PreferenceFragment {
                 case "clear_cookies":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("clear_cookies", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearCookiesPreference.setIcon(R.drawable.cookies_cleared_dark);
                         } else {
                             clearCookiesPreference.setIcon(R.drawable.cookies_cleared_light);
@@ -1352,7 +1353,7 @@ public class SettingsFragment extends PreferenceFragment {
                 case "clear_dom_storage":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("clear_dom_storage", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_dark);
                         } else {
                             clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_light);
@@ -1366,7 +1367,7 @@ public class SettingsFragment extends PreferenceFragment {
                 case "clear_form_data":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("clear_form_data", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
                         } else {
                             clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
@@ -1379,7 +1380,7 @@ public class SettingsFragment extends PreferenceFragment {
                 case "clear_cache":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("clear_cache", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             clearCachePreference.setIcon(R.drawable.cache_cleared_dark);
                         } else {
                             clearCachePreference.setIcon(R.drawable.cache_cleared_light);
@@ -1402,13 +1403,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "swipe_to_refresh":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("swipe_to_refresh", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_dark);
                         } else {
                             swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_dark);
                         } else {
                             swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_light);
@@ -1419,13 +1420,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "scroll_app_bar":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("scroll_app_bar", true)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark);
                         } else {
                             scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark);
                         } else {
                             scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_light);
@@ -1436,13 +1437,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "display_additional_app_bar_icons":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("display_additional_app_bar_icons", false)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_dark);
                         } else {
                             displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_dark);
                         } else {
                             displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_light);
@@ -1453,13 +1454,13 @@ public class SettingsFragment extends PreferenceFragment {
                 case "download_with_external_app":
                     // Update the icon.
                     if (sharedPreferences.getBoolean("download_with_external_app", false)) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_enabled_dark);
                         } else {
                             downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_disabled_dark);
                         } else {
                             downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_disabled_light);
@@ -1498,13 +1499,13 @@ public class SettingsFragment extends PreferenceFragment {
 
                     // Update the icon.
                     if (currentNightModeBoolean) {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             nightModePreference.setIcon(R.drawable.night_mode_enabled_dark);
                         } else {
                             nightModePreference.setIcon(R.drawable.night_mode_enabled_light);
                         }
                     } else {
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             nightModePreference.setIcon(R.drawable.night_mode_disabled_dark);
                         } else {
                             nightModePreference.setIcon(R.drawable.night_mode_disabled_light);
@@ -1527,14 +1528,14 @@ public class SettingsFragment extends PreferenceFragment {
                         if (sharedPreferences.getBoolean("dom_storage", false)) {  // DOM storage is enabled.
                             domStoragePreference.setIcon(R.drawable.dom_storage_enabled);
                         } else {  // DOM storage is disabled.
-                            if (MainWebViewActivity.darkTheme) {
+                            if (darkTheme) {
                                 domStoragePreference.setIcon(R.drawable.dom_storage_disabled_dark);
                             } else {
                                 domStoragePreference.setIcon(R.drawable.dom_storage_disabled_light);
                             }
                         }
                     } else {  // The preference is disabled.  The icon should be ghosted.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_dark);
                         } else {
                             domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_light);
@@ -1545,7 +1546,7 @@ public class SettingsFragment extends PreferenceFragment {
                 case "display_webpage_images":
                     if (sharedPreferences.getBoolean("display_webpage_images", true)) {
                         // Update the icon.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_dark);
                         } else {
                             displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_light);
@@ -1555,7 +1556,7 @@ public class SettingsFragment extends PreferenceFragment {
                         MainWebViewActivity.reloadOnRestart = false;
                     } else {
                         // Update the icon.
-                        if (MainWebViewActivity.darkTheme) {
+                        if (darkTheme) {
                             displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_dark);
                         } else {
                             displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_light);
index 371735455971b5c0c6400191fd22ffcb8490abf8..b41d0999bc568e6d78be883121efdbd70d44b1e0 100644 (file)
@@ -24,8 +24,10 @@ import android.app.Activity;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.net.Proxy;
+import android.preference.PreferenceManager;
 import android.util.ArrayMap;
 import android.util.Log;
 
@@ -116,8 +118,14 @@ public class OrbotProxyHelper {
                 // Use `AlertDialog.Builder` to create the `AlertDialog`.
                 AlertDialog.Builder dialogBuilder;
 
+                // Get a handle for the shared preferences.
+                SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(privacyBrowserContext);
+
+                // Get the theme preference.
+                boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
+
                 // Set the style according to the theme.
-                if (MainWebViewActivity.darkTheme) {
+                if (darkTheme) {
                     dialogBuilder = new AlertDialog.Builder(parentActivity, R.style.PrivacyBrowserAlertDialogDark);
                 } else {
                     dialogBuilder = new AlertDialog.Builder(parentActivity, R.style.PrivacyBrowserAlertDialogLight);
index 6cedf5c2b41967d2cb8b9c74e7b261f9c72ea22d..7ef26d6ed6d4981e0363f994624b80469d49766c 100644 (file)
@@ -59,6 +59,9 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild
     // Keep track of when the domain name changes so that domain settings can be reapplied.  This should never be null.
     private String currentDomainName = "";
 
+    // Track the status of first-party cookies.
+    private boolean acceptFirstPartyCookies;
+
     // Track the resource requests.
     private ArrayList<String[]> resourceRequests = new ArrayList<>();
     private boolean easyListEnabled;
@@ -193,6 +196,18 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild
     }
 
 
+    // First-party cookies.
+    public void setAcceptFirstPartyCookies(boolean status) {
+        // Store the accept first-party cookies status.
+        acceptFirstPartyCookies = status;
+    }
+
+    public boolean getAcceptFirstPartyCookies() {
+        // Return the accept first-party cookies status.
+        return acceptFirstPartyCookies;
+    }
+
+
     // Resource requests.
     public void addResourceRequest(String[] resourceRequest) {
         // Add the resource request to the list.
index 7eb115ef91445405f5ff28e66c8c963ee4867981..32938c3045340d46225a24837eec113540943a80 100644 (file)
         <string name="javascript_preference">JavaScript standardmäßig aktivieren</string>
         <string name="javascript_preference_summary">JavaScript ermöglicht es Websites, Programme (Scripts) auf Ihrem Gerät auszuführen.</string>
         <string name="first_party_cookies_preference">Erstanbieter-Cookies standardmäßig aktivieren</string>
-        <string name="first_party_cookies_preference_summary">Auf Geräten mit älterer Android-Version als Lollipop (Version 5.0)
-            wird zusammen mit dieser auch die Option für Drittanbieter-Cookies aktiviert.</string>
         <string name="third_party_cookies_preference">Drittanbieter-Cookies standardmäßig aktivieren</string>
         <string name="third_party_cookies_summary">Diese Option benötigt Android Lollipop (Version 5.0) oder höher. Sie hat keine Auswirkungen, wenn Erstanbieter-Cookies deaktiviert sind.</string>
         <string name="dom_storage_preference">DOM-Speicher standardmäßig aktivieren</string>
index 05d1994f00a0b380281b0f59fe92984df95864cb..eb7f46fd444eabdd8c3bfb9c295176157b0a8e7b 100644 (file)
@@ -46,6 +46,8 @@
     <string name="no_title">Sin título</string>
     <string name="unrecognized_url">URL no reconocida:</string>
     <string name="open_with">Abrir con</string>
+    <string name="new_tab">Nueva pestaña</string>
+    <string name="add_tab">Añadir pestaña</string>
 
     <!-- Save As. -->
     <string name="save_as">Guardar como</string>
     <!-- MainWebViewActivity Navigation Menu. -->
     <string name="navigation_drawer">Caja de navegación</string>
     <string name="navigation">Navegación</string>
+    <string name="close_tab">Cerrar pestaña</string>
     <string name="clear_and_exit">Borrar y salir</string>
     <string name="home">Inicio</string>
     <string name="back">Atrás</string>
     <string name="stop">Parar</string>
 
     <!-- Context Menus. -->
+    <string name="open_in_new_tab">Abrir en nueva pestaña</string>
     <string name="copy_url">Copiar URL</string>
     <string name="download_url">Descargar URL</string>
     <string name="email_address">Correo electrónico</string>
         <string name="javascript_preference">Habilitar Javascript por defecto</string>
         <string name="javascript_preference_summary">Javascript permite a las webs ejecutar programas (scripts) en el dispositivo.</string>
         <string name="first_party_cookies_preference">Habilitar cookies de primera parte por defecto</string>
-        <string name="first_party_cookies_preference_summary">Dispositivos con versiones de Android más antiguas que Lollipop (versión 5.0)
-            también habilitarán las cookies de terceras partes con este ajuste.</string>
+        <string name="first_party_cookies_preference_summary">Ya que las cookies de primera parte son una configuración de nivel de aplicación, cuando la pestaña activa tiene habilitadas las cookies,
+            cualquier solicitud de red realizada en segundo plano por otras pestañas también incluirá las cookies almacenadas para sus dominios.
+            Android KitKat (versión 4.4.x) no distingue entre cookies de primera y de terceras partes y las habilitará ambas con esta configuración.</string>
         <string name="third_party_cookies_preference">Habilar cookies de terceras partes por defecto</string>
         <string name="third_party_cookies_summary">Este ajuste requiere Android Lollipop (versión 5.0) o mayor.  No tiene efecto si las cookies de primera parte están deshabilitadas.</string>
         <string name="dom_storage_preference">Habilitar almacenamiento DOM por defecto</string>
index d2184c736a3221adcac3db0945f122f4dcadc706..b6ec37b8ffffa0f05e302444fe09fd23655d7809 100644 (file)
         <string name="javascript_preference">Abilita JavaScript</string>
         <string name="javascript_preference_summary">Permetti a JavaScript di eseguire programmi (script) sul dispositivo.</string>
         <string name="first_party_cookies_preference">Abilita cookies proprietari</string>
-        <string name="first_party_cookies_preference_summary">Questa impostazione abilita anche cookies di terze parti con dispositivi con versioni di Android precedenti a Lollipop (versione 5.0).</string>
         <string name="third_party_cookies_preference">Abilita cookies di terze parti</string>
         <string name="third_party_cookies_summary">Questa impostazione richiede Android Lollipop (version 5.0) o successivo.  Non ha effetti se i cookies proprietari sono disabilitati.</string>
         <string name="dom_storage_preference">Abilita DOM Storage</string>
index 1861ffb9f10fab4be6b072a43e61f2e911836747..7579648e8d13f9e1226ef18e691e0a4979cbffdf 100644 (file)
@@ -44,6 +44,8 @@
     <string name="no_title">Без названия</string>
     <string name="unrecognized_url">Нераспознанный URL:</string>
     <string name="open_with">Открыть в</string>
+    <string name="new_tab">Новая вкладка</string>
+    <string name="add_tab">Добавить вкладку</string>
 
     <!-- Save As. -->
     <string name="save_as">Сохранить как</string>
     <!-- MainWebViewActivity Navigation Menu. -->
     <string name="navigation_drawer">Навигационная панель</string>
     <string name="navigation">Навигация</string>
+    <string name="close_tab">Закрыть вкладку</string>
     <string name="clear_and_exit">Очистить и выйти</string>
     <string name="home">Домой</string>
     <string name="back">Назад</string>
     <string name="stop">Остановить</string>
 
     <!-- Context Menus. -->
+    <string name="open_in_new_tab">Открыть в новой вкладке</string>
     <string name="copy_url">Копировать URL</string>
     <string name="download_url">Загрузить URL</string>
     <string name="email_address">Адрес email</string>
         <string name="javascript_preference">Включить JavaScript по умолчанию</string>
         <string name="javascript_preference_summary">JavaScript позволяет веб-сайтам запускать программы (скрипты) на устройстве.</string>
         <string name="first_party_cookies_preference">Включить первичные файлы cookie по умолчанию</string>
-        <string name="first_party_cookies_preference_summary">На устройствах с версией Android старше Lollipop (версия 5.0) этим параметром также активируются сторонние файлы cookie.</string>
+        <string name="first_party_cookies_preference_summary">Поскольку первичные файлы cookie являются настройкой уровня приложения, при включении файлов cookie на активной вкладке, любые сетевые запросы,
+            сделанные в фоновом режиме другими вкладками, также будут содержать любые сохраненные файлы cookie для их доменов.
+            Android KitKat (версия 4.4.x) не различает первичные и сторонние файлы cookie и включает их одновременно этой настройкой.</string>
         <string name="third_party_cookies_preference">Включить сторонние файлы cookie по умолчанию</string>
         <string name="third_party_cookies_summary">Этот параметр требует Android Lollipop (версия 5.0) или выше. Он не действует, если первичные файлы cookie отключены.</string>
         <string name="dom_storage_preference">Включить DOM-хранилище по умолчанию</string>
index 1e81209cc324d03e0a980c81f1148038199ad24e..c4130307668966fecc0c7cd3c39b1a0f8edd4c47 100644 (file)
         <string name="javascript_preference">JavaScript\'i varsayılan olarak etkinleştir</string>
         <string name="javascript_preference_summary">JavaScript web sitelerin cihazdaki programları(scriptler) çalıştırmasına izin verir.</string>
         <string name="first_party_cookies_preference">Birinci taraf çerezleri varsayılan olarak etkinleştir</string>
-        <string name="first_party_cookies_preference_summary">Bu ayar, Android Lollipop sürümünden(5.0) eski sürümlere sahip cihazlarda üçüncü taraf çerezleri de etkinleştirir.</string>
         <string name="third_party_cookies_preference">Üçüncü taraf çerezleri varsayılan olarak etkinleştir</string>
         <string name="third_party_cookies_summary">Bu ayarı etkinleştirmek için Android Lollipop sürümüne(5.0) ya da daha üst sürümlere sahip olmak gerekir.
             Birinci taraf çerezler devre dışı olduğu takdirde etkisi yoktur.</string>
index 4070a2da5fabb889b0b821fd599ae5c01c512b51..d7e3f21ba9835a7253e42dd4602b9b9d569d6115 100644 (file)
         <string name="javascript_preference">Enable JavaScript by default</string>
         <string name="javascript_preference_summary">JavaScript allows websites to run programs (scripts) on the device.</string>
         <string name="first_party_cookies_preference">Enable first-party cookies by default</string>
-        <string name="first_party_cookies_preference_summary">Devices with versions of Android older than Lollipop (version 5.0) will also enable third-party cookies with this setting.</string>
+        <string name="first_party_cookies_preference_summary">Because first-party cookies are an app level setting, when the active tab has cookies enabled,
+            any network requests made in the background by other tabs will also include any stored cookies for their domains.
+            Android KitKat (version 4.4.x) does not differentiate between first and third-party cookies and will enable them both with this setting.</string>
         <string name="third_party_cookies_preference">Enable third-party cookies by default</string>
         <string name="third_party_cookies_summary">This setting requires Android Lollipop (version 5.0) or higher.  It has no effect if first-party cookies are disabled.</string>
         <string name="dom_storage_preference">Enable DOM storage by default</string>