- case "javascript_disabled_search":
- String newJavaScriptDisabledSearchString = sharedPreferences.getString("javascript_disabled_search", "https://duckduckgo.com/html/?q=");
- if (newJavaScriptDisabledSearchString.equals("Custom URL")) { // Set the summary text to `R.string.custom_url`, which is translated.
- javaScriptDisabledSearchPreference.setSummary(R.string.custom_url);
- } else { // Set the new search URL as the summary text for the JavaScript-disabled search preference.
- javaScriptDisabledSearchPreference.setSummary(newJavaScriptDisabledSearchString);
- }
-
- // Enable or disable javaScriptDisabledSearchCustomURLPreference.
- javaScriptDisabledSearchCustomURLPreference.setEnabled(newJavaScriptDisabledSearchString.equals("Custom URL"));
- break;
-
- case "javascript_disabled_search_custom_url":
- // Set the new custom search URL as the summary text for `javascript_disabled_search_custom_url`. The default is `""`.
- javaScriptDisabledSearchCustomURLPreference.setSummary(sharedPreferences.getString("javascript_disabled_search_custom_url", ""));
- break;
-
- case "javascript_enabled_search":
- String newJavaScriptEnabledSearchString = sharedPreferences.getString("javascript_enabled_search", "https://duckduckgo.com/?q=");
- if (newJavaScriptEnabledSearchString.equals("Custom URL")) { // Set the summary text to `R.string.custom_url`, which is translated.
- javaScriptEnabledSearchPreference.setSummary(R.string.custom_url);
- } else { // Set the new search URL as the summary text for the JavaScript-enabled search preference..
- javaScriptEnabledSearchPreference.setSummary(newJavaScriptEnabledSearchString);
- }
-
- // Enable or disable javaScriptEnabledSearchCustomURLPreference.
- javaScriptEnabledSearchCustomURLPreference.setEnabled(newJavaScriptEnabledSearchString.equals("Custom URL"));
- break;
-
- case "javascript_enabled_search_custom_url":
- // Set the new custom search URL as the summary text for `javascript_enabled_search_custom_url`. The default is `""`.
- javaScriptEnabledSearchCustomURLPreference.setSummary(sharedPreferences.getString("javascript_enabled_search_custom_url", ""));
- break;
-
- case "enable_full_screen_browsing_mode":
- boolean newFullScreenBrowsingModeEnabled = sharedPreferences.getBoolean("enable_full_screen_browsing_mode", false);
- if (newFullScreenBrowsingModeEnabled) {
- // Enable `hideSystemBarsPreference`.
- hideSystemBarsPreference.setEnabled(true);
-
- // Only enable `transparent_navigation_bar` if `hide_system_bars` is `false`.
- translucentNavigationBarPreference.setEnabled(!sharedPreferences.getBoolean("hide_system_bars", false));