+ // Set the EasyList status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+ if (easyListEnabledInt == 1) { // EasyList is on.
+ // Turn the switch on.
+ easyListSwitch.setChecked(true);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_dark));
+ } else {
+ easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_light));
+ }
+ } else { // EasyList is off.
+ // Turn the switch off.
+ easyListSwitch.setChecked(false);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_dark));
+ } else {
+ easyListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_light));
+ }
+ }
+
+ // Set the EasyPrivacy status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+ if (easyPrivacyEnabledInt == 1) { // EasyPrivacy is on.
+ // Turn the switch on.
+ easyPrivacySwitch.setChecked(true);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_dark));
+ } else {
+ easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_light));
+ }
+ } else { // EasyPrivacy is off.
+ // Turn the switch off.
+ easyPrivacySwitch.setChecked(false);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_dark));
+ } else {
+ easyPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_light));
+ }
+ }
+
+ // Set the Fanboy's Annoyance List status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+ if (fanboysAnnoyanceListInt == 1) { // Fanboy's Annoyance List is on.
+ // Turn the switch on.
+ fanboysAnnoyanceListSwitch.setChecked(true);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
+ } else {
+ fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
+ }
+ } else { // Fanboy's Annoyance List is off.
+ // Turn the switch off.
+ fanboysAnnoyanceListSwitch.setChecked(false);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
+ } else {
+ fanboysAnnoyanceListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
+ }
+ }
+
+ // Only enable Fanboy's Social Blocking List if Fanboy's Annoyance List is off.
+ if (fanboysAnnoyanceListInt == 0) { // Fanboy's Annoyance List is on.
+ // Enable Fanboy's Social Blocking List. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+ if (fanboysSocialBlockingListInt == 1) { // Fanboy's Social Blocking List is on.
+ // Enable the switch and turn it on.
+ fanboysSocialBlockingListSwitch.setEnabled(true);
+ fanboysSocialBlockingListSwitch.setChecked(true);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_dark));
+ } else {
+ fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_light));
+ }
+ } else { // Fanboy's Social Blocking List is off.
+ // Enable the switch but turn it off.
+ fanboysSocialBlockingListSwitch.setEnabled(true);
+ fanboysSocialBlockingListSwitch.setChecked(false);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_dark));
+ } else {
+ fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_light));
+ }
+ }
+ } else { // Fanboy's Annoyance List is on.
+ // Disable Fanboy's Social Blocking List. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
+ if (fanboysSocialBlockingListInt == 1) { // Fanboy's Social Blocking List is on.
+ // Disable the switch but turn it on.
+ fanboysSocialBlockingListSwitch.setEnabled(false);
+ fanboysSocialBlockingListSwitch.setChecked(true);
+ } else { // Fanboy's Social Blocking List is off.
+ // Disable the switch and turn it off.
+ fanboysSocialBlockingListSwitch.setEnabled(false);
+ fanboysSocialBlockingListSwitch.setChecked(false);
+ }
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_dark));
+ } else {
+ fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_light));
+ }
+ }
+
+ // Inflated a WebView to get the default user agent.
+ // `@SuppressLint("InflateParams")` removes the warning about using `null` as the `ViewGroup`, which in this case makes sense because the bare WebView should not be displayed on the screen.