- // 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 switch.
- fanboysSocialBlockingListSwitch.setEnabled(true);
-
- // 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.
- // Turn on Fanboy's Social Blocking List switch.
- fanboysSocialBlockingListSwitch.setChecked(true);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_night));
- } else {
- fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day));
- }
- } else { // Fanboy's Social Blocking List is off.
- // Turn off Fanboy's Social Blocking List switch.
- fanboysSocialBlockingListSwitch.setChecked(false);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_night));
- } else {
- fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_disabled_day));
- }
- }
- } else { // Fanboy's Annoyance List is on.
- // Disable Fanboy's Social Blocking List switch.
- fanboysSocialBlockingListSwitch.setEnabled(false);
-
- // Handle the status of 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.
- // Turn on Fanboy's Social Blocking List switch.
- fanboysSocialBlockingListSwitch.setChecked(true);
- } else { // Fanboy's Social Blocking List is off.
- // Turn off Fanboy's Social Blocking List switch.
- fanboysSocialBlockingListSwitch.setChecked(false);
- }
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_night));
- } else {
- fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_ghosted_day));
- }
- }
-
- // Set the UltraList status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- if (ultraListInt == 1) { // UltraList is on.
- // Turn the switch on.
- ultraListSwitch.setChecked(true);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_night));
- } else {
- ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_enabled_day));
- }
- } else { // UltraList is off.
- // Turn the switch off.
- ultraListSwitch.setChecked(false);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_night));
- } else {
- ultraListImageView.setImageDrawable(resources.getDrawable(R.drawable.block_ads_disabled_day));
- }
- }
-
- // Set the UltraPrivacy status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- if (ultraPrivacyInt == 1) { // UltraPrivacy is on.
- // Turn the switch on.
- ultraPrivacySwitch.setChecked(true);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_night));
- } else {
- ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_enabled_day));
- }
- } else { // EasyPrivacy is off.
- // Turn the switch off.
- ultraPrivacySwitch.setChecked(false);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_night));
- } else {
- ultraPrivacyImageView.setImageDrawable(resources.getDrawable(R.drawable.block_tracking_disabled_day));
- }
- }
-
- // Set the third-party resource blocking status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
- if (blockAllThirdPartyRequestsInt == 1) { // Blocking all third-party requests is on.
- // Turn the switch on.
- blockAllThirdPartyRequestsSwitch.setChecked(true);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_night));
- } else {
- blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_enabled_day));
- }
- } else { // Blocking all third-party requests is off.
- // Turn the switch off.
- blockAllThirdPartyRequestsSwitch.setChecked(false);
-
- // Set the icon according to the theme.
- if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_night));
- } else {
- blockAllThirdPartyRequestsImageView.setImageDrawable(resources.getDrawable(R.drawable.block_all_third_party_requests_disabled_day));
- }
- }
+ // Set the switch positions.
+ easyListSwitch.setChecked(easyListInt == 1);
+ easyPrivacySwitch.setChecked(easyPrivacyInt == 1);
+ fanboysAnnoyanceListSwitch.setChecked(fanboysAnnoyanceListInt == 1);
+ fanboysSocialBlockingListSwitch.setChecked(fanboysSocialBlockingListInt == 1);
+ ultraListSwitch.setChecked(ultraListInt == 1);
+ ultraPrivacySwitch.setChecked(ultraPrivacyInt == 1);
+ blockAllThirdPartyRequestsSwitch.setChecked(blockAllThirdPartyRequestsInt == 1);
+
+ // Set the switch icon colors.
+ easyListImageView.setSelected(easyListInt == 1);
+ easyPrivacyImageView.setSelected(easyPrivacyInt == 1);
+ fanboysAnnoyanceListImageView.setSelected(fanboysAnnoyanceListInt == 1);
+ fanboysSocialBlockingListImageView.setSelected(fanboysSocialBlockingListInt == 1);
+ ultraListImageView.setSelected(ultraListInt == 1);
+ ultraPrivacyImageView.setSelected(ultraPrivacyInt == 1);
+ blockAllThirdPartyRequestsImageView.setSelected(blockAllThirdPartyRequestsInt == 1);
+
+ // Set Fanboy's Social Blocking List switch status based on the Annoyance List status.
+ fanboysSocialBlockingListSwitch.setEnabled(fanboysAnnoyanceListInt == 0);
+
+ // Set the Social Blocking List icon ghosted status based on the Annoyance List status.
+ fanboysSocialBlockingListImageView.setEnabled(fanboysAnnoyanceListInt == 0);