+ // Set the EasyList icon.
+ if (savedPreferences.getBoolean("easylist", true)) {
+ if (darkTheme) {
+ easyListPreference.setIcon(R.drawable.block_ads_enabled_dark);
+ } else {
+ easyListPreference.setIcon(R.drawable.block_ads_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ easyListPreference.setIcon(R.drawable.block_ads_disabled_dark);
+ } else {
+ easyListPreference.setIcon(R.drawable.block_ads_disabled_light);
+ }
+ }
+
+ // Set the EasyPrivacy icon.
+ if (savedPreferences.getBoolean("easyprivacy", true)) {
+ if (darkTheme) {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
+ } else {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
+ } else {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
+ }
+ }
+
+ // Set the Fanboy lists icons.
+ if (fanboyAnnoyanceListEnabled) {
+ if (darkTheme) {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_dark);
+
+ // Set the Fanboy social blocking list icon.
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_dark);
+ } else {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_light);
+
+ // Set the Fanboy social blocking list icon.
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_light);
+ }
+ } else {
+ if (darkTheme) {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_dark);
+
+ // Set the Fanboy social blocking list icon.
+ if (fanboySocialBlockingEnabled) {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_dark);
+ } else {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_dark);
+ }
+ } else {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.block_ads_disabled_light);
+
+ // Set the Fanboy social blocking list icon.
+ if (fanboySocialBlockingEnabled) {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_light);
+ } else {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_light);
+ }
+ }
+ }
+
+ // Set the UltraList icon.
+ if (savedPreferences.getBoolean("ultralist", true)){
+ if (darkTheme) {
+ ultraListPreference.setIcon(R.drawable.block_ads_enabled_dark);
+ } else {
+ ultraListPreference.setIcon(R.drawable.block_ads_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ ultraListPreference.setIcon(R.drawable.block_ads_disabled_dark);
+ } else {
+ ultraListPreference.setIcon(R.drawable.block_ads_disabled_light);
+ }
+ }
+
+ // Set the UltraPrivacy icon.
+ if (savedPreferences.getBoolean("ultraprivacy", true)) {
+ if (darkTheme) {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_dark);
+ } else {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_dark);
+ } else {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_light);
+ }
+ }
+
+ // Set the block all third-party requests icon.
+ if (savedPreferences.getBoolean("block_all_third_party_requests", false)) {
+ if (darkTheme) {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_dark);
+ } else {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_dark);
+ } else {
+ blockAllThirdPartyRequestsPreference.setIcon(R.drawable.block_all_third_party_requests_disabled_light);
+ }
+ }
+
+ // Set the Google Analytics icon according to the theme.
+ if (savedPreferences.getBoolean("google_analytics", true)) {
+ if (darkTheme) {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_dark);
+ } else {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_dark);
+ } else {
+ googleAnalyticsPreference.setIcon(R.drawable.modify_url_disabled_light);
+ }
+ }
+
+ // Set the Facebook Click IDs icon according to the theme.
+ if (savedPreferences.getBoolean("facebook_click_ids", true)) {
+ if (darkTheme) {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_dark);
+ } else {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_dark);
+ } else {
+ facebookClickIdsPreference.setIcon(R.drawable.modify_url_disabled_light);
+ }
+ }
+
+ // Set the Twitter AMP redirects icon according to the theme.
+ if (savedPreferences.getBoolean("twitter_amp_redirects", true)) {
+ if (darkTheme) {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_dark);
+ } else {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_dark);
+ } else {
+ twitterAmpRedirectsPreference.setIcon(R.drawable.modify_url_disabled_light);
+ }
+ }
+
+ // Set the Tor icons according to the theme.
+ if (proxyThroughOrbot) { // Proxying is enabled.
+ if (darkTheme) {
+ proxyThroughOrbotPreference.setIcon(R.drawable.orbot_enabled_dark);
+ torHomepagePreference.setIcon(R.drawable.home_enabled_dark);
+ torSearchPreference.setIcon(R.drawable.search_enabled_dark);
+
+ // Set the custom search icon.
+ if (torSearchCustomURLPreference.isEnabled()) {
+ torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_dark);
+ } else {
+ torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark);
+ }
+ } else {
+ proxyThroughOrbotPreference.setIcon(R.drawable.orbot_enabled_light);
+ torHomepagePreference.setIcon(R.drawable.home_enabled_light);
+ torSearchPreference.setIcon(R.drawable.search_enabled_light);
+
+ // Set the custom search icon.
+ if (torSearchCustomURLPreference.isEnabled()) {
+ torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_light);
+ } else {
+ torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light);
+ }
+ }
+ } else { // Proxying is disabled.
+ if (darkTheme) {
+ proxyThroughOrbotPreference.setIcon(R.drawable.orbot_disabled_dark);
+ torHomepagePreference.setIcon(R.drawable.home_ghosted_dark);
+ torSearchPreference.setIcon(R.drawable.search_ghosted_dark);
+ torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark);
+ } else {
+ proxyThroughOrbotPreference.setIcon(R.drawable.orbot_disabled_light);
+ torHomepagePreference.setIcon(R.drawable.home_ghosted_light);
+ torSearchPreference.setIcon(R.drawable.search_ghosted_light);
+ torSearchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light);
+ }
+ }
+
+ // Set the search custom URL icon.
+ if (searchCustomURLPreference.isEnabled()) {
+ if (darkTheme) {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_dark);
+ } else {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_dark);
+ } else {
+ searchCustomURLPreference.setIcon(R.drawable.search_custom_url_ghosted_light);
+ }
+ }
+
+ // Set the full screen browsing mode icons.
+ if (fullScreenBrowsingMode) { // Full screen browsing mode is enabled.
+ // Set the `fullScreenBrowsingModePreference` icon according to the theme.
+ if (darkTheme) {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_dark);
+ } else {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_enabled_light);
+ }
+
+ // 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 (darkTheme) {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark);
+ } else {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_enabled_light);
+ }
+ } else { // Hide app bar is disabled.
+ // Set the icon according to the theme.
+ if (darkTheme) {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark);
+ } else {
+ hideAppBarPreference.setIcon(R.drawable.app_bar_disabled_light);
+ }
+ }
+ } else { // Full screen browsing mode is disabled.
+ // Set the icons according to the theme.
+ if (darkTheme) {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_dark);
+ hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_dark);
+ } else {
+ fullScreenBrowsingModePreference.setIcon(R.drawable.full_screen_disabled_light);
+ hideAppBarPreference.setIcon(R.drawable.app_bar_ghosted_light);
+ }
+ }
+
+ // Set the clear everything preference icon.
+ if (clearEverything) {
+ if (darkTheme) {
+ clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_dark);
+ } else {
+ clearEverythingPreference.setIcon(R.drawable.clear_everything_enabled_light);
+ }
+ } else {
+ clearEverythingPreference.setIcon(R.drawable.clear_everything_disabled);
+ }
+
+ // Set the clear cookies preference icon.
+ if (clearEverything || savedPreferences.getBoolean("clear_cookies", true)) {
+ if (darkTheme) {
+ clearCookiesPreference.setIcon(R.drawable.cookies_cleared_dark);
+ } else {
+ clearCookiesPreference.setIcon(R.drawable.cookies_cleared_light);
+ }
+ } else {
+ clearCookiesPreference.setIcon(R.drawable.cookies_warning);
+ }
+
+ // Set the clear DOM storage preference icon.
+ if (clearEverything || savedPreferences.getBoolean("clear_dom_storage", true)) {
+ if (darkTheme) {
+ clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_dark);
+ } else {
+ clearDomStoragePreference.setIcon(R.drawable.dom_storage_cleared_light);
+ }
+ } 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 (darkTheme) {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_dark);
+ } else {
+ clearFormDataPreference.setIcon(R.drawable.form_data_cleared_light);
+ }
+ } else {
+ clearFormDataPreference.setIcon(R.drawable.form_data_warning);
+ }
+ }
+
+ // Set the clear cache preference icon.
+ if (clearEverything || savedPreferences.getBoolean("clear_cache", true)) {
+ if (darkTheme) {
+ clearCachePreference.setIcon(R.drawable.cache_cleared_dark);
+ } else {
+ clearCachePreference.setIcon(R.drawable.cache_cleared_light);
+ }
+ } else {
+ clearCachePreference.setIcon(R.drawable.cache_warning);
+ }
+
+ // Set the open intents in new tab preference icon.
+ if (savedPreferences.getBoolean("open_intents_in_new_tab", true)) {
+ if (darkTheme) {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_dark);
+ } else {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_dark);
+ } else {
+ openIntentsInNewTabPreference.setIcon(R.drawable.tab_disabled_light);
+ }
+ }
+
+ // Set the swipe to refresh preference icon.
+ if (savedPreferences.getBoolean("swipe_to_refresh", true)) {
+ if (darkTheme) {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_dark);
+ } else {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_dark);
+ } else {
+ swipeToRefreshPreference.setIcon(R.drawable.refresh_disabled_light);
+ }
+ }
+
+ // Set the scroll app bar preference icon.
+ if (savedPreferences.getBoolean("scroll_app_bar", true)) {
+ if (darkTheme) {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_dark);
+ } else {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_dark);
+ } else {
+ scrollAppBarPreference.setIcon(R.drawable.app_bar_disabled_light);
+ }
+ }
+
+ // Set the display additional app bar icons preference icon.
+ if (savedPreferences.getBoolean("display_additional_app_bar_icons", false)) {
+ if (darkTheme) {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_dark);
+ } else {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_dark);
+ } else {
+ displayAdditionalAppBarIconsPreference.setIcon(R.drawable.more_disabled_light);
+ }
+ }
+
+ // Set the download with external app preference icon.
+ if (savedPreferences.getBoolean("download_with_external_app", false)) {
+ if (darkTheme) {
+ downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_enabled_dark);
+ } else {
+ downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_disabled_dark);
+ } else {
+ downloadWithExternalAppPreference.setIcon(R.drawable.open_with_external_app_disabled_light);
+ }
+ }
+
+ // Set the dark theme preference icon.
+ if (savedPreferences.getBoolean("dark_theme", false)) {
+ darkThemePreference.setIcon(R.drawable.theme_dark);
+ } else {
+ darkThemePreference.setIcon(R.drawable.theme_light);
+ }
+
+ // Set the night mode preference icon.
+ if (nightMode) {
+ if (darkTheme) {
+ nightModePreference.setIcon(R.drawable.night_mode_enabled_dark);
+ } else {
+ nightModePreference.setIcon(R.drawable.night_mode_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ nightModePreference.setIcon(R.drawable.night_mode_disabled_dark);
+ } else {
+ nightModePreference.setIcon(R.drawable.night_mode_disabled_light);
+ }
+ }
+
+ // Set the wide viewport preference icon.
+ if (savedPreferences.getBoolean("wide_viewport", true)) {
+ if (darkTheme) {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_dark);
+ } else {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_dark);
+ } else {
+ wideViewportPreference.setIcon(R.drawable.wide_viewport_disabled_light);
+ }
+ }
+
+ // Set the display webpage images preference icon.
+ if (savedPreferences.getBoolean("display_webpage_images", true)) {
+ if (darkTheme) {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_dark);
+ } else {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_enabled_light);
+ }
+ } else {
+ if (darkTheme) {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_dark);
+ } else {
+ displayWebpageImagesPreference.setIcon(R.drawable.images_disabled_light);
+ }
+ }
+
+