]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Remove form data options from API >= 26. https://redmine.stoutner.com/issues/185
authorSoren Stoutner <soren@stoutner.com>
Fri, 1 Jun 2018 22:39:47 +0000 (15:39 -0700)
committerSoren Stoutner <soren@stoutner.com>
Fri, 1 Jun 2018 22:39:47 +0000 (15:39 -0700)
app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java
app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java
app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java
app/src/main/java/com/stoutner/privacybrowser/helpers/DomainsDatabaseHelper.java
app/src/main/res/values-de/strings.xml
app/src/main/res/values-es/strings.xml
app/src/main/res/values-ru/strings.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences.xml

index 77cde1fac595df1c1a782921281c846dba1c3ad0..f0a3a0a1d64ace6ed68c627ebff8f6b001d1c1b7 100644 (file)
@@ -639,7 +639,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo
         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);
@@ -660,7 +660,7 @@ public class DomainsActivity extends AppCompatActivity implements AddDomainDialo
         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();
index 3f96b721ae8bd2eff5d2f7bd21ca93aacd6d2443..933de06a1a5afe846a4bc574f6dc025e2dc61812 100644 (file)
@@ -275,7 +275,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
     // `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()`.
@@ -1076,7 +1076,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         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.
@@ -1583,11 +1583,21 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         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);
 
@@ -1612,15 +1622,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         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) {
@@ -1633,7 +1642,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         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());
 
@@ -1663,9 +1672,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         // 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());
@@ -1727,9 +1738,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
         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);
 
@@ -1886,6 +1894,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 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;
@@ -1978,6 +1987,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                         .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 -> {
@@ -2259,8 +2269,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                     }
                 }
 
-                // 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();
 
@@ -3394,6 +3404,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 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);
@@ -3449,7 +3460,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 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.
@@ -3545,7 +3560,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 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);
@@ -3560,10 +3575,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook
                 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;
index ea57bc355a0e1d9f6fea0bf81727810ac3ee593e..477ab9e321976e676458757e4950b51bd47b97cc 100644 (file)
@@ -110,8 +110,8 @@ public class DomainSettingsFragment extends Fragment {
         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);
@@ -181,7 +181,7 @@ public class DomainSettingsFragment extends Fragment {
         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));
@@ -453,19 +453,24 @@ public class DomainSettingsFragment extends Fragment {
             }
         }
 
-        // 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));
+                }
             }
         }
 
@@ -1160,20 +1165,22 @@ public class DomainSettingsFragment extends Fragment {
             }
         });
 
-        // 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) -> {
index cb0ca13e4883f6c0ad6ce26fe55c60ceb2527a5e..8e7a7112599974b504c1c3046fce6f2d773ee122 100644 (file)
@@ -26,6 +26,7 @@ import android.content.SharedPreferences;
 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;
@@ -55,7 +56,7 @@ public class SettingsFragment extends PreferenceFragment {
         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");
@@ -77,7 +78,7 @@ public class SettingsFragment extends PreferenceFragment {
         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");
@@ -96,7 +97,7 @@ public class SettingsFragment extends PreferenceFragment {
         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);
@@ -108,18 +109,29 @@ public class SettingsFragment extends PreferenceFragment {
         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);
 
@@ -201,7 +213,7 @@ public class SettingsFragment extends PreferenceFragment {
         // 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.
@@ -269,14 +281,16 @@ public class SettingsFragment extends PreferenceFragment {
             }
         }
 
-        // 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);
+                }
             }
         }
 
@@ -551,15 +565,17 @@ public class SettingsFragment extends PreferenceFragment {
             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.
@@ -749,6 +765,7 @@ public class SettingsFragment extends PreferenceFragment {
                     }
                     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)) {
@@ -1249,7 +1266,7 @@ public class SettingsFragment extends PreferenceFragment {
                     // 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.
@@ -1285,15 +1302,17 @@ public class SettingsFragment extends PreferenceFragment {
                         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.
@@ -1334,6 +1353,7 @@ public class SettingsFragment extends PreferenceFragment {
                     }
                     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)) {
index 563040a3d8aeebb0ac859943fa820324827966cd..9c94dfd2127ff687b133345b87c082f66a5c4dd9 100644 (file)
@@ -38,7 +38,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper {
     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";
@@ -259,7 +259,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper {
         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);
@@ -271,7 +271,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper {
         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);
@@ -308,7 +308,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper {
         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);
@@ -345,7 +345,7 @@ public class DomainsDatabaseHelper extends SQLiteOpenHelper {
         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);
index 292c2dcaae792cb028f8c050b54bd9893ac5725e..655387a44100a4eb1af3d418e273fcb19d9ef462 100644 (file)
         <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>
index 5cf7989fafe15f20c7b9c840934a07253710ac1d..93c0fc0b2579f7f66d72f0907ee0b8566e4b84f8 100644 (file)
         <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>
index 892b82f48d703eb8463bee937a1ff13d87ed7d35..d38edd62cf31eb12b0acb213db170fc521458cf5 100644 (file)
         <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>
index 3a2a9063db20ebe444304e33351826fd97d96a44..84a284197e254784de8d90a1629e9de7cf0c2a71 100644 (file)
@@ -39,8 +39,8 @@
     <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>
index ace949a9b597d983479e871665eaf255a42c68e3..e38eed8888d1c682f522304727a1a3fba4f74f2d 100644 (file)
@@ -47,6 +47,7 @@
             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