Add controls for form data. Fixes https://redmine.stoutner.com/issues/29
[PrivacyBrowser.git] / app / src / main / java / com / stoutner / privacybrowser / SettingsFragment.java
index 132de65cf031d8e8851645cc55676d50d5a06d94..2afa9e789437830ef7dacf4f2c5c4c5856af33b6 100644 (file)
@@ -189,6 +189,19 @@ public class SettingsFragment extends PreferenceFragment {
                         updatePrivacyIcon();
                         break;
 
+                    case "save_form_data_enabled":
+                        // Set saveFormDataEnabled to the new state.  The default is false.
+                        MainWebViewActivity.saveFormDataEnabled = sharedPreferences.getBoolean("save_form_data_enabled", false);
+
+                        // Update the checkbox in the options menu.
+                        MenuItem saveFormDataMenuItem = MainWebViewActivity.mainMenu.findItem(R.id.toggleSaveFormData);
+                        saveFormDataMenuItem.setChecked(MainWebViewActivity.saveFormDataEnabled);
+
+                        // Update mainWebView and reload the website.
+                        MainWebViewActivity.mainWebView.getSettings().setSaveFormData(MainWebViewActivity.saveFormDataEnabled);
+                        MainWebViewActivity.mainWebView.reload();
+                        break;
+
                     case "user_agent":
                         String userAgentString = sharedPreferences.getString("user_agent", "Default user agent");