+ // Update the `clearCachePreference` icon.
+ if (newClearEverythingBoolean || sharedPreferences.getBoolean("clear_cache", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ clearCachePreference.setIcon(R.drawable.cache_cleared_night);
+ } else {
+ clearCachePreference.setIcon(R.drawable.cache_cleared_day);
+ }
+ } else {
+ clearCachePreference.setIcon(R.drawable.cache_warning);
+ }
+ break;
+
+ case "clear_cookies":
+ // Update the icon.
+ if (sharedPreferences.getBoolean("clear_cookies", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ clearCookiesPreference.setIcon(R.drawable.cookies_cleared_night);
+ } else {
+ clearCookiesPreference.setIcon(R.drawable.cookies_cleared_day);
+ }
+ } else {
+ clearCookiesPreference.setIcon(R.drawable.cookies_warning);
+ }
+ break;
+
+ case "clear_dom_storage":
+ // Update the icon.
+ if (sharedPreferences.getBoolean("clear_dom_storage", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_night);
+ } else {
+ clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_day);
+ }
+ } else {
+ clearDomStoragePreference.setIcon(R.drawable.dom_storage_warning);
+ }
+ 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)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_night);
+ } else {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_day);
+ }
+ } else {
+ clearFormDataPreference.setIcon(R.drawable.form_data_warning);
+ }
+ break;
+
+ case "clear_cache":
+ // Update the icon.
+ if (sharedPreferences.getBoolean("clear_cache", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ clearCachePreference.setIcon(R.drawable.cache_cleared_night);
+ } else {
+ clearCachePreference.setIcon(R.drawable.cache_cleared_day);
+ }
+ } else {
+ clearCachePreference.setIcon(R.drawable.cache_warning);
+ }
+ break;
+
+ case "homepage":
+ // Set the new homepage URL as the summary text for the Homepage preference.
+ homepagePreference.setSummary(sharedPreferences.getString("homepage", getString(R.string.homepage_default_value)));
+ break;
+
+ case "download_location":
+ // Get the new download location.
+ String newDownloadLocationString = sharedPreferences.getString("download_location", getString(R.string.download_location_default_value));
+
+ // Check to see if a download custom location is selected.
+ if (newDownloadLocationString.equals(downloadLocationEntryValuesStringArray[3])) { // A download custom location is selected.
+ // Set the download location summary text to be `Custom`.
+ downloadLocationPreference.setSummary(downloadLocationEntriesStringArray[3]);
+
+ // Enable the download custom location preference.
+ downloadCustomLocationPreference.setEnabled(true);
+ } else { // A download custom location is not selected.
+ // Set the download location summary text to be the download location.
+ downloadLocationPreference.setSummary(downloadLocationHelper.getDownloadLocation(context));
+
+ // Disable the download custom location.
+ downloadCustomLocationPreference.setEnabled(newDownloadLocationString.equals(downloadLocationEntryValuesStringArray[3]));
+ }
+
+ // Update the download custom location icon.
+ if (downloadCustomLocationPreference.isEnabled()) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_night);
+ } else {
+ downloadCustomLocationPreference.setIcon(R.drawable.downloads_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_night);
+ } else {
+ downloadCustomLocationPreference.setIcon(R.drawable.downloads_ghosted_day);
+ }
+ }
+ break;
+
+ case "download_custom_location":
+ // Set the new download custom location as the summary text for the preference.
+ downloadCustomLocationPreference.setSummary(sharedPreferences.getString("download_custom_location", getString(R.string.download_custom_location_default_value)));
+ break;
+
+ case "font_size":
+ // Update the font size summary text.
+ fontSizePreference.setSummary(sharedPreferences.getString("font_size", getString(R.string.font_size_default_value)) + "%");
+ break;
+
+ case "open_intents_in_new_tab":
+ // Update the icon.
+ if (sharedPreferences.getBoolean("open_intents_in_new_tab", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_dark);
+ } else {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_light);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_dark);
+ } else {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_light);
+ }
+ }
+ break;
+
+ case "swipe_to_refresh":
+ // Update the icon.
+ if (sharedPreferences.getBoolean("swipe_to_refresh", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_night);
+ } else {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_night);
+ } else {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_day);
+ }
+ }
+ break;
+
+ case "scroll_app_bar":
+ // Update the icon.
+ if (sharedPreferences.getBoolean("scroll_app_bar", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_night);
+ } else {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_night);
+ } else {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_day);
+ }
+ }
+ break;
+
+ case "display_additional_app_bar_icons":
+ // Update the icon.
+ if (sharedPreferences.getBoolean("display_additional_app_bar_icons", false)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_night);
+ } else {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_night);