+ // Set the form data status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons. Form data can be removed once the minimum API >= 26.
+ if (Build.VERSION.SDK_INT >= 26) { // Form data no longer applies to newer versions of Android.
+ // Hide the form data switch.
+ formDataEnabledSwitch.setVisibility(View.GONE);
+ } else { // Form data should be displayed because this is an older version of Android.
+ if (formDataEnabledInt == 1) { // Form data is on.
+ formDataEnabledSwitch.setChecked(true);
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_enabled));
+ } else { // Form data is off.
+ // Turn the form data switch to off.
+ formDataEnabledSwitch.setChecked(false);
+
+ // Set the icon according to the theme.
+ if (MainWebViewActivity.darkTheme) {
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_dark));
+ } else {
+ formDataImageView.setImageDrawable(resources.getDrawable(R.drawable.form_data_disabled_light));
+ }
+ }
+ }
+
+ // 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);
+ }