import androidx.fragment.app.DialogFragment;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager.widget.ViewPager;
+import androidx.webkit.WebSettingsCompat;
+import androidx.webkit.WebViewFeature;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
// `reloadWebsite` is used if returning from the Domains activity. Otherwise JavaScript might not function correctly if it is newly enabled.
@SuppressLint("SetJavaScriptEnabled")
- private boolean applyDomainSettings(NestedScrollWebView nestedScrollWebView, String url, boolean resetTab, boolean reloadWebsite) {
- // Store a copy of the current user agent to track changes for the return boolean.
- String initialUserAgent = nestedScrollWebView.getSettings().getUserAgentString();
-
+ private void applyDomainSettings(NestedScrollWebView nestedScrollWebView, String url, boolean resetTab, boolean reloadWebsite) {
// Store the current URL.
nestedScrollWebView.setCurrentUrl(url);
if (reloadWebsite) {
nestedScrollWebView.reload();
}
-
- // Return the user agent changed status.
- return !nestedScrollWebView.getSettings().getUserAgentString().equals(initialUserAgent);
}
private void applyProxy(boolean reloadWebViews) {
});
}
+ // TODO.
+ if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
+ WebSettingsCompat.setForceDark(nestedScrollWebView.getSettings(), WebSettingsCompat.FORCE_DARK_AUTO);
+ }
+
// Set the web chrome client.
nestedScrollWebView.setWebChromeClient(new WebChromeClient() {
// Update the progress bar when a page is loading.
});
nestedScrollWebView.setWebViewClient(new WebViewClient() {
- // `shouldOverrideUrlLoading` makes this `WebView` the default handler for URLs inside the app, so that links are not kicked out to other apps.
+ // `shouldOverrideUrlLoading` makes this WebView the default handler for URLs inside the app, so that links are not kicked out to other apps.
// The deprecated `shouldOverrideUrlLoading` must be used until API >= 24.
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// Sanitize the url.
url = sanitizeUrl(url);
+ // Handle the URL according to the type.
if (url.startsWith("http")) { // Load the URL in Privacy Browser.
// Apply the domain settings for the new URL. This doesn't do anything if the domain has not changed.
- boolean userAgentChanged = applyDomainSettings(nestedScrollWebView, url, true, false);
+ applyDomainSettings(nestedScrollWebView, url, true, false);
- // Check if the user agent has changed.
- if (userAgentChanged) {
- // Manually load the URL. The changing of the user agent will cause WebView to reload the previous URL.
- nestedScrollWebView.loadUrl(url, customHeaders);
+ // Manually load the URL. The changing of the user agent will cause WebView to reload the previous URL.
+ nestedScrollWebView.loadUrl(url, customHeaders);
- // Returning true indicates that Privacy Browser is manually handling the loading of the URL.
- return true;
- } else {
- // Returning false causes the current WebView to handle the URL and prevents it from adding redirects to the history list.
- return false;
- }
+ // Returning true indicates that Privacy Browser is manually handling the loading of the URL.
+ // Custom headers cannot be added if false is returned and the WebView handles the loading of the URL.
+ return true;
} else if (url.startsWith("mailto:")) { // Load the email address in an external email program.
// Use `ACTION_SENDTO` instead of `ACTION_SEND` so that only email programs are launched.
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
// Only enable Fanboy's Social Blocking List if Fanboy's Annoyance List is off.
if (fanboysAnnoyanceListInt == 0) { // Fanboy's Annoyance List is on.
+ // Enable Fanboy's Social Blocking List switch.
+ fanboysSocialBlockingListSwitch.setEnabled(true);
+
// Enable Fanboy's Social Blocking List. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
if (fanboysSocialBlockingListInt == 1) { // Fanboy's Social Blocking List is on.
- // Enable the switch and turn it on.
- fanboysSocialBlockingListSwitch.setEnabled(true);
+ // Turn on Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(true);
// Set the icon according to the theme.
fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day));
}
} else { // Fanboy's Social Blocking List is off.
- // Enable the switch but turn it off.
- fanboysSocialBlockingListSwitch.setEnabled(true);
+ // Turn off Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(false);
// Set the icon according to the theme.
}
}
} else { // Fanboy's Annoyance List is on.
- // Disable Fanboy's Social Blocking List. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+ // Disable Fanboy's Social Blocking List switch.
+ fanboysSocialBlockingListSwitch.setEnabled(false);
+
+ // Handle the status of Fanboy's Social Blocking List. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
if (fanboysSocialBlockingListInt == 1) { // Fanboy's Social Blocking List is on.
- // Disable the switch but turn it on.
- fanboysSocialBlockingListSwitch.setEnabled(false);
+ // Turn on Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(true);
} else { // Fanboy's Social Blocking List is off.
- // Disable the switch and turn it off.
- fanboysSocialBlockingListSwitch.setEnabled(false);
+ // Turn off Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(false);
}
if (defaultNightMode) { // Night mode enabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
} else { // Night mode disabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
}
case DomainsDatabaseHelper.ENABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
// Hide the night mode TextView.
case DomainsDatabaseHelper.DISABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
// Hide the night mode TextView.
if (defaultNightMode) { // Night mode enabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
} else { // Night mode disabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
}
case DomainsDatabaseHelper.ENABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
// Hide `nightModeTextView`.
case DomainsDatabaseHelper.DISABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
// Hide `nightModeTextView`.
Preference scrollAppBarPreference = findPreference("scroll_app_bar");
Preference displayAdditionalAppBarIconsPreference = findPreference("display_additional_app_bar_icons");
Preference appThemePreference = findPreference("app_theme");
- Preference nightModePreference = findPreference("night_mode");
+ Preference webViewThemePreference = findPreference("webview_theme");
Preference wideViewportPreference = findPreference("wide_viewport");
Preference displayWebpageImagesPreference = findPreference("display_webpage_images");
assert scrollAppBarPreference != null;
assert displayAdditionalAppBarIconsPreference != null;
assert appThemePreference != null;
- assert nightModePreference != null;
+ assert webViewThemePreference != null;
assert wideViewportPreference != null;
assert displayWebpageImagesPreference != null;
- // Set the hide app bar preference dependency.
+ // Set the preference dependencies.
hideAppBarPreference.setDependency("full_screen_browsing_mode");
+ domStoragePreference.setDependency("javascript");
// Get strings from the preferences.
String userAgentName = savedPreferences.getString("user_agent", getString(R.string.user_agent_default_value));
// Get booleans that are used in multiple places from the preferences.
boolean javaScriptEnabled = savedPreferences.getBoolean("javascript", false);
boolean firstPartyCookiesEnabled = savedPreferences.getBoolean("first_party_cookies", false);
- boolean thirdPartyCookiesEnabled = savedPreferences.getBoolean("third_party_cookies", false);
boolean fanboyAnnoyanceListEnabled = savedPreferences.getBoolean("fanboys_annoyance_list", true);
boolean fanboySocialBlockingEnabled = savedPreferences.getBoolean("fanboys_social_blocking_list", true);
boolean fullScreenBrowsingMode = savedPreferences.getBoolean("full_screen_browsing_mode", false);
boolean clearEverything = savedPreferences.getBoolean("clear_everything", true);
- boolean nightMode = savedPreferences.getBoolean("night_mode", false);
// Only enable the third-party cookies preference if first-party cookies are enabled and API >= 21.
thirdPartyCookiesPreference.setEnabled(firstPartyCookiesEnabled && (Build.VERSION.SDK_INT >= 21));
- // Only enable the DOM storage preference if either JavaScript or Night Mode is enabled.
- domStoragePreference.setEnabled(javaScriptEnabled || nightMode);
-
// Remove the form data preferences if the API is >= 26 as they no longer do anything.
if (Build.VERSION.SDK_INT >= 26) {
- // Get the categories.
+ // Get handles for the categories.
PreferenceCategory privacyCategory = findPreference("privacy");
PreferenceCategory clearAndExitCategory = findPreference("clear_and_exit");
- // Remove the lint warnings below that the preference categories might be null.
+ // Remove the incorrect lint warnings below that the preference categories might be null.
assert privacyCategory != null;
assert clearAndExitCategory != null;
fontSizePreference.setSummary(savedPreferences.getString("font_size", getString(R.string.font_size_default_value)) + "%");
- // Get the theme string arrays.
+ // Get the app theme string arrays.
String[] appThemeEntriesStringArray = resources.getStringArray(R.array.app_theme_entries);
String[] appThemeEntryValuesStringArray = resources.getStringArray(R.array.app_theme_entry_values);
- // Get the current theme.
+ // Get the current app theme.
String currentAppTheme = savedPreferences.getString("app_theme", getString(R.string.app_theme_default_value));
- // Define a theme entry number.
+ // Define an app theme entry number.
int appThemeEntryNumber;
- // Get the theme entry number that matches the current theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant.
+ // Get the app theme entry number that matches the current app theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant.
if (currentAppTheme.equals(appThemeEntryValuesStringArray[1])) { // The light theme is selected.
+ // Store the app theme entry number.
appThemeEntryNumber = 1;
} else if (currentAppTheme.equals(appThemeEntryValuesStringArray[2])) { // The dark theme is selected.
+ // Store the app theme entry number.
appThemeEntryNumber = 2;
} else { // The system default theme is selected.
+ // Store the app theme entry number.
appThemeEntryNumber = 0;
}
appThemePreference.setSummary(appThemeEntriesStringArray[appThemeEntryNumber]);
- // Disable the JavaScript preference if Night Mode is enabled. JavaScript will be enabled for all web pages.
- javaScriptPreference.setEnabled(!nightMode);
+ // Get the WebView theme string arrays.
+ String[] webViewThemeEntriesStringArray = resources.getStringArray(R.array.webview_theme_entries);
+ String[] webViewThemeEntryValuesStringArray = resources.getStringArray(R.array.webview_theme_entry_values);
+
+ // Hide the WebView theme preference if the API < 21.
+ if (Build.VERSION.SDK_INT < 21) { // The device is running API 19.
+ // Get a handle for the general category.
+ PreferenceCategory generalCategory = findPreference("general");
+
+ // Remove the incorrect lint warning below that the general preference category might be null.
+ assert generalCategory != null;
+
+ // Remove the WebView theme preference.
+ generalCategory.removePreference(webViewThemePreference);
+ } else { // The device is running API >= 21
+ // Get the current WebView theme.
+ String currentWebViewTheme = savedPreferences.getString("webview_theme", getString(R.string.webview_theme_default_value));
+
+ // Define a WebView theme entry number.
+ int webViewThemeEntryNumber;
+
+ // Get the WebView theme entry number that matches the current WebView theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant.
+ if (currentWebViewTheme.equals(webViewThemeEntryValuesStringArray[1])) { // The light theme is selected.
+ // Store the WebView theme entry number.
+ webViewThemeEntryNumber = 1;
+ } else if (currentWebViewTheme.equals(webViewThemeEntryValuesStringArray[2])) { // The dark theme is selected.
+ // Store the WebView theme entry number.
+ webViewThemeEntryNumber = 2;
+ } else { // The system default theme is selected.
+ // Store the WebView theme entry number.
+ webViewThemeEntryNumber = 0;
+ }
+
+ // Set the current theme as the summary text for the preference.
+ webViewThemePreference.setSummary(webViewThemeEntriesStringArray[webViewThemeEntryNumber]);
+ }
+
// Set the JavaScript icon.
- if (javaScriptEnabled || nightMode) {
+ if (javaScriptEnabled) {
javaScriptPreference.setIcon(R.drawable.javascript_enabled);
} else {
javaScriptPreference.setIcon(R.drawable.privacy_mode);
// Set the third party cookies icon.
if (firstPartyCookiesEnabled && Build.VERSION.SDK_INT >= 21) {
- if (thirdPartyCookiesEnabled) {
+ if (savedPreferences.getBoolean("third_party_cookies", false)) {
thirdPartyCookiesPreference.setIcon(R.drawable.cookies_warning);
} else {
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
}
// Set the DOM storage icon.
- if (javaScriptEnabled || nightMode) { // The preference is enabled.
+ if (javaScriptEnabled) { // The preference is enabled.
if (savedPreferences.getBoolean("dom_storage", false)) { // DOM storage is enabled.
domStoragePreference.setIcon(R.drawable.dom_storage_enabled);
} else { // DOM storage is disabled.
}
}
- // Set the night mode preference icon.
- if (nightMode) {
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModePreference.setIcon(R.drawable.night_mode_enabled_night);
- } else {
- nightModePreference.setIcon(R.drawable.night_mode_enabled_day);
- }
- } else {
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModePreference.setIcon(R.drawable.night_mode_disabled_night);
- } else {
- nightModePreference.setIcon(R.drawable.night_mode_disabled_day);
- }
- }
-
// Set the wide viewport preference icon.
if (savedPreferences.getBoolean("wide_viewport", true)) {
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
break;
- case "night_mode":
- // Store the current night mode status.
- boolean currentNightModeBoolean = sharedPreferences.getBoolean("night_mode", false);
- boolean currentJavaScriptBoolean = sharedPreferences.getBoolean("javascript", false);
+ case "webview_theme":
+ // Get the new WebView theme.
+ String newWebViewTheme = sharedPreferences.getString("webview_theme", getString(R.string.webview_theme_default_value));
- // Update the icon.
- if (currentNightModeBoolean) {
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModePreference.setIcon(R.drawable.night_mode_enabled_night);
- } else {
- nightModePreference.setIcon(R.drawable.night_mode_enabled_day);
- }
- } else {
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModePreference.setIcon(R.drawable.night_mode_disabled_night);
- } else {
- nightModePreference.setIcon(R.drawable.night_mode_disabled_day);
- }
- }
-
- // Update the status of `javaScriptPreference` and `domStoragePreference`.
- javaScriptPreference.setEnabled(!currentNightModeBoolean);
- domStoragePreference.setEnabled(currentNightModeBoolean || currentJavaScriptBoolean);
+ // Define a new WebView theme entry number.
+ int newWebViewThemeEntryNumber;
- // Update the `javaScriptPreference` icon.
- if (currentNightModeBoolean || currentJavaScriptBoolean) {
- javaScriptPreference.setIcon(R.drawable.javascript_enabled);
- } else {
- javaScriptPreference.setIcon(R.drawable.privacy_mode);
+ // Get the webView theme entry number that matches the new WebView theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant.
+ if (newWebViewTheme.equals(webViewThemeEntriesStringArray[1])) { // The light theme is selected.
+ // Store the new WebView theme entry number.
+ newWebViewThemeEntryNumber = 1;
+ } else if (newWebViewTheme.equals(webViewThemeEntryValuesStringArray[2])) { // The dark theme is selected.
+ // Store the WebView theme entry number.
+ newWebViewThemeEntryNumber = 2;
+ } else { // The system default theme is selected.
+ // Store the WebView theme entry number.
+ newWebViewThemeEntryNumber = 0;
}
- // Update the DOM storage preference icon.
- if (currentNightModeBoolean || currentJavaScriptBoolean) { // The preference is enabled.
- if (sharedPreferences.getBoolean("dom_storage", false)) { // DOM storage is enabled.
- domStoragePreference.setIcon(R.drawable.dom_storage_enabled);
- } else { // DOM storage is disabled.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- domStoragePreference.setIcon(R.drawable.dom_storage_disabled_night);
- } else {
- domStoragePreference.setIcon(R.drawable.dom_storage_disabled_day);
- }
- }
- } else { // The preference is disabled. The icon should be ghosted.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_night);
- } else {
- domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_day);
- }
- }
+ // Set the current theme as the summary text for the preference.
+ webViewThemePreference.setSummary(webViewThemeEntriesStringArray[newWebViewThemeEntryNumber]);
break;
case "wide_viewport":
+++ /dev/null
-<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
- Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
-
-<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:height="24dp"
- android:width="24dp"
- android:viewportHeight="24"
- android:viewportWidth="24"
- android:autoMirrored="true"
- tools:ignore="VectorRaster" >
-
- <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
- <path
- android:fillColor="#FF757575"
- android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
-</vector>
+++ /dev/null
-<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
- Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
-
-<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:height="24dp"
- android:width="24dp"
- android:viewportHeight="24"
- android:viewportWidth="24"
- android:autoMirrored="true"
- tools:ignore="VectorRaster" >
-
- <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
- <path
- android:fillColor="#FF9E9E9E"
- android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
-</vector>
+++ /dev/null
-<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
- Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
-
-<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:height="24dp"
- android:width="24dp"
- android:viewportHeight="24"
- android:viewportWidth="24"
- android:autoMirrored="true"
- tools:ignore="VectorRaster" >
-
- <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
- <path
- android:fillColor="#FF1565C0"
- android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
-</vector>
+++ /dev/null
-<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
- Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
-
-<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
-<vector
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:height="24dp"
- android:width="24dp"
- android:viewportHeight="24.0"
- android:viewportWidth="24.0"
- android:autoMirrored="true"
- tools:ignore="VectorRaster" >
-
- <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
- <path
- android:fillColor="#FF8AB4F8"
- android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
-</vector>
--- /dev/null
+<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
+ Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
+
+<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24"
+ android:autoMirrored="true"
+ tools:ignore="VectorRaster" >
+
+ <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
+ <path
+ android:fillColor="#FF757575"
+ android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
+</vector>
--- /dev/null
+<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
+ Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
+
+<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24"
+ android:autoMirrored="true"
+ tools:ignore="VectorRaster" >
+
+ <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
+ <path
+ android:fillColor="#FF9E9E9E"
+ android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
+</vector>
--- /dev/null
+<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
+ Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
+
+<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24"
+ android:autoMirrored="true"
+ tools:ignore="VectorRaster" >
+
+ <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
+ <path
+ android:fillColor="#FF1565C0"
+ android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
+</vector>
--- /dev/null
+<!-- This file is derived from `compare`, which is part of the Android Material icon set. It is released under the Apache License 2.0.
+ Modifications copyright © 2017 Soren Stoutner <soren@stoutner.com>. The resulting image is released under the GPLv3+ license. -->
+
+<!-- `tools:ignore="VectorRaster"` removes the lint warning about `android:autoMirrored="true"` not applying to API < 21. -->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0"
+ android:autoMirrored="true"
+ tools:ignore="VectorRaster" >
+
+ <!-- A hard coded color must be used until API >= 21. Then `@color` or `?attr/colorControlNormal` may be used instead. -->
+ <path
+ android:fillColor="#FF8AB4F8"
+ android:pathData="m14,3h5c1.1,0 2,0.9 2,2v14c0,1.1 -0.9,2 -2,2h-5v2L12,23L12,1h2zM14,18h5L14,12ZM5,3h5L10,5L5,5v13l5,-6v9L5,21C3.9,21 3,20.1 3,19L3,5C3,3.9 3.9,3 5,3Z"/>
+</vector>
android:layout_marginTop="1dp"
android:layout_marginEnd="10dp"
android:layout_gravity="center_vertical"
- android:contentDescription="@string/night_mode" />
+ android:contentDescription="@string/webview_theme" />
<Spinner
android:id="@+id/night_mode_spinner"
<item>Hell</item>
<item>Dunkel</item>
</string-array>
- <string name="night_mode">Nacht-Modus</string>
- <string name="night_mode_summary">Aktivieren des Nacht-Modus aktiviert JavaScript für alle Webseiten.</string>
<string name="wide_viewport_preference">Breiter Anzeigebereich</string>
<string name="wide_viewport_summary">Wird der breite Anzeigebereich verwendet, werden manche Webseiten eher wie am Desktop (Standrechner, Laptop) angezeigt.</string>
<string name="display_webpage_images">Webseiten-Bilder anzeigen</string>
<item>Claro</item>
<item>Oscuro</item>
</string-array>
- <string name="night_mode">Modo noche</string>
- <string name="night_mode_summary">Activar el modo noche también activará javascript para todas las páginas web.</string>
<string name="wide_viewport_preference">Vista amplia</string>
<string name="wide_viewport_summary">El uso de una vista amplia hace que el diseño de algunas páginas web se parezca más al sitio de escritorio.</string>
<string name="display_webpage_images">Mostrar imágenes de la página web</string>
<item>Clair</item>
<item>Sombre</item>
</string-array>
- <string name="night_mode">Mode nuit</string>
- <string name="night_mode_summary">L\'activation du mode nuit activera également JavaScript pour toutes les pages Web.</string>
<string name="wide_viewport_preference">Large fenêtre</string>
<string name="wide_viewport_summary">L\'utilisation d\'une fenêtre d\'affichage large fait que la mise en page de certaines pages Web ressemble davantage au site de bureau.</string>
<string name="display_webpage_images">Afficher images Web</string>
<item>Chiaro</item>
<item>Scuro</item>
</string-array>
- <string name="night_mode">Modalità Notte</string>
- <string name="night_mode_summary">L\'abilitazione della modalità notte attiva anche JavaScript per tutte le pagine web.</string>
<string name="wide_viewport_preference">Finestra grande</string>
<string name="wide_viewport_summary">L\'utilizzo di una finestra grande permette la visualizzazione di alcune pagine web come in modalità desktop.</string>
<string name="display_webpage_images">Mostra immagini delle pagine web</string>
<item name="homepageIcon">@drawable/home_enabled_night</item>
<item name="searchIcon">@drawable/search_enabled_night</item>
<item name="userAgentIcon">@drawable/user_agent_night</item>
+ <item name="webViewThemeIcon">@drawable/webview_theme_enabled_night</item>
</style>
<style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
<item name="homepageIcon">@drawable/home_enabled_night</item>
<item name="searchIcon">@drawable/search_enabled_night</item>
<item name="userAgentIcon">@drawable/user_agent_night</item>
+ <item name="webViewThemeIcon">@drawable/webview_theme_enabled_night</item>
</style>
<style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
<item name="homepageIcon">@drawable/home_enabled_night</item>
<item name="searchIcon">@drawable/search_enabled_night</item>
<item name="userAgentIcon">@drawable/user_agent_night</item>
+ <item name="webViewThemeIcon">@drawable/webview_theme_enabled_night</item>
</style>
<style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
<item>Светлая</item>
<item>Темная</item>
</string-array>
- <string name="night_mode">Ночной режим</string>
- <string name="night_mode_summary">Включение ночного режима также включает JavaScript для всех веб-страниц.</string>
<string name="wide_viewport_preference">Широкий вид просмотра</string>
<string name="wide_viewport_summary">Использование широкого вида просмотра делает стиль некоторых веб-страниц более похожим на сайт для компьютера.</string>
<string name="display_webpage_images">Показывать изображения веб-страницы</string>
<string name="scroll_app_bar_summary">WebView aşağı kaydırıldığında, ekranın üst kısmından uygulama çubuğunu kaydırır.</string>
<string name="display_additional_app_bar_icons">Ek uygulama çubuğu simgelerini göster</string>
<string name="display_additional_app_bar_icons_summary">WebView\'ı yenilemek, yer varsa çerezleri ve DOM depolamayı değiştirmek için simgeleri uygulama çubuğunda gösterir.</string>
- <string name="night_mode">Gece modu</string>
- <string name="night_mode_summary">Gece modunu etkinleştirmek, aynı zamanda tüm sitelerde JavaScript\'i etkinleştirir.</string>
<string name="wide_viewport_preference">Geniş ekran</string>
<string name="wide_viewport_summary">Geniş ekran kullanmak, bazı web sayfalarının düzenini masaüstü versiyonları gibi yapar.</string>
<string name="display_webpage_images">Web sayfasının görsellerini göster</string>
<item name="homepageIcon">@drawable/home_enabled_day</item>
<item name="searchIcon">@drawable/search_enabled_day</item>
<item name="userAgentIcon">@drawable/user_agent_day</item>
+ <item name="webViewThemeIcon">@drawable/webview_theme_enabled_day</item>
</style>
<style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
<item name="homepageIcon">@drawable/home_enabled_day</item>
<item name="searchIcon">@drawable/search_enabled_day</item>
<item name="userAgentIcon">@drawable/user_agent_day</item>
+ <item name="webViewThemeIcon">@drawable/webview_theme_enabled_day</item>
</style>
<style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
<attr name="selectAllIcon" format="reference" />
<attr name="sortIcon" format="reference" />
<attr name="userAgentIcon" format="reference" />
+ <attr name="webViewThemeIcon" format="reference" />
</resources>
\ No newline at end of file
<item>Light</item>
<item>Dark</item>
</string-array>
- <string name="night_mode">Night mode</string>
- <string name="night_mode_summary">Enabling night mode will also enable JavaScript for all web pages.</string>
+ <string name="webview_theme">WebView theme</string>
+ <string-array name="webview_theme_entries">
+ <item>System default</item>
+ <item>Light</item>
+ <item>Dark</item>
+ </string-array>
+ <string-array name="webview_theme_entry_values" translatable="false"> <!-- None of the items in this string array should be translated. -->
+ <item>System default</item>
+ <item>Light</item>
+ <item>Dark</item>
+ </string-array>
<string name="wide_viewport_preference">Wide viewport</string>
<string name="wide_viewport_summary">Using a wide viewport makes some webpages layout more like the desktop site.</string>
<string name="display_webpage_images">Display webpage images</string>
<string name="download_custom_location_default_value" translatable="false" />
<string name="font_size_default_value" translatable="false">100</string>
<string name="app_theme_default_value" translatable="false">System default</string>
+ <string name="webview_theme_default_value" translatable="false">System default</string>
<!-- Ad Control. There are no ads in the standard flavor, but these strings must exist because they are referenced in the code. -->
<string name="google_app_id" translatable="false">Null</string>
<item name="homepageIcon">@drawable/home_enabled_day</item>
<item name="searchIcon">@drawable/search_enabled_day</item>
<item name="userAgentIcon">@drawable/user_agent_day</item>
+ <item name="webViewThemeIcon">@drawable/webview_theme_enabled_day</item>
</style>
<style name="PrivacyBrowserAlertDialog" parent="Theme.AppCompat.DayNight.Dialog.Alert" >
android:defaultValue="@string/app_theme_default_value"
android:icon="?attr/appThemeIcon" />
- <SwitchPreference
- android:key="night_mode"
- android:title="@string/night_mode"
- android:summary="@string/night_mode_summary"
- android:defaultValue="false" />
+ <ListPreference
+ android:key="webview_theme"
+ android:title="@string/webview_theme"
+ android:entries="@array/webview_theme_entries"
+ android:entryValues="@array/webview_theme_entry_values"
+ android:defaultValue="@string/webview_theme_default_value"
+ android:icon="?attr/webViewThemeIcon" />
<SwitchPreference
android:key="wide_viewport"