savedSslEndDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(savedSslEndDate));
}
- // Create a red foreground color span. The deprecated `resources.getColor` must be used until the minimum API >= 23.
- final ForegroundColorSpan redColorSpan = new ForegroundColorSpan(resources.getColor(R.color.red_a700));
-
- // Create a blue foreground color span.
+ // Create the foreground color spans.
+ final ForegroundColorSpan redColorSpan;
final ForegroundColorSpan blueColorSpan;
- // Set the blue color span according to the theme. The deprecated `resources` must be used until the minimum API >= 23.
+ // Set the color spans according to the theme. The deprecated `resources` must be used until the minimum API >= 23.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- blueColorSpan = new ForegroundColorSpan(resources.getColor(R.color.blue_400));
+ redColorSpan = new ForegroundColorSpan(resources.getColor(R.color.red_900));
+ blueColorSpan = new ForegroundColorSpan(resources.getColor(R.color.violet_500));
} else {
+ redColorSpan = new ForegroundColorSpan(resources.getColor(R.color.red_a700));
blueColorSpan = new ForegroundColorSpan(resources.getColor(R.color.blue_700));
}
if (firstPartyCookiesInt == 1) { // First-party cookies are enabled.
// Set the third-party cookies status. Once the minimum API >= 21 a selector can be used as the tint mode instead of specifying different icons.
if (thirdPartyCookiesInt == 1) { // Both first-party and third-party cookies are enabled.
+ // Set the third-party cookies switch to be checked.
thirdPartyCookiesSwitch.setChecked(true);
+
+ // Set the icon to be red.
thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
} else { // First party cookies are enabled but third-party cookies are disabled.
+ // Set the third-party cookies switch to be checked.
thirdPartyCookiesSwitch.setChecked(false);
// Set the icon according to the theme.
// 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.
- // Enable the switch and turn it on.
- fanboysSocialBlockingListSwitch.setEnabled(true);
+ // Turn on Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(true);
// Set the icon according to the theme.
fanboysSocialBlockingListImageView.setImageDrawable(resources.getDrawable(R.drawable.social_media_enabled_day));
}
} else { // Fanboy's Social Blocking List is off.
- // Enable the switch but turn it off.
- fanboysSocialBlockingListSwitch.setEnabled(true);
+ // Turn off Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(false);
// Set the icon according to the theme.
}
}
} 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.
+ // 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.
- // Disable the switch but turn it on.
- fanboysSocialBlockingListSwitch.setEnabled(false);
+ // Turn on Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(true);
} else { // Fanboy's Social Blocking List is off.
- // Disable the switch and turn it off.
- fanboysSocialBlockingListSwitch.setEnabled(false);
+ // Turn off Fanboy's Social Blocking List switch.
fanboysSocialBlockingListSwitch.setChecked(false);
}
if (defaultNightMode) { // Night mode enabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
} else { // Night mode disabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
}
case DomainsDatabaseHelper.ENABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
// Hide the night mode TextView.
case DomainsDatabaseHelper.DISABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
// Hide the night mode TextView.
// Update the third-party cookies icon.
if (thirdPartyCookiesSwitch.isChecked()) { // Third-party cookies are enabled.
+ // Set the third-party cookies icon to be red.
thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
} else { // Third-party cookies are disabled.
// Set the third-party cookies icon according to the theme.
thirdPartyCookiesSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> {
// Update the icon.
if (isChecked) {
+ // Set the third-party cookies icon to be red.
thirdPartyCookiesImageView.setImageDrawable(resources.getDrawable(R.drawable.cookies_warning));
} else {
// Update the third-party cookies icon according to the theme.
if (defaultNightMode) { // Night mode enabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
} else { // Night mode disabled by default.
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
}
case DomainsDatabaseHelper.ENABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_enabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_enabled_day));
}
// Hide `nightModeTextView`.
case DomainsDatabaseHelper.DISABLED:
// Set the icon according to the theme.
if (currentThemeStatus == Configuration.UI_MODE_NIGHT_YES) {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_night));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_night));
} else {
- nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.night_mode_disabled_day));
+ nightModeImageView.setImageDrawable(resources.getDrawable(R.drawable.webview_theme_disabled_day));
}
// Hide `nightModeTextView`.