- // Set the new search URL as the summary text for the JavaScript-disabled search preference. The default is "https://duckduckgo.com/html/?q=".
- javaScriptDisabledSearchPreference.setSummary(sharedPreferences.getString("javascript_disabled_search", "https://duckduckgo.com/html/?q="));
-
- // Enable "javascript_disabled_search_custom_url" if "javascript_disabled_search" is set to "Custom URL".
- javaScriptDisabledSearchCustomURLPreference.setEnabled(javaScriptDisabledSearchPreference.getSummary().equals("Custom URL"));
+ 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 will be translated.
+ javaScriptDisabledSearchPreference.setSummary(R.string.custom_url);
+
+ // Update the javaScriptDisabledSearchURL variable. The default is "".
+ MainWebViewActivity.javaScriptDisabledSearchURL = sharedPreferences.getString("javascript_disabled_search_custom_url", "");
+ } else { // javascript_disabled_search is not set to Custom.
+ // Set the new search URL as the summary text for the JavaScript-disabled search preference. The default is "https://duckduckgo.com/html/?q=".
+ javaScriptDisabledSearchPreference.setSummary(newJavaScriptDisabledSearchString);
+
+ // Update the javaScriptDisabledSearchURL variable. The default is "https://duckduckgo.com/html/?q=".
+ MainWebViewActivity.javaScriptDisabledSearchURL = newJavaScriptDisabledSearchString;
+ }