change event source to an Int
This commit is contained in:
parent
56fbef19ae
commit
9357ab7bca
|
@ -456,7 +456,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
offset = getCurrentOffset()
|
||||
isDstIncluded = TimeZone.getDefault().inDaylightTime(Date())
|
||||
lastUpdated = System.currentTimeMillis()
|
||||
source = "Simple Calendar"
|
||||
source = SOURCE_SIMPLE_CALENDAR
|
||||
}
|
||||
|
||||
storeEvent(wasRepeatable)
|
||||
|
|
|
@ -16,12 +16,10 @@ import com.simplemobiletools.calendar.activities.SettingsActivity
|
|||
import com.simplemobiletools.calendar.extensions.config
|
||||
import com.simplemobiletools.calendar.extensions.dbHelper
|
||||
import com.simplemobiletools.calendar.extensions.seconds
|
||||
import com.simplemobiletools.calendar.helpers.DAY
|
||||
import com.simplemobiletools.calendar.helpers.FLAG_ALL_DAY
|
||||
import com.simplemobiletools.calendar.helpers.Parser
|
||||
import com.simplemobiletools.calendar.helpers.RRULE
|
||||
import com.simplemobiletools.calendar.helpers.*
|
||||
import com.simplemobiletools.calendar.models.*
|
||||
import org.joda.time.DateTime
|
||||
import java.util.*
|
||||
|
||||
// more info about event fields at https://developers.google.com/google-apps/calendar/v3/reference/events/insert
|
||||
class FetchGoogleEventsTask(val activity: Activity, credential: GoogleAccountCredential) : AsyncTask<Void, Void, List<Event>>() {
|
||||
|
@ -135,7 +133,7 @@ class FetchGoogleEventsTask(val activity: Activity, credential: GoogleAccountCre
|
|||
val eventTypeId = getEventTypeId(googleEvent.colorId)
|
||||
val event = Event(eventId, startTS, endTS, googleEvent.summary, googleEvent.description, reminders.getOrElse(0, { -1 }),
|
||||
reminders.getOrElse(1, { -1 }), reminders.getOrElse(2, { -1 }), repeatRule.repeatInterval, importId, flags, repeatRule.repeatLimit,
|
||||
repeatRule.repeatRule, eventTypeId, lastUpdated = lastUpdate)
|
||||
repeatRule.repeatRule, eventTypeId, lastUpdated = lastUpdate, source = SOURCE_GOOGLE_SYNC)
|
||||
|
||||
if (event.isAllDay && endTS > startTS) {
|
||||
event.endTS -= DAY
|
||||
|
|
|
@ -116,3 +116,7 @@ val SU = "SU"
|
|||
val FONT_SIZE_SMALL = 0
|
||||
val FONT_SIZE_MEDIUM = 1
|
||||
val FONT_SIZE_LARGE = 2
|
||||
|
||||
val SOURCE_SIMPLE_CALENDAR = 0
|
||||
val SOURCE_GOOGLE_SYNC = 1
|
||||
val SOURCE_IMPORTED_ICS = 2
|
||||
|
|
|
@ -79,7 +79,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
db.execSQL("CREATE TABLE $MAIN_TABLE_NAME ($COL_ID INTEGER PRIMARY KEY, $COL_START_TS INTEGER, $COL_END_TS INTEGER, $COL_TITLE TEXT, " +
|
||||
"$COL_DESCRIPTION TEXT, $COL_REMINDER_MINUTES INTEGER, $COL_REMINDER_MINUTES_2 INTEGER, $COL_REMINDER_MINUTES_3 INTEGER, " +
|
||||
"$COL_IMPORT_ID TEXT, $COL_FLAGS INTEGER, $COL_EVENT_TYPE INTEGER NOT NULL DEFAULT $REGULAR_EVENT_TYPE_ID, " +
|
||||
"$COL_PARENT_EVENT_ID INTEGER, $COL_OFFSET TEXT, $COL_IS_DST_INCLUDED INTEGER, $COL_LAST_UPDATED INTEGER, $COL_SOURCE TEXT)")
|
||||
"$COL_PARENT_EVENT_ID INTEGER, $COL_OFFSET TEXT, $COL_IS_DST_INCLUDED INTEGER, $COL_LAST_UPDATED INTEGER, $COL_SOURCE INTEGER)")
|
||||
|
||||
createMetaTable(db)
|
||||
createTypesTable(db)
|
||||
|
@ -147,7 +147,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
|
||||
if (oldVersion < 14) {
|
||||
db.execSQL("ALTER TABLE $MAIN_TABLE_NAME ADD COLUMN $COL_LAST_UPDATED INTEGER NOT NULL DEFAULT 0")
|
||||
db.execSQL("ALTER TABLE $MAIN_TABLE_NAME ADD COLUMN $COL_SOURCE TEXT DEFAULT ''")
|
||||
db.execSQL("ALTER TABLE $MAIN_TABLE_NAME ADD COLUMN $COL_SOURCE INTEGER NOT NULL DEFAULT $SOURCE_SIMPLE_CALENDAR")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -686,7 +686,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||
val offset = cursor.getStringValue(COL_OFFSET)
|
||||
val isDstIncluded = cursor.getIntValue(COL_IS_DST_INCLUDED) == 1
|
||||
val lastUpdated = cursor.getLongValue(COL_LAST_UPDATED)
|
||||
val source = cursor.getStringValue(COL_SOURCE)
|
||||
val source = cursor.getIntValue(COL_SOURCE)
|
||||
|
||||
val ignoreEventOccurrences = if (repeatInterval != 0) {
|
||||
getIgnoredOccurrences(id)
|
||||
|
|
|
@ -98,7 +98,8 @@ class IcsImporter {
|
|||
|
||||
val event = Event(0, curStart, curEnd, curTitle, curDescription, curReminderMinutes.getOrElse(0, { -1 }),
|
||||
curReminderMinutes.getOrElse(1, { -1 }), curReminderMinutes.getOrElse(2, { -1 }), curRepeatInterval,
|
||||
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventType, lastUpdated = curLastModified)
|
||||
curImportId, curFlags, curRepeatLimit, curRepeatRule, curEventType, lastUpdated = curLastModified,
|
||||
source = SOURCE_IMPORTED_ICS)
|
||||
|
||||
if (event.isAllDay && curEnd > curStart) {
|
||||
event.endTS -= DAY
|
||||
|
|
|
@ -12,7 +12,7 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var
|
|||
var importId: String? = "", var flags: Int = 0, var repeatLimit: Int = 0, var repeatRule: Int = 0,
|
||||
var eventType: Int = DBHelper.REGULAR_EVENT_TYPE_ID, var ignoreEventOccurrences: ArrayList<Int> = ArrayList(),
|
||||
var offset: String = "", var isDstIncluded: Boolean = false, var parentId: Int = 0, var lastUpdated: Long = 0L,
|
||||
var source: String = "") : Serializable {
|
||||
var source: Int = SOURCE_SIMPLE_CALENDAR) : Serializable {
|
||||
|
||||
companion object {
|
||||
private val serialVersionUID = -32456795132345616L
|
||||
|
|
Loading…
Reference in New Issue