Update SettingsActivity.kt

This commit is contained in:
Tibor Kaputa 2021-11-23 12:28:46 +01:00 committed by GitHub
parent 3a70d1ab40
commit cd3a574aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -345,12 +345,15 @@ class SettingsActivity : SimpleActivity() {
private fun setupHighlightWeekends() {
settings_highlight_weekends.isChecked = config.highlightWeekends
settings_highlight_weekends_color_holder.beVisibleIf(config.highlightWeekends)
setupHighlightWeekendColorBackground()
settings_highlight_weekends_holder.setOnClickListener {
settings_highlight_weekends.toggle()
config.highlightWeekends = settings_highlight_weekends.isChecked
settings_highlight_weekends_color_holder.beVisibleIf(config.highlightWeekends)
setupHighlightWeekendColorBackground()
}
}
private fun setupHighlightWeekendsColor() {
settings_highlight_weekends_color.setFillWithStroke(config.highlightWeekendsColor, config.backgroundColor)
settings_highlight_weekends_color_holder.setOnClickListener {
@ -363,6 +366,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupHighlightWeekendColorBackground() {
if (settings_highlight_weekends_color_holder.isVisible()) {
settings_highlight_weekends_holder.background = resources.getDrawable(R.drawable.ripple_background, theme)
} else {
settings_highlight_weekends_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme)
}
}
private fun setupDeleteAllEvents() {
settings_delete_all_events_holder.setOnClickListener {
ConfirmationDialog(this, messageId = R.string.delete_all_events_confirmation) {