Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TestEvent.kt « impl « ical4android « bitfire « at « java « androidTest « src - github.com/bitfireAT/ical4android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f9c9571c12addea8b153d0249777dc546ed14083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/***************************************************************************************************
 * Copyright © All Contributors. See LICENSE and AUTHORS in the root directory for details.
 **************************************************************************************************/

package at.bitfire.ical4android.impl

import android.content.ContentValues
import android.provider.CalendarContract
import android.provider.CalendarContract.Events
import at.bitfire.ical4android.*
import java.util.*

class TestEvent: AndroidEvent {

    constructor(calendar: AndroidCalendar<AndroidEvent>, values: ContentValues)
        : super(calendar, values)

    constructor(calendar: TestCalendar, event: Event)
        : super(calendar, event)

    val syncId by lazy { UUID.randomUUID().toString() }


    override fun buildEvent(recurrence: Event?, builder: BatchOperation.CpoBuilder) {
        if (recurrence != null)
            builder.withValue(Events.ORIGINAL_SYNC_ID, syncId)
        else
            builder.withValue(Events._SYNC_ID, syncId)

        super.buildEvent(recurrence, builder)
    }


    object Factory: AndroidEventFactory<TestEvent> {
        override fun fromProvider(calendar: AndroidCalendar<AndroidEvent>, values: ContentValues) =
                TestEvent(calendar, values)
    }

}