adding repeatDay to events

This commit is contained in:
tibbi 2017-04-14 14:57:16 +02:00
parent 52ddc8ce59
commit f77f645479
3 changed files with 15 additions and 16 deletions

View File

@ -47,6 +47,14 @@ val SYNC_ACCOUNT_NAME = "sync_account_name"
val letterIDs = intArrayOf(R.string.sunday_letter, R.string.monday_letter, R.string.tuesday_letter, R.string.wednesday_letter,
R.string.thursday_letter, R.string.friday_letter, R.string.saturday_letter)
val MONDAY = 1
val TUESDAY = 2
val WEDNESDAY = 4
val THURSDAY = 8
val FRIDAY = 16
val SATURDAY = 32
val SUNDAY = 64
// special event flags
val FLAG_ALL_DAY = 1

View File

@ -197,22 +197,12 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
}
private fun fillMetaValues(event: Event): ContentValues {
val repeatInterval = event.repeatInterval
val dateTime = Formatter.getDateTimeFromTS(event.startTS)
return ContentValues().apply {
put(COL_EVENT_ID, event.id)
put(COL_REPEAT_START, event.startTS)
put(COL_REPEAT_INTERVAL, repeatInterval)
put(COL_REPEAT_INTERVAL, event.repeatInterval)
put(COL_REPEAT_LIMIT, event.repeatLimit)
if (repeatInterval == MONTH || repeatInterval == YEAR) {
put(COL_REPEAT_DAY, dateTime.dayOfMonth)
}
if (repeatInterval == YEAR) {
put(COL_REPEAT_MONTH, dateTime.monthOfYear)
}
put(COL_REPEAT_DAY, event.repeatDay)
}
}
@ -492,6 +482,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
val reminder2Minutes = cursor.getIntValue(COL_REMINDER_MINUTES_2)
val reminder3Minutes = cursor.getIntValue(COL_REMINDER_MINUTES_3)
val repeatInterval = cursor.getIntValue(COL_REPEAT_INTERVAL)
val repeatDay = cursor.getIntValue(COL_REPEAT_DAY)
val title = cursor.getStringValue(COL_TITLE)
val description = cursor.getStringValue(COL_DESCRIPTION)
val importId = cursor.getStringValue(COL_IMPORT_ID)
@ -508,7 +499,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
}
val event = Event(id, startTS, endTS, title, description, reminder1Minutes, reminder2Minutes, reminder3Minutes,
repeatInterval, importId, flags, repeatLimit, eventType, ignoreEventOccurrences)
repeatInterval, importId, flags, repeatLimit, repeatDay, eventType, ignoreEventOccurrences)
events.add(event)
} while (cursor.moveToNext())
}

View File

@ -9,11 +9,11 @@ import java.util.*
data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var title: 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 eventType: Int = DBHelper.REGULAR_EVENT_TYPE_ID,
var ignoreEventOccurrences: ArrayList<Int> = ArrayList()) : Serializable {
var importId: String? = "", var flags: Int = 0, var repeatLimit: Int = 0, var repeatDay: Int = 0,
var eventType: Int = DBHelper.REGULAR_EVENT_TYPE_ID, var ignoreEventOccurrences: ArrayList<Int> = ArrayList()) : Serializable {
companion object {
private val serialVersionUID = -32456795132344616L
private val serialVersionUID = -32456795132345616L
}
fun addIntervalTime() {