+ // Set the cookies icon.
+ if (sharedPreferences.getBoolean(getString(R.string.cookies_key), false)) {
+ cookiesPreference.setIcon(R.drawable.cookies_enabled);
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ cookiesPreference.setIcon(R.drawable.cookies_disabled_day);
+ } else {
+ cookiesPreference.setIcon(R.drawable.cookies_disabled_night);
+ }
+ }
+
+ // Set the DOM storage icon.
+ if (javaScriptEnabled) { // The preference is enabled.
+ if (sharedPreferences.getBoolean("dom_storage", false)) { // DOM storage is enabled.
+ domStoragePreference.setIcon(R.drawable.dom_storage_enabled);
+ } else { // DOM storage is disabled.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ domStoragePreference.setIcon(R.drawable.dom_storage_disabled_day);
+ } else {
+ domStoragePreference.setIcon(R.drawable.dom_storage_disabled_night);
+ }
+ }
+ } else { // The preference is disabled. The icon should be ghosted.
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_day);
+ } else {
+ domStoragePreference.setIcon(R.drawable.dom_storage_ghosted_night);
+ }
+ }
+
+ // Set the save form data icon if API < 26. Save form data has no effect on API >= 26.
+ if (Build.VERSION.SDK_INT < 26) {
+ if (sharedPreferences.getBoolean("save_form_data", false)) {
+ formDataPreference.setIcon(R.drawable.form_data_enabled);
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ formDataPreference.setIcon(R.drawable.form_data_disabled_day);
+ } else {
+ formDataPreference.setIcon(R.drawable.form_data_disabled_night);
+ }
+ }
+ }
+
+ // Set the custom user agent icon.
+ if (customUserAgentPreference.isEnabled()) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_day);
+ } else {
+ customUserAgentPreference.setIcon(R.drawable.custom_user_agent_enabled_night);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_day);
+ } else {
+ customUserAgentPreference.setIcon(R.drawable.custom_user_agent_ghosted_night);
+ }
+ }
+
+ // Set the incognito mode icon.
+ if (sharedPreferences.getBoolean("incognito_mode", false)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_night);
+ } else {
+ incognitoModePreference.setIcon(R.drawable.incognito_mode_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_night);
+ } else {
+ incognitoModePreference.setIcon(R.drawable.incognito_mode_disabled_day);
+ }
+ }
+
+ // Set the allow screenshots icon.
+ if (sharedPreferences.getBoolean(getString(R.string.allow_screenshots_key), false)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_day);
+ } else {
+ allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_enabled_night);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
+ allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_day);
+ } else {
+ allowScreenshotsPreference.setIcon(R.drawable.allow_screenshots_disabled_night);
+ }
+ }
+
+ // Set the EasyList icon.
+ if (sharedPreferences.getBoolean("easylist", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ easyListPreference.setIcon(R.drawable.block_ads_enabled_night);
+ } else {
+ easyListPreference.setIcon(R.drawable.block_ads_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ easyListPreference.setIcon(R.drawable.block_ads_disabled_night);
+ } else {
+ easyListPreference.setIcon(R.drawable.block_ads_disabled_day);
+ }
+ }
+
+ // Set the EasyPrivacy icon.
+ if (sharedPreferences.getBoolean("easyprivacy", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_night);
+ } else {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_night);
+ } else {
+ easyPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_day);
+ }
+ }
+
+ // Set the Fanboy lists icons.
+ if (fanboyAnnoyanceListEnabled) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_night);
+
+ // Set the Fanboy social blocking list icon.
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_night);
+ } else {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_enabled_day);
+
+ // Set the Fanboy social blocking list icon.
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_ghosted_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.social_media_disabled_night);
+
+ // Set the Fanboy social blocking list icon.
+ if (fanboySocialBlockingEnabled) {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_night);
+ } else {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_night);
+ }
+ } else {
+ // Set the Fanboy annoyance list icon.
+ fanboyAnnoyanceListPreference.setIcon(R.drawable.block_ads_disabled_day);
+
+ // Set the Fanboy social blocking list icon.
+ if (fanboySocialBlockingEnabled) {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_enabled_day);
+ } else {
+ fanboySocialBlockingListPreference.setIcon(R.drawable.social_media_disabled_day);
+ }
+ }
+ }
+
+ // Set the UltraList icon.
+ if (sharedPreferences.getBoolean("ultralist", true)){
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ ultraListPreference.setIcon(R.drawable.block_ads_enabled_night);
+ } else {
+ ultraListPreference.setIcon(R.drawable.block_ads_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ ultraListPreference.setIcon(R.drawable.block_ads_disabled_night);
+ } else {
+ ultraListPreference.setIcon(R.drawable.block_ads_disabled_day);
+ }
+ }
+
+ // Set the UltraPrivacy icon.
+ if (sharedPreferences.getBoolean("ultraprivacy", true)) {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_night);
+ } else {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_enabled_day);
+ }
+ } else {
+ if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_night);
+ } else {
+ ultraPrivacyPreference.setIcon(R.drawable.block_tracking_disabled_day);
+ }
+ }
+
+ // Set the block all third-party requests icon.
+ if (sharedPreferences.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 (sharedPreferences.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 (sharedPreferences.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 (sharedPreferences.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(ProxyHelper.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 (sharedPreferences.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);
+ }
+ }