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 importId = getCalDAVEventImportId(calendarId, id)
|
||||||
val source = "$CALDAV-$calendarId"
|
val source = "$CALDAV-$calendarId"
|
||||||
val repeatRule = Parser().parseRepeatInterval(rrule, startTS)
|
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,
|
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()) {
|
if (event.getIsAllDay()) {
|
||||||
event.startTS = Formatter.getShiftedImportTimestamp(event.startTS)
|
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)
|
val repeatInterval = cursor.getIntValue(COL_REPEAT_INTERVAL)
|
||||||
var repeatRule = cursor.getIntValue(COL_REPEAT_RULE)
|
var repeatRule = cursor.getIntValue(COL_REPEAT_RULE)
|
||||||
val title = cursor.getStringValue(COL_TITLE)
|
val title = cursor.getStringValue(COL_TITLE)
|
||||||
|
val location = cursor.getStringValue(COL_LOCATION)
|
||||||
val description = cursor.getStringValue(COL_DESCRIPTION)
|
val description = cursor.getStringValue(COL_DESCRIPTION)
|
||||||
val importId = cursor.getStringValue(COL_IMPORT_ID) ?: ""
|
val importId = cursor.getStringValue(COL_IMPORT_ID) ?: ""
|
||||||
val flags = cursor.getIntValue(COL_FLAGS)
|
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 eventType = cursor.getLongValue(COL_EVENT_TYPE)
|
||||||
val lastUpdated = cursor.getLongValue(COL_LAST_UPDATED)
|
val lastUpdated = cursor.getLongValue(COL_LAST_UPDATED)
|
||||||
val source = cursor.getStringValue(COL_EVENT_SOURCE)
|
val source = cursor.getStringValue(COL_EVENT_SOURCE)
|
||||||
val location = cursor.getStringValue(COL_LOCATION)
|
|
||||||
val color = eventTypeColors.get(eventType)!!
|
val color = eventTypeColors.get(eventType)!!
|
||||||
|
|
||||||
if (repeatInterval > 0 && repeatRule == 0 && (repeatInterval % MONTH == 0 || repeatInterval % YEAR == 0)) {
|
if (repeatInterval > 0 && repeatRule == 0 && (repeatInterval % MONTH == 0 || repeatInterval % YEAR == 0)) {
|
||||||
repeatRule = REPEAT_SAME_DAY
|
repeatRule = REPEAT_SAME_DAY
|
||||||
}
|
}
|
||||||
|
|
||||||
val event = Event(id, startTS, endTS, title, description, reminder1Minutes, reminder2Minutes, reminder3Minutes,
|
val event = Event(id, startTS, endTS, title, location, description, reminder1Minutes, reminder2Minutes, reminder3Minutes,
|
||||||
repeatInterval, importId, flags, repeatLimit, repeatRule, eventType, 0, lastUpdated, source, color, location)
|
repeatInterval, importId, flags, repeatLimit, repeatRule, eventType, 0, lastUpdated, source, color)
|
||||||
event.updateIsPastEvent()
|
event.updateIsPastEvent()
|
||||||
|
|
||||||
events.add(event)
|
events.add(event)
|
||||||
|
|
|
@ -140,10 +140,9 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||||
|
|
||||||
val eventType = eventTypes.firstOrNull { it.id == curEventTypeId }
|
val eventType = eventTypes.firstOrNull { it.id == curEventTypeId }
|
||||||
val source = if (calDAVCalendarId == 0 || eventType?.isSyncedEventType() == false) SOURCE_IMPORTED_ICS else "$CALDAV-$calDAVCalendarId"
|
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,
|
curReminderMinutes.getOrElse(1) { -1 }, curReminderMinutes.getOrElse(2) { -1 }, curRepeatInterval,
|
||||||
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventTypeId, lastUpdated = curLastModified,
|
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventTypeId, 0, curLastModified, source)
|
||||||
source = source, location = curLocation)
|
|
||||||
|
|
||||||
if (event.getIsAllDay() && curEnd > curStart) {
|
if (event.getIsAllDay() && curEnd > curStart) {
|
||||||
event.endTS -= DAY
|
event.endTS -= DAY
|
||||||
|
|
|
@ -7,11 +7,11 @@ import com.simplemobiletools.commons.extensions.removeBit
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import java.io.Serializable
|
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 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 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 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 {
|
: Serializable {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
Loading…
Reference in New Issue