Skip to content

Commit

Permalink
set eventcolor, loaded eventColorKey for event
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Wolf committed Aug 12, 2024
1 parent 75ee949 commit 72b58f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ class CalendarDelegate(binding: ActivityPluginBinding?, context: Context) :
values.put(Events.EVENT_END_TIMEZONE, endTimeZone)
values.put(Events.DURATION, duration)
values.put(Events.EVENT_COLOR_KEY, event.eventColorKey)
values.put(Events.EVENT_COLOR, event.eventColor)
return values
}

Expand Down Expand Up @@ -942,6 +943,7 @@ class CalendarDelegate(binding: ActivityPluginBinding?, context: Context) :
val availability = parseAvailability(cursor.getInt(Cst.EVENT_PROJECTION_AVAILABILITY_INDEX))
val eventStatus = parseEventStatus(cursor.getInt(Cst.EVENT_PROJECTION_STATUS_INDEX))
val eventColor = cursor.getInt(Cst.EVENT_PROJECTION_EVENT_COLOR_INDEX)
val eventColorKey = cursor.getInt(Cst.EVENT_PROJECTION_EVENT_COLOR_KEY_INDEX)
val event = Event()
event.eventTitle = title ?: "New Event"
event.eventId = eventId.toString()
Expand All @@ -958,6 +960,7 @@ class CalendarDelegate(binding: ActivityPluginBinding?, context: Context) :
event.availability = availability
event.eventStatus = eventStatus
event.eventColor = if (eventColor == 0) null else eventColor
event.eventColorKey = if (eventColorKey == 0) null else eventColorKey

return event
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Constants {
const val EVENT_PROJECTION_AVAILABILITY_INDEX: Int = 13
const val EVENT_PROJECTION_STATUS_INDEX: Int = 14
const val EVENT_PROJECTION_EVENT_COLOR_INDEX: Int = 15
const val EVENT_PROJECTION_EVENT_COLOR_KEY_INDEX: Int = 16

val EVENT_PROJECTION: Array<String> = arrayOf(
CalendarContract.Instances.EVENT_ID,
Expand All @@ -68,7 +69,8 @@ class Constants {
CalendarContract.Events.EVENT_END_TIMEZONE,
CalendarContract.Events.AVAILABILITY,
CalendarContract.Events.STATUS,
CalendarContract.Events.EVENT_COLOR
CalendarContract.Events.EVENT_COLOR,
CalendarContract.Events.EVENT_COLOR_KEY
)

const val EVENT_INSTANCE_DELETION_ID_INDEX: Int = 0
Expand Down

0 comments on commit 72b58f2

Please sign in to comment.