fix #571, rmeove some glitches related to events moving between event types

This commit is contained in:
tibbi
2018-10-24 18:29:51 +02:00
parent d54226d255
commit 6a783df2ac
2 changed files with 4 additions and 4 deletions

View File

@ -705,10 +705,10 @@ class EventActivity : SimpleActivity() {
val newEventType = if (!config.caldavSync || config.lastUsedCaldavCalendarId == 0 || mEventCalendarId == STORED_LOCALLY_ONLY) { val newEventType = if (!config.caldavSync || config.lastUsedCaldavCalendarId == 0 || mEventCalendarId == STORED_LOCALLY_ONLY) {
mEventTypeId mEventTypeId
} else { } else {
dbHelper.getEventTypeWithCalDAVCalendarId(config.lastUsedCaldavCalendarId)?.id ?: config.lastUsedLocalEventTypeId dbHelper.getEventTypeWithCalDAVCalendarId(mEventCalendarId)?.id ?: config.lastUsedLocalEventTypeId
} }
val newSource = if (!config.caldavSync || config.lastUsedCaldavCalendarId == 0 || mEventCalendarId == STORED_LOCALLY_ONLY) { val newSource = if (!config.caldavSync || mEventCalendarId == STORED_LOCALLY_ONLY) {
config.lastUsedLocalEventTypeId = newEventType config.lastUsedLocalEventTypeId = newEventType
SOURCE_SIMPLE_CALENDAR SOURCE_SIMPLE_CALENDAR
} else { } else {

View File

@ -602,7 +602,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
val selectionArgs = arrayOf(eventTypeId.toString()) val selectionArgs = arrayOf(eventTypeId.toString())
val cursor = getEventsCursor(selection, selectionArgs) val cursor = getEventsCursor(selection, selectionArgs)
val events = fillEvents(cursor) val events = fillEvents(cursor)
val eventIDs = Array(events.size, { i -> (events[i].id.toString()) }) val eventIDs = Array(events.size) { i -> (events[i].id.toString()) }
deleteEvents(eventIDs, true) deleteEvents(eventIDs, true)
} }
@ -985,7 +985,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
} }
fun getEventTypesSync(): ArrayList<EventType> { fun getEventTypesSync(): ArrayList<EventType> {
val eventTypes = ArrayList<EventType>(4) val eventTypes = ArrayList<EventType>()
val cols = arrayOf(COL_TYPE_ID, COL_TYPE_TITLE, COL_TYPE_COLOR, COL_TYPE_CALDAV_CALENDAR_ID, COL_TYPE_CALDAV_DISPLAY_NAME, COL_TYPE_CALDAV_EMAIL) val cols = arrayOf(COL_TYPE_ID, COL_TYPE_TITLE, COL_TYPE_COLOR, COL_TYPE_CALDAV_CALENDAR_ID, COL_TYPE_CALDAV_DISPLAY_NAME, COL_TYPE_CALDAV_EMAIL)
var cursor: Cursor? = null var cursor: Cursor? = null
try { try {