+ // Set the block all third-party requests icon.
+ if (savedPreferences.getBoolean("block_all_third_party_requests", false)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_night);
+ } else {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_night);
+ } else {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_day);
+ }
+ }
+
+ // Set the Google Analytics icon according to the theme.
+ if (savedPreferences.getBoolean("google_analytics", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_night);
+ } else {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_night);
+ } else {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_day);
+ }
+ }
+
+ // Set the Facebook Click IDs icon according to the theme.
+ if (savedPreferences.getBoolean("facebook_click_ids", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_night);
+ } else {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_night);
+ } else {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_day);
+ }
+ }
+
+ // Set the Twitter AMP redirects icon according to the theme.
+ if (savedPreferences.getBoolean("twitter_amp_redirects", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_night);
+ } else {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_night);
+ } else {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_day);
+ }
+ }
+
+ // Set the search custom URL icon.
+ if (searchCustomURLPreference.isEnabled()) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_night);
+ } else {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_night);
+ } else {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_day);
+ }
+ }
+
+ // Set the Proxy icons according to the theme and status.
+ if (proxyString.equals("None")) { // Proxying is disabled.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Dark theme.
+ // Set the main proxy icon to be disabled.
+ proxyPreference.setIcon(R.drawable.proxy_disabled_night);
+
+ // Set the custom proxy URL icon to be ghosted.
+ proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_night);
+ } else { // Light theme.
+ // Set the main proxy icon to be disabled.
+ proxyPreference.setIcon(R.drawable.proxy_disabled_day);
+
+ // Set the custom proxy URL icon to be ghosted.
+ proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_day);
+ }
+ } else { // Proxying is enabled.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) { // Dark theme.
+ // Set the main proxy icon to be enabled.
+ proxyPreference.setIcon(R.drawable.proxy_enabled_night);
+
+ // Set the custom proxy URL icon according to its status.
+ if (proxyCustomUrlPreference.isEnabled()) { // Custom proxy is enabled.
+ proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_night);
+ } else { // Custom proxy is disabled.
+ proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_night);
+ }
+ } else { // Light theme.
+ // Set the main proxy icon to be enabled.
+ proxyPreference.setIcon(R.drawable.proxy_enabled_day);
+
+ // Set the custom proxy URL icon according to its status.
+ if (proxyCustomUrlPreference.isEnabled()) { // Custom proxy is enabled.
+ proxyCustomUrlPreference.setIcon(R.drawable.proxy_enabled_day);
+ } else { // Custom proxy is disabled.
+ proxyCustomUrlPreference.setIcon(R.drawable.proxy_ghosted_day);
+ }
+ }
+ }
+
+ // Set the full screen browsing mode icons.
+ if (fullScreenBrowsingMode) { // Full screen browsing mode is enabled.
+ // Set the `fullScreenBrowsingModePreference` icon according to the theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_night);
+ } else {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_day);
+ }
+
+ // Set the hide app bar icon.
+ if (savedPreferences.getBoolean("hide_app_bar", true)) { // Hide app bar is enabled.
+ // Set the icon according to the theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_night);
+ } else {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_day);
+ }
+ } else { // Hide app bar is disabled.
+ // Set the icon according to the theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_night);
+ } else {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_day);
+ }
+ }
+ } else { // Full screen browsing mode is disabled.
+ // Set the icons according to the theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_night);
+ hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_night);
+ } else {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_day);
+ hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_day);
+ }
+ }
+
+ // Set the clear everything preference icon.
+ if (clearEverything) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_night);
+ } else {
+ clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_day);
+ }
+ } else {
+ clearEverythingPreference.setIcon(R.drawable.clear_everything_disabled);
+ }
+
+ // Set the clear cookies preference icon.
+ if (clearEverything || savedPreferences.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);
+ }
+
+ // Set the clear DOM storage preference icon.
+ if (clearEverything || savedPreferences.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);
+ }
+
+ // Set the clear form data preference icon if the API < 26. It has no effect on newer versions of Android.
+ if (Build.VERSION.SDK_INT < 26) {
+ if (clearEverything || savedPreferences.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);
+ }
+ }
+
+ // Set the clear cache preference icon.
+ if (clearEverything || savedPreferences.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);
+ }
+
+ // Set 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);
+ }
+ }
+
+ // Set the open intents in new tab preference icon.
+ if (savedPreferences.getBoolean("open_intents_in_new_tab", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_night);
+ } else {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_night);
+ } else {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_day);
+ }
+ }
+
+ // Set the swipe to refresh preference icon.
+ if (savedPreferences.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);
+ }
+ }
+
+ // Set the scroll app bar preference icon.
+ if (savedPreferences.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);
+ }
+ }
+
+ // Set the display additional app bar icons preference icon.
+ if (savedPreferences.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);
+ } else {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_day);
+ }
+ }
+
+ // Set the WebView theme preference icon.
+ switch (webViewThemeEntryNumber) {
+ case 0: // The system default WebView theme is selected.
+ // Set the icon according to the app theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ webViewThemePreference.setIcon(R.drawable.webview_light_theme_day);
+ } else {
+ webViewThemePreference.setIcon(R.drawable.webview_dark_theme_night);
+ }
+ break;
+
+ case 1: // The light WebView theme is selected.
+ // Set the icon according to the app theme.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ webViewThemePreference.setIcon(R.drawable.webview_light_theme_day);
+ } else {
+ webViewThemePreference.setIcon(R.drawable.webview_light_theme_night);
+ }
+ break;
+
+ case 2: // The dark WebView theme is selected.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ webViewThemePreference.setIcon(R.drawable.webview_dark_theme_day);
+ } else {
+ webViewThemePreference.setIcon(R.drawable.webview_dark_theme_night);
+ }
+ break;
+ }
+
+ // Set the wide viewport preference icon.
+ if (savedPreferences.getBoolean("wide_viewport", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_night);
+ } else {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_night);
+ } else {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_day);
+ }
+ }
+
+ // Set the display webpage images preference icon.
+ if (savedPreferences.getBoolean("display_webpage_images", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_night);
+ } else {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_night);
+ } else {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_day);
+ }
+ }
+
+