mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
Properly highlight selected event color
This commit is contained in:
parent
06a6e3a3f7
commit
8cc2c85f44
@ -835,9 +835,16 @@ class EventActivity : SimpleActivity() {
|
||||
ensureBackgroundThread {
|
||||
val eventType = eventsHelper.getEventTypeWithCalDAVCalendarId(calendarId = mEventCalendarId)!!
|
||||
runOnUiThread {
|
||||
SelectEventColorDialog(activity = this, eventType = eventType, selectedColor = mEvent.color) { color ->
|
||||
mEventColor = color
|
||||
updateEventColorInfo(eventType.color)
|
||||
val selectedColor = if (mEventColor == 0) {
|
||||
eventType.color
|
||||
} else {
|
||||
mEventColor
|
||||
}
|
||||
SelectEventColorDialog(activity = this, eventType = eventType, selectedColor = selectedColor) { color ->
|
||||
if (color != eventType.color) {
|
||||
mEventColor = color
|
||||
updateEventColorInfo(eventType.color)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class SelectEventColorDialog(val activity: Activity, val eventType: EventType, v
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_select_event_color, null) as ViewGroup
|
||||
radioGroup = view.dialog_select_event_type_color_radio
|
||||
|
||||
addRadioButton(colorKey = colors.values.size.inc(), color = 0)
|
||||
addRadioButton(colorKey = colors.values.size.inc(), color = eventType.color)
|
||||
colors.forEach { (color, key) ->
|
||||
addRadioButton(key.toInt(), color)
|
||||
}
|
||||
@ -43,7 +43,7 @@ class SelectEventColorDialog(val activity: Activity, val eventType: EventType, v
|
||||
private fun addRadioButton(colorKey: Int, color: Int) {
|
||||
val view = activity.layoutInflater.inflate(R.layout.radio_button_with_color, null)
|
||||
(view.dialog_radio_button as RadioButton).apply {
|
||||
text = if (color == 0) activity.getString(R.string.default_color) else String.format("#%06X", 0xFFFFFF and color)
|
||||
text = if (color == eventType.color) activity.getString(R.string.default_color) else String.format("#%06X", 0xFFFFFF and color)
|
||||
isChecked = color == selectedColor
|
||||
id = colorKey
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user