reorder Event fields, move location up
This commit is contained in:
parent
5ec19501f3
commit
fe31ba5622
|
@ -201,9 +201,9 @@ class CalDAVHandler(val context: Context) {
|
|||
val importId = getCalDAVEventImportId(calendarId, id)
|
||||
val source = "$CALDAV-$calendarId"
|
||||
val repeatRule = Parser().parseRepeatInterval(rrule, startTS)
|
||||
val event = Event(null, startTS, endTS, title, description, reminders.getOrElse(0) { -1 },
|
||||
val event = Event(null, startTS, endTS, title, location, description, reminders.getOrElse(0) { -1 },
|
||||
reminders.getOrElse(1) { -1 }, reminders.getOrElse(2) { -1 }, repeatRule.repeatInterval,
|
||||
importId, allDay, repeatRule.repeatLimit, repeatRule.repeatRule, eventTypeId, source = source, location = location)
|
||||
importId, allDay, repeatRule.repeatLimit, repeatRule.repeatRule, eventTypeId, source = source)
|
||||
|
||||
if (event.getIsAllDay()) {
|
||||
event.startTS = Formatter.getShiftedImportTimestamp(event.startTS)
|
||||
|
|
|
@ -863,6 +863,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
val repeatInterval = cursor.getIntValue(COL_REPEAT_INTERVAL)
|
||||
var repeatRule = cursor.getIntValue(COL_REPEAT_RULE)
|
||||
val title = cursor.getStringValue(COL_TITLE)
|
||||
val location = cursor.getStringValue(COL_LOCATION)
|
||||
val description = cursor.getStringValue(COL_DESCRIPTION)
|
||||
val importId = cursor.getStringValue(COL_IMPORT_ID) ?: ""
|
||||
val flags = cursor.getIntValue(COL_FLAGS)
|
||||
|
@ -870,15 +871,14 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
val eventType = cursor.getLongValue(COL_EVENT_TYPE)
|
||||
val lastUpdated = cursor.getLongValue(COL_LAST_UPDATED)
|
||||
val source = cursor.getStringValue(COL_EVENT_SOURCE)
|
||||
val location = cursor.getStringValue(COL_LOCATION)
|
||||
val color = eventTypeColors.get(eventType)!!
|
||||
|
||||
if (repeatInterval > 0 && repeatRule == 0 && (repeatInterval % MONTH == 0 || repeatInterval % YEAR == 0)) {
|
||||
repeatRule = REPEAT_SAME_DAY
|
||||
}
|
||||
|
||||
val event = Event(id, startTS, endTS, title, description, reminder1Minutes, reminder2Minutes, reminder3Minutes,
|
||||
repeatInterval, importId, flags, repeatLimit, repeatRule, eventType, 0, lastUpdated, source, color, location)
|
||||
val event = Event(id, startTS, endTS, title, location, description, reminder1Minutes, reminder2Minutes, reminder3Minutes,
|
||||
repeatInterval, importId, flags, repeatLimit, repeatRule, eventType, 0, lastUpdated, source, color)
|
||||
event.updateIsPastEvent()
|
||||
|
||||
events.add(event)
|
||||
|
|
|
@ -140,10 +140,9 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||
|
||||
val eventType = eventTypes.firstOrNull { it.id == curEventTypeId }
|
||||
val source = if (calDAVCalendarId == 0 || eventType?.isSyncedEventType() == false) SOURCE_IMPORTED_ICS else "$CALDAV-$calDAVCalendarId"
|
||||
val event = Event(0, curStart, curEnd, curTitle, curDescription, curReminderMinutes.getOrElse(0) { -1 },
|
||||
val event = Event(0, curStart, curEnd, curTitle, curLocation, curDescription, curReminderMinutes.getOrElse(0) { -1 },
|
||||
curReminderMinutes.getOrElse(1) { -1 }, curReminderMinutes.getOrElse(2) { -1 }, curRepeatInterval,
|
||||
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventTypeId, lastUpdated = curLastModified,
|
||||
source = source, location = curLocation)
|
||||
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventTypeId, 0, curLastModified, source)
|
||||
|
||||
if (event.getIsAllDay() && curEnd > curStart) {
|
||||
event.endTS -= DAY
|
||||
|
|
|
@ -7,11 +7,11 @@ import com.simplemobiletools.commons.extensions.removeBit
|
|||
import org.joda.time.DateTime
|
||||
import java.io.Serializable
|
||||
|
||||
data class Event(var id: Long?, var startTS: Int = 0, var endTS: Int = 0, var title: String = "", var description: String = "",
|
||||
data class Event(var id: Long?, var startTS: Int = 0, var endTS: Int = 0, var title: String = "", var location: String = "", var description: String = "",
|
||||
var reminder1Minutes: Int = -1, var reminder2Minutes: Int = -1, var reminder3Minutes: Int = -1, var repeatInterval: Int = 0,
|
||||
var importId: String = "", var flags: Int = 0, var repeatLimit: Int = 0, var repeatRule: Int = 0,
|
||||
var eventType: Long = DBHelper.REGULAR_EVENT_TYPE_ID, var parentId: Long = 0, var lastUpdated: Long = 0L,
|
||||
var source: String = SOURCE_SIMPLE_CALENDAR, var color: Int = 0, var location: String = "")
|
||||
var source: String = SOURCE_SIMPLE_CALENDAR, var color: Int = 0)
|
||||
: Serializable {
|
||||
|
||||
companion object {
|
||||
|
|
Loading…
Reference in New Issue