fetch the caldav calendar color too

This commit is contained in:
tibbi 2017-08-13 13:09:32 +02:00
parent 5f9a13ee14
commit ef25f7d352
2 changed files with 5 additions and 3 deletions

View File

@ -242,7 +242,8 @@ fun Context.getCalDAVCalendars(): List<CalDAVCalendar> {
CalendarContract.Calendars._ID, CalendarContract.Calendars._ID,
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
CalendarContract.Calendars.ACCOUNT_NAME, CalendarContract.Calendars.ACCOUNT_NAME,
CalendarContract.Calendars.OWNER_ACCOUNT) CalendarContract.Calendars.OWNER_ACCOUNT,
CalendarContract.Calendars.CALENDAR_COLOR)
var cursor: Cursor? = null var cursor: Cursor? = null
try { try {
@ -252,7 +253,8 @@ fun Context.getCalDAVCalendars(): List<CalDAVCalendar> {
val displayName = cursor.getStringValue(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME) val displayName = cursor.getStringValue(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME)
val accountName = cursor.getStringValue(CalendarContract.Calendars.ACCOUNT_NAME) val accountName = cursor.getStringValue(CalendarContract.Calendars.ACCOUNT_NAME)
val ownerName = cursor.getStringValue(CalendarContract.Calendars.OWNER_ACCOUNT) val ownerName = cursor.getStringValue(CalendarContract.Calendars.OWNER_ACCOUNT)
val calendar = CalDAVCalendar(id, displayName, accountName, ownerName) val color = cursor.getIntValue(CalendarContract.Calendars.CALENDAR_COLOR)
val calendar = CalDAVCalendar(id, displayName, accountName, ownerName, color)
calendars.add(calendar) calendars.add(calendar)
} }
} finally { } finally {

View File

@ -1,3 +1,3 @@
package com.simplemobiletools.calendar.models package com.simplemobiletools.calendar.models
data class CalDAVCalendar(val id: Long, val displayName: String, val accountName: String, val ownerName: String) data class CalDAVCalendar(val id: Long, val displayName: String, val accountName: String, val ownerName: String, val color: Int)