- // Get strings from the preferences.
- 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.
- boolean javaScriptEnabledBoolean = savedPreferences.getBoolean("javascript_enabled", false);
- boolean firstPartyCookiesEnabledBoolean = savedPreferences.getBoolean("first_party_cookies_enabled", false);
- boolean thirdPartyCookiesEnabledBoolean = savedPreferences.getBoolean("third_party_cookies_enabled", false);
- boolean proxyThroughOrbotBoolean = savedPreferences.getBoolean("proxy_through_orbot", false);
- boolean fullScreenBrowsingModeBoolean = savedPreferences.getBoolean("full_screen_browsing_mode", false);
- boolean hideSystemBarsBoolean = savedPreferences.getBoolean("hide_system_bars", false);
- boolean clearEverythingBoolean = savedPreferences.getBoolean("clear_everything", true);
+ // Get Strings from the preferences.
+ String torSearchString = savedPreferences.getString("tor_search", "http://ulrn6sryqaifefld.onion/?q=");
+ String searchString = savedPreferences.getString("search", "https://searx.me/?q=");
+
+ // 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 fanboyAnnoyanceListEnabled = savedPreferences.getBoolean("fanboy_annoyance_list", true);
+ boolean fanboySocialBlockingEnabled = savedPreferences.getBoolean("fanboy_social_blocking_list", true);
+ boolean proxyThroughOrbot = savedPreferences.getBoolean("proxy_through_orbot", false);
+ boolean fullScreenBrowsingMode = savedPreferences.getBoolean("full_screen_browsing_mode", false);
+ boolean hideSystemBars = savedPreferences.getBoolean("hide_system_bars", false);
+ boolean clearEverything = savedPreferences.getBoolean("clear_everything", true);
+ final 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.
+ PreferenceCategory privacyCategory = (PreferenceCategory) findPreference("privacy");
+ PreferenceCategory clearAndExitCategory = (PreferenceCategory) findPreference("clear_and_exit");
+
+ // Remove the form data preferences.
+ privacyCategory.removePreference(saveFormDataPreference);
+ clearAndExitCategory.removePreference(clearFormDataPreference);
+ }