Switch firstPartyCookiesSwitch = view.findViewById(R.id.domain_settings_first_party_cookies_switch);
Switch thirdPartyCookiesSwitch = view.findViewById(R.id.domain_settings_third_party_cookies_switch);
Switch domStorageSwitch = view.findViewById(R.id.domain_settings_dom_storage_switch);
- Switch formDataSwitch = view.findViewById(R.id.domain_settings_form_data_switch);
+ Switch formDataSwitch = view.findViewById(R.id.domain_settings_form_data_switch); // Form data can be removed once the minimum API >= 26.
Switch easyListSwitch = view.findViewById(R.id.domain_settings_easylist_switch);
Switch easyPrivacySwitch = view.findViewById(R.id.domain_settings_easyprivacy_switch);
Switch fanboysAnnoyanceSwitch = view.findViewById(R.id.domain_settings_fanboys_annoyance_list_switch);
boolean firstPartyCookiesEnabled = firstPartyCookiesSwitch.isChecked();
boolean thirdPartyCookiesEnabled = thirdPartyCookiesSwitch.isChecked();
boolean domStorageEnabled = domStorageSwitch.isChecked();
- boolean formDataEnabled = formDataSwitch.isChecked();
+ boolean formDataEnabled = formDataSwitch.isChecked(); // Form data can be removed once the minimum API >= 26.
boolean easyListEnabled = easyListSwitch.isChecked();
boolean easyPrivacyEnabled = easyPrivacySwitch.isChecked();
boolean fanboysAnnoyanceEnabled = fanboysAnnoyanceSwitch.isChecked();
// `domStorageEnabled` is used in `onCreate()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, and `applyDomainSettings()`.
private boolean domStorageEnabled;
- // `saveFormDataEnabled` is used in `onCreate()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, and `applyDomainSettings()`.
+ // `saveFormDataEnabled` is used in `onCreate()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, and `applyDomainSettings()`. It can be removed once the minimum API >= 26.
private boolean saveFormDataEnabled;
// `nightMode` is used in `onCreate()` and `applyDomainSettings()`.
firstPartyCookiesEnabled = false;
thirdPartyCookiesEnabled = false;
domStorageEnabled = false;
- saveFormDataEnabled = false;
+ saveFormDataEnabled = false; // Form data can be removed once the minimum API >= 26.
nightMode = false;
// Initialize the WebView title.
MenuItem toggleFirstPartyCookiesMenuItem = menu.findItem(R.id.toggle_first_party_cookies);
MenuItem toggleThirdPartyCookiesMenuItem = menu.findItem(R.id.toggle_third_party_cookies);
MenuItem toggleDomStorageMenuItem = menu.findItem(R.id.toggle_dom_storage);
+ MenuItem toggleSaveFormDataMenuItem = menu.findItem(R.id.toggle_save_form_data); // Form data can be removed once the minimum API >= 26.
+ MenuItem clearFormDataMenuItem = menu.findItem(R.id.clear_form_data); // Form data can be removed once the minimum API >= 26.
MenuItem refreshMenuItem = menu.findItem(R.id.refresh);
+ MenuItem adConsentMenuItem = menu.findItem(R.id.ad_consent);
- // Only display third-party cookies if SDK >= 21
+ // Only display third-party cookies if API >= 21
toggleThirdPartyCookiesMenuItem.setVisible(Build.VERSION.SDK_INT >= 21);
+ // Only display the form data menu items if the API < 26.
+ toggleSaveFormDataMenuItem.setVisible(Build.VERSION.SDK_INT < 26);
+ clearFormDataMenuItem.setVisible(Build.VERSION.SDK_INT < 26);
+
+ // Only show Ad Consent if this is the free flavor.
+ adConsentMenuItem.setVisible(BuildConfig.FLAVOR.contentEquals("free"));
+
// Get the shared preference values. `this` references the current context.
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
MenuItem toggleFirstPartyCookiesMenuItem = menu.findItem(R.id.toggle_first_party_cookies);
MenuItem toggleThirdPartyCookiesMenuItem = menu.findItem(R.id.toggle_third_party_cookies);
MenuItem toggleDomStorageMenuItem = menu.findItem(R.id.toggle_dom_storage);
- MenuItem toggleSaveFormDataMenuItem = menu.findItem(R.id.toggle_save_form_data);
+ MenuItem toggleSaveFormDataMenuItem = menu.findItem(R.id.toggle_save_form_data); // Form data can be removed once the minimum API >= 26.
MenuItem clearDataMenuItem = menu.findItem(R.id.clear_data);
MenuItem clearCookiesMenuItem = menu.findItem(R.id.clear_cookies);
MenuItem clearDOMStorageMenuItem = menu.findItem(R.id.clear_dom_storage);
- MenuItem clearFormDataMenuItem = menu.findItem(R.id.clear_form_data);
+ MenuItem clearFormDataMenuItem = menu.findItem(R.id.clear_form_data); // Form data can be removed once the minimum API >= 26.
MenuItem fontSizeMenuItem = menu.findItem(R.id.font_size);
MenuItem swipeToRefreshMenuItem = menu.findItem(R.id.swipe_to_refresh);
MenuItem displayImagesMenuItem = menu.findItem(R.id.display_images);
- MenuItem adConsentMenuItem = menu.findItem(R.id.ad_consent);
// Set the text for the domain menu item.
if (domainSettingsApplied) {
toggleFirstPartyCookiesMenuItem.setChecked(firstPartyCookiesEnabled);
toggleThirdPartyCookiesMenuItem.setChecked(thirdPartyCookiesEnabled);
toggleDomStorageMenuItem.setChecked(domStorageEnabled);
- toggleSaveFormDataMenuItem.setChecked(saveFormDataEnabled);
+ toggleSaveFormDataMenuItem.setChecked(saveFormDataEnabled); // Form data can be removed once the minimum API >= 26.
swipeToRefreshMenuItem.setChecked(swipeRefreshLayout.isEnabled());
displayImagesMenuItem.setChecked(mainWebView.getSettings().getLoadsImagesAutomatically());
// Enable `Clear DOM Storage` if there is any.
clearDOMStorageMenuItem.setEnabled(localStorageDirectoryNumberOfFiles > 0 || indexedDBDirectoryNumberOfFiles > 0);
- // Enable `Clear Form Data` is there is any.
- WebViewDatabase mainWebViewDatabase = WebViewDatabase.getInstance(this);
- clearFormDataMenuItem.setEnabled(mainWebViewDatabase.hasFormData());
+ // Enable `Clear Form Data` is there is any. This can be removed once the minimum API >= 26.
+ if (Build.VERSION.SDK_INT < 26) {
+ WebViewDatabase mainWebViewDatabase = WebViewDatabase.getInstance(this);
+ clearFormDataMenuItem.setEnabled(mainWebViewDatabase.hasFormData());
+ }
// Enable `Clear Data` if any of the submenu items are enabled.
clearDataMenuItem.setEnabled(clearCookiesMenuItem.isEnabled() || clearDOMStorageMenuItem.isEnabled() || clearFormDataMenuItem.isEnabled());
fontSizeMenuItem.setTitle(fontSizeTitle);
selectedFontSizeMenuItem.setChecked(true);
- // Only show Ad Consent if this is the free flavor.
- adConsentMenuItem.setVisible(BuildConfig.FLAVOR.contentEquals("free"));
-
// Run all the other default commands.
super.onPrepareOptionsMenu(menu);
mainWebView.reload();
return true;
+ // Form data can be removed once the minimum API >= 26.
case R.id.toggle_save_form_data:
// Switch the status of saveFormDataEnabled.
saveFormDataEnabled = !saveFormDataEnabled;
.show();
return true;
+ // Form data can be remove once the minimum API >= 26.
case R.id.clear_form_data:
Snackbar.make(findViewById(R.id.main_webview), R.string.form_data_deleted, Snackbar.LENGTH_LONG)
.setAction(R.string.undo, v -> {
}
}
- // Clear form data.
- if (clearEverything || sharedPreferences.getBoolean("clear_form_data", true)) {
+ // Clear form data if the API < 26.
+ if ((Build.VERSION.SDK_INT < 26) && (clearEverything || sharedPreferences.getBoolean("clear_form_data", true))) {
WebViewDatabase webViewDatabase = WebViewDatabase.getInstance(this);
webViewDatabase.clearFormData();
firstPartyCookiesEnabled = (currentHostDomainSettingsCursor.getInt(currentHostDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FIRST_PARTY_COOKIES)) == 1);
thirdPartyCookiesEnabled = (currentHostDomainSettingsCursor.getInt(currentHostDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_THIRD_PARTY_COOKIES)) == 1);
domStorageEnabled = (currentHostDomainSettingsCursor.getInt(currentHostDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_DOM_STORAGE)) == 1);
+ // Form data can be removed once the minimum API >= 26.
saveFormDataEnabled = (currentHostDomainSettingsCursor.getInt(currentHostDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FORM_DATA)) == 1);
easyListEnabled = (currentHostDomainSettingsCursor.getInt(currentHostDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_EASYLIST)) == 1);
easyPrivacyEnabled = (currentHostDomainSettingsCursor.getInt(currentHostDomainSettingsCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_EASYPRIVACY)) == 1);
mainWebView.getSettings().setJavaScriptEnabled(javaScriptEnabled);
cookieManager.setAcceptCookie(firstPartyCookiesEnabled);
mainWebView.getSettings().setDomStorageEnabled(domStorageEnabled);
- mainWebView.getSettings().setSaveFormData(saveFormDataEnabled);
+
+ // Apply the form data setting if the API < 26.
+ if (Build.VERSION.SDK_INT < 26) {
+ mainWebView.getSettings().setSaveFormData(saveFormDataEnabled);
+ }
// Apply the font size.
if (fontSize == 0) { // Apply the default font size.
firstPartyCookiesEnabled = sharedPreferences.getBoolean("first_party_cookies_enabled", false);
thirdPartyCookiesEnabled = sharedPreferences.getBoolean("third_party_cookies_enabled", false);
domStorageEnabled = sharedPreferences.getBoolean("dom_storage_enabled", false);
- saveFormDataEnabled = sharedPreferences.getBoolean("save_form_data_enabled", false);
+ saveFormDataEnabled = sharedPreferences.getBoolean("save_form_data_enabled", false); // Form data can be removed once the minimum API >= 26.
easyListEnabled = sharedPreferences.getBoolean("easylist", true);
easyPrivacyEnabled = sharedPreferences.getBoolean("easyprivacy", true);
fanboysAnnoyanceListEnabled = sharedPreferences.getBoolean("fanboy_annoyance_list", true);
mainWebView.getSettings().setJavaScriptEnabled(javaScriptEnabled);
cookieManager.setAcceptCookie(firstPartyCookiesEnabled);
mainWebView.getSettings().setDomStorageEnabled(domStorageEnabled);
- mainWebView.getSettings().setSaveFormData(saveFormDataEnabled);
mainWebView.getSettings().setTextZoom(Integer.valueOf(defaultFontSizeString));
swipeRefreshLayout.setEnabled(defaultSwipeToRefresh);
+ // Apply the form data setting if the API < 26.
+ if (Build.VERSION.SDK_INT < 26) {
+ mainWebView.getSettings().setSaveFormData(saveFormDataEnabled);
+ }
+
// Reset the pinned SSL certificate information.
domainSettingsDatabaseId = -1;
pinnedDomainSslCertificate = false;
final ImageView thirdPartyCookiesImageView = domainSettingsView.findViewById(R.id.domain_settings_third_party_cookies_imageview);
final Switch domStorageEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_dom_storage_switch);
final ImageView domStorageImageView = domainSettingsView.findViewById(R.id.domain_settings_dom_storage_imageview);
- Switch formDataEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_form_data_switch);
- final ImageView formDataImageView = domainSettingsView.findViewById(R.id.domain_settings_form_data_imageview);
+ Switch formDataEnabledSwitch = domainSettingsView.findViewById(R.id.domain_settings_form_data_switch); // The form data views can be remove once the minimum API >= 26.
+ final ImageView formDataImageView = domainSettingsView.findViewById(R.id.domain_settings_form_data_imageview); // The form data views can be remove once the minimum API >= 26.
Switch easyListSwitch = domainSettingsView.findViewById(R.id.domain_settings_easylist_switch);
ImageView easyListImageView = domainSettingsView.findViewById(R.id.domain_settings_easylist_imageview);
Switch easyPrivacySwitch = domainSettingsView.findViewById(R.id.domain_settings_easyprivacy_switch);
int firstPartyCookiesEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FIRST_PARTY_COOKIES));
int thirdPartyCookiesEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_THIRD_PARTY_COOKIES));
final int domStorageEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_DOM_STORAGE));
- int formDataEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FORM_DATA));
+ int formDataEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FORM_DATA)); // Form data can be remove once the minimum API >= 26.
int easyListEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_EASYLIST));
int easyPrivacyEnabledInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_EASYPRIVACY));
int fanboysAnnoyanceListInt = domainCursor.getInt(domainCursor.getColumnIndex(DomainsDatabaseHelper.ENABLE_FANBOYS_ANNOYANCE_LIST));
}
}
- // Set the form data status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- if (formDataEnabledInt == 1) { // Form data is on.
- formDataEnabledSwitch.setChecked(true);
- formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
- } else { // Form data is off.
- // Turn the form data switch to off.
- formDataEnabledSwitch.setChecked(false);
+ // Set the form data status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. Form data can be removed once the minimum API >= 26.
+ if (Build.VERSION.SDK_INT >= 26) { // Form data no longer applies to newer versions of Android.
+ // Hide the form data switch.
+ formDataEnabledSwitch.setVisibility(View.GONE);
+ } else { // Form data should be displayed because this is an older version of Android.
+ if (formDataEnabledInt == 1) { // Form data is on.
+ formDataEnabledSwitch.setChecked(true);
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
+ } else { // Form data is off.
+ // Turn the form data switch to off.
+ formDataEnabledSwitch.setChecked(false);
- // Set the icon according to the theme.
- if (MainWebViewActivity.darkTheme) {
- formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
- } else {
- formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
+ } else {
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
+ }
}
}
}
});
- // Set the form data switch listener.
- formDataEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
- // Update the icon.
- if (isChecked) {
- formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
- } else {
- // Set the icon according to the theme.
- if (MainWebViewActivity.darkTheme) {
- formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
+ // Set the form data switch listener. It can be removed once the minimum API >= 26.
+ if (Build.VERSION.SDK_INT < 26) {
+ formDataEnabledSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
+ // Update the icon.
+ if (isChecked) {
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
} else {
- formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
+ } else {
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
+ }
}
- }
- });
+ });
+ }
// Set the EasyList switch listener.
easyListSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
+import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.view.LayoutInflater;
import android.view.View;
final Preference firstPartyCookiesPreference = findPreference("first_party_cookies_enabled");
final Preference thirdPartyCookiesPreference = findPreference("third_party_cookies_enabled");
final Preference domStoragePreference = findPreference("dom_storage_enabled");
- final Preference saveFormDataPreference = findPreference("save_form_data_enabled");
+ final Preference saveFormDataPreference = findPreference("save_form_data_enabled"); // The form data preference can be removed once the minimum API >= 26.
final Preference userAgentPreference = findPreference("user_agent");
final Preference customUserAgentPreference = findPreference("custom_user_agent");
final Preference incognitoModePreference = findPreference("incognito_mode");
final Preference clearEverythingPreference = findPreference("clear_everything");
final Preference clearCookiesPreference = findPreference("clear_cookies");
final Preference clearDomStoragePreference = findPreference("clear_dom_storage");
- final Preference clearFormDataPreference = findPreference("clear_form_data");
+ final Preference clearFormDataPreference = findPreference("clear_form_data"); // The clear form data preference can be removed once the minimum API >= 26.
final Preference clearCachePreference = findPreference("clear_cache");
final Preference homepagePreference = findPreference("homepage");
final Preference defaultFontSizePreference = findPreference("default_font_size");
String torSearchString = savedPreferences.getString("tor_search", "https://3g2upl4pq6kufc4m.onion/html/?q=");
String searchString = savedPreferences.getString("search", "https://duckduckgo.com/html/?q=");
- // Get booleans from the preferences.
+ // Get booleans that are used in multiple places from the preferences.
final boolean javaScriptEnabled = savedPreferences.getBoolean("javascript_enabled", false);
boolean firstPartyCookiesEnabled = savedPreferences.getBoolean("first_party_cookies_enabled", false);
boolean thirdPartyCookiesEnabled = savedPreferences.getBoolean("third_party_cookies_enabled", false);
boolean clearEverything = savedPreferences.getBoolean("clear_everything", true);
final boolean nightMode = savedPreferences.getBoolean("night_mode", false);
- // Only enable the third-party preference if first-party cookies are enabled and API >= 21.
+ // 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.
+ PreferenceCategory privacyCategory = (PreferenceCategory) findPreference("privacy");
+ PreferenceCategory clearAndExitCategory = (PreferenceCategory) findPreference("clear_and_exit");
+
+ // Remove the form data preferences.
+ privacyCategory.removePreference(saveFormDataPreference);
+ clearAndExitCategory.removePreference(clearFormDataPreference);
+ }
+
// Only enable Fanboy's social blocking list preference if Fanboy's annoyance list is disabled.
fanboySocialBlockingListPreference.setEnabled(!fanboyAnnoyanceListEnabled);
- // We need to inflated a `WebView` to get the default user agent.
+ // Inflate a WebView to get the default user agent.
LayoutInflater inflater = getActivity().getLayoutInflater();
- // `@SuppressLint("InflateParams")` removes the warning about using `null` as the `ViewGroup`, which in this case makes sense because we don't want to display `bare_webview` on the screen.
+ // `@SuppressLint("InflateParams")` removes the warning about using `null` as the `ViewGroup`, which in this case makes sense because the `bare_webview` will not be displayed.
@SuppressLint("InflateParams") View bareWebViewLayout = inflater.inflate(R.layout.bare_webview, null, false);
final WebView bareWebView = bareWebViewLayout.findViewById(R.id.bare_webview);
// Set the status of the `Clear and Exit` preferences.
clearCookiesPreference.setEnabled(!clearEverything);
clearDomStoragePreference.setEnabled(!clearEverything);
- clearFormDataPreference.setEnabled(!clearEverything);
+ clearFormDataPreference.setEnabled(!clearEverything); // The form data line can be removed once the minimum API is >= 26.
clearCachePreference.setEnabled(!clearEverything);
// Set the homepage URL as the summary text for the homepage preference.
}
}
- // Set the save form data icon.
- if (savedPreferences.getBoolean("save_form_data_enabled", false)) {
- saveFormDataPreference.setIcon(R.drawable.form_data_enabled);
- } else {
- if (MainWebViewActivity.darkTheme) {
- saveFormDataPreference.setIcon(R.drawable.form_data_disabled_dark);
+ // Set the save form data icon if API < 26. Save form data has no effect on API >= 26.
+ if (Build.VERSION.SDK_INT < 26) {
+ if (savedPreferences.getBoolean("save_form_data_enabled", false)) {
+ saveFormDataPreference.setIcon(R.drawable.form_data_enabled);
} else {
- saveFormDataPreference.setIcon(R.drawable.form_data_disabled_light);
+ if (MainWebViewActivity.darkTheme) {
+ saveFormDataPreference.setIcon(R.drawable.form_data_disabled_dark);
+ } else {
+ saveFormDataPreference.setIcon(R.drawable.form_data_disabled_light);
+ }
}
}
clearDomStoragePreference.setIcon(R.drawable.dom_storage_warning);
}
- // Set the clear form data preference icon.
- if (clearEverything || savedPreferences.getBoolean("clear_form_data", true)) {
- if (MainWebViewActivity.darkTheme) {
- clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
+ // 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) {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
+ } else {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
+ }
} else {
- clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
+ clearFormDataPreference.setIcon(R.drawable.form_data_warning);
}
- } else {
- clearFormDataPreference.setIcon(R.drawable.form_data_warning);
}
// Set the clear cache preference icon.
}
break;
+ // Save form data can be removed once the minimum API >= 26.
case "save_form_data_enabled":
// Update the icon.
if (sharedPreferences.getBoolean("save_form_data_enabled", false)) {
// Update the status of the `Clear and Exit` preferences.
clearCookiesPreference.setEnabled(!newClearEverythingBoolean);
clearDomStoragePreference.setEnabled(!newClearEverythingBoolean);
- clearFormDataPreference.setEnabled(!newClearEverythingBoolean);
+ clearFormDataPreference.setEnabled(!newClearEverythingBoolean); // This line can be removed once the minimum API >= 26.
clearCachePreference.setEnabled(!newClearEverythingBoolean);
// Update the `clearEverythingPreference` icon.
clearDomStoragePreference.setIcon(R.drawable.dom_storage_warning);
}
- // Update the `clearFormDataPreference` icon.
- if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_form_data", true)) {
- if (MainWebViewActivity.darkTheme) {
- clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
+ // 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) {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
+ } else {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
+ }
} else {
- clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
+ clearFormDataPreference.setIcon(R.drawable.form_data_warning);
}
- } else {
- clearFormDataPreference.setIcon(R.drawable.form_data_warning);
}
// Update the `clearCachePreference` icon.
}
break;
+ // This section can be removed once the minimum API >= 26.
case "clear_form_data":
// Update the icon.
if (sharedPreferences.getBoolean("clear_form_data", true)) {
public static final String ENABLE_FIRST_PARTY_COOKIES = "enablefirstpartycookies";
public static final String ENABLE_THIRD_PARTY_COOKIES = "enablethirdpartycookies";
public static final String ENABLE_DOM_STORAGE = "enabledomstorage";
- public static final String ENABLE_FORM_DATA = "enableformdata";
+ public static final String ENABLE_FORM_DATA = "enableformdata"; // Form data can be removed once the minimum API >= 26.
public static final String ENABLE_EASYLIST = "enableeasylist";
public static final String ENABLE_EASYPRIVACY = "enableeasyprivacy";
public static final String ENABLE_FANBOYS_ANNOYANCE_LIST = "enablefanboysannoyancelist";
boolean firstPartyCookiesEnabled = sharedPreferences.getBoolean("first_party_cookies_enabled", false);
boolean thirdPartyCookiesEnabled = sharedPreferences.getBoolean("third_party_cookies_enabled", false);
boolean domStorageEnabled = sharedPreferences.getBoolean("dom_storage_enabled", false);
- boolean saveFormDataEnabled = sharedPreferences.getBoolean("save_form_data_enabled", false);
+ boolean saveFormDataEnabled = sharedPreferences.getBoolean("save_form_data_enabled", false); // Form data can be removed once the minimum API >= 26.
boolean easyListEnabled = sharedPreferences.getBoolean("easylist", true);
boolean easyPrivacyEnabled = sharedPreferences.getBoolean("easyprivacy", true);
boolean fanboyAnnoyanceListEnabled = sharedPreferences.getBoolean("fanboy_annoyance_list", true);
domainContentValues.put(ENABLE_FIRST_PARTY_COOKIES, firstPartyCookiesEnabled);
domainContentValues.put(ENABLE_THIRD_PARTY_COOKIES, thirdPartyCookiesEnabled);
domainContentValues.put(ENABLE_DOM_STORAGE, domStorageEnabled);
- domainContentValues.put(ENABLE_FORM_DATA, saveFormDataEnabled);
+ domainContentValues.put(ENABLE_FORM_DATA, saveFormDataEnabled); // Form data can be removed once the minimum API >= 26.
domainContentValues.put(ENABLE_EASYLIST, easyListEnabled);
domainContentValues.put(ENABLE_EASYPRIVACY, easyPrivacyEnabled);
domainContentValues.put(ENABLE_FANBOYS_ANNOYANCE_LIST, fanboyAnnoyanceListEnabled);
domainContentValues.put(ENABLE_FIRST_PARTY_COOKIES, firstPartyCookiesEnabled);
domainContentValues.put(ENABLE_THIRD_PARTY_COOKIES, thirdPartyCookiesEnabled);
domainContentValues.put(ENABLE_DOM_STORAGE, domStorageEnabled);
- domainContentValues.put(ENABLE_FORM_DATA, formDataEnabled);
+ domainContentValues.put(ENABLE_FORM_DATA, formDataEnabled); // Form data can be removed once the minimum API >= 26.
domainContentValues.put(ENABLE_EASYLIST, easyListEnabled);
domainContentValues.put(ENABLE_EASYPRIVACY, easyPrivacyEnabled);
domainContentValues.put(ENABLE_FANBOYS_ANNOYANCE_LIST, fanboysAnnoyanceEnabled);
domainContentValues.put(ENABLE_FIRST_PARTY_COOKIES, firstPartyCookiesEnabled);
domainContentValues.put(ENABLE_THIRD_PARTY_COOKIES, thirdPartyCookiesEnabled);
domainContentValues.put(ENABLE_DOM_STORAGE, domStorageEnabled);
- domainContentValues.put(ENABLE_FORM_DATA, formDataEnabled);
+ domainContentValues.put(ENABLE_FORM_DATA, formDataEnabled); // Form data can be removed once the minimum API >= 26.
domainContentValues.put(ENABLE_EASYLIST, easyListEnabled);
domainContentValues.put(ENABLE_EASYPRIVACY, easyPrivacyEnabled);
domainContentValues.put(ENABLE_FANBOYS_ANNOYANCE_LIST, fanboysAnnoyanceEnabled);
<string name="swipe_to_refresh_preference">Herunterziehen zum Aktualisieren</string>
<string name="swipe_to_refresh_summary">Einige Websites funktionieren nicht, wenn "Herunterziehen zum Aktualisieren" eingeschaltet ist.</string>
<string name="display_additional_app_bar_icons">Weitere Icons in der Titelleiste</string>
- <string name="display_additional_app_bar_icons_summary">Icons zum Umschalten von Cookies, DOM-Speicher und Formulardaten neben der Adresszeile anzeigen, wenn noch Platz dafür da ist.</string>
<!-- Download Location -->
<string name="download_location">Download-Zielordner</string>
<string name="swipe_to_refresh_preference">Deslizar para actualizar</string>
<string name="swipe_to_refresh_summary">Algunas webs no funcionan bien si la opción deslizar para actualizar está habilitada.</string>
<string name="display_additional_app_bar_icons">Mostrar iconos adicionales en la barra de aplicación</string>
- <string name="display_additional_app_bar_icons_summary">Mostrar iconos para alternar entre cookies, almacenamiento DOM, y datos de formulario en la barra de aplicación, si hay espacio.</string>
+ <string name="display_additional_app_bar_icons_summary">Mostrar iconos en la barra de aplicaciones para refrescar el WebView y, si hay espacio, para alternar entre cookies y almacenamiento DOM.</string>
<string name="dark_theme">Tema oscuro</string>
<string name="dark_theme_summary">Cambiar el tema reiniciará Navegador Privado.</string>
<string name="night_mode">Modo noche</string>
<string name="swipe_to_refresh_preference">Потянуть для обновления</string>
<string name="swipe_to_refresh_summary">Некоторые веб-сайты могут работать некорректно при включении данной опции.</string>
<string name="display_additional_app_bar_icons">Отображать дополнительные значки на панели приложения</string>
- <string name="display_additional_app_bar_icons_summary">Ð\9eÑ\82обÑ\80ажение знаÑ\87ков длÑ\8f пеÑ\80еклÑ\8eÑ\87ениÑ\8f Ñ\84айлов cookie, Ñ\85Ñ\80анилиÑ\89а DOM и даннÑ\8bÑ\85 Ñ\84оÑ\80мÑ\8b на панели пÑ\80иложениÑ\8f пÑ\80и налиÑ\87ии меÑ\81Ñ\82а.</string>
+ <string name="display_additional_app_bar_icons_summary">Ð\9eÑ\82обÑ\80ажаÑ\82Ñ\8c знаÑ\87ки на панели пÑ\80иложениÑ\8f длÑ\8f обновлениÑ\8f WebView и, пÑ\80и налиÑ\87ии меÑ\81Ñ\82а, длÑ\8f пеÑ\80еклÑ\8eÑ\87ениÑ\8f Ñ\84айлов cookie и Ñ\85Ñ\80анилиÑ\89а DOM</string>
<string name="dark_theme">Темная тема</string>
<string name="dark_theme_summary">Изменение темы перезапускает Privacy Browser.</string>
<string name="night_mode">Ночной режим</string>
<string name="third_party_cookies_disabled">Third-Party Cookies disabled</string>
<string name="dom_storage_enabled">DOM Storage enabled</string>
<string name="dom_storage_disabled">DOM Storage disabled</string>
- <string name="form_data_enabled">Form Data enabled</string>
- <string name="form_data_disabled">Form Data disabled</string>
+ <string name="form_data_enabled">Form Data enabled</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
+ <string name="form_data_disabled">Form Data disabled</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
<string name="cookies_deleted">Cookies deleted</string>
<string name="dom_storage_deleted">DOM Storage deleted</string>
<string name="form_data_deleted">Form Data deleted</string>
<string name="first_party_cookies">First-Party Cookies</string>
<string name="third_party_cookies">Third-Party Cookies</string>
<string name="dom_storage">DOM Storage</string>
- <string name="form_data">Form Data</string>
- <string name="clear_data">Clear Data</string>
+ <string name="form_data">Form Data</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
+ <string name="clear_data">Clear Data</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
<string name="clear_cookies">Clear Cookies</string>
<string name="clear_dom_storage">Clear DOM Storage</string>
<string name="clear_form_data">Clear Form Data</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>
<string name="dom_storage_preference_summary">JavaScript must be enabled for DOM storage to function.</string>
- <string name="save_form_data_preference">Enable saving of form data by default</string>
- <string name="save_form_data_preference_summary">Saved form data can auto-populate fields on websites.</string>
+ <string name="save_form_data_preference">Enable saving of form data by default</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
+ <string name="save_form_data_preference_summary">Saved form data can auto-populate fields on websites.</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
<string name="user_agent">User agent</string>
<string-array name="translated_user_agent_names">
<item>Privacy Browser</item>
<string name="translucent_navigation_bar">Translucent navigation bar</string>
<string name="translucent_navigation_bar_summary">Make the navigation bar translucent in full screen browsing mode.</string>
<string name="clear_everything">Clear everything</string>
+ <!-- The form data part of this string can be removed once the minimum API >= 26. -->
<string name="clear_everything_summary">Clears cookies, DOM storage, form data, and WebView’s cache. Then manually deletes the entire “app_webview” and “cache” directories.</string>
<string name="clear_cookies_preference">Clear cookies</string>
<string name="clear_cookies_summary">Clears first and third-party cookies.</string>
<string name="clear_dom_storage_preference">Clear DOM storage</string>
<string name="clear_dom_storage_summary">Clears DOM storage.</string>
- <string name="clear_form_data_preference">Clear form data</string>
- <string name="clear_form_data_summary">Clears form data.</string>
+ <string name="clear_form_data_preference">Clear form data</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
+ <string name="clear_form_data_summary">Clears form data.</string> <!-- The form data strings can be removed once the minimum API >= 26. -->
<string name="clear_cache">Clear cache</string>
<string name="clear_cache_summary">Clears WebView’s cache.</string>
<string name="general">General</string>
android:summary="@string/dom_storage_preference_summary"
android:defaultValue="false" />
+ <!-- Save form data can be removed once the minimum API >= 26. -->
<SwitchPreference
android:key="save_form_data_enabled"
android:title="@string/save_form_data_preference"
</PreferenceCategory>
<PreferenceCategory
- android:key="clean_and_exit"
+ android:key="clear_and_exit"
android:title="@string/clear_and_exit" >
<SwitchPreference