Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ede9f9c authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Update dependencies, lint

parent 5991809c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ buildscript {
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.android.tools.build:gradle:3.5.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
        classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:${versions.dokka}"
    }
@@ -29,7 +29,7 @@ apply plugin: 'org.jetbrains.dokka-android'

android {
    compileSdkVersion 29
    buildToolsVersion '29.0.1'
    buildToolsVersion '29.0.2'

    defaultConfig {
        minSdkVersion 19
+9 −9
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ abstract class AndroidCalendar<out T: AndroidEvent>(
            info.put(Calendars.ALLOWED_AVAILABILITY, "${Events.AVAILABILITY_BUSY},${Events.AVAILABILITY_FREE},${Events.AVAILABILITY_TENTATIVE}")
            info.put(Calendars.ALLOWED_ATTENDEE_TYPES, "${Attendees.TYPE_NONE},${Attendees.TYPE_OPTIONAL},${Attendees.TYPE_REQUIRED},${Attendees.TYPE_RESOURCE}")

            Constants.log.info("Creating local calendar: " + info.toString())
            Constants.log.info("Creating local calendar: $info")
            return provider.insert(syncAdapterURI(Calendars.CONTENT_URI, account), info) ?:
                    throw Exception("Couldn't create calendar: provider returned null")
        }
@@ -69,8 +69,8 @@ abstract class AndroidCalendar<out T: AndroidEvent>(

            Constants.log.info("Inserting event colors for account $account")
            val values = ContentValues(5)
            values.put(CalendarContract.Colors.ACCOUNT_NAME, account.name)
            values.put(CalendarContract.Colors.ACCOUNT_TYPE, account.type)
            values.put(Colors.ACCOUNT_NAME, account.name)
            values.put(Colors.ACCOUNT_TYPE, account.type)
            values.put(Colors.COLOR_TYPE, Colors.TYPE_EVENT)
            for (color in Css3Color.values()) {
                values.put(Colors.COLOR_KEY, color.name)
@@ -100,8 +100,8 @@ abstract class AndroidCalendar<out T: AndroidEvent>(
        }

        fun<T: AndroidCalendar<AndroidEvent>> findByID(account: Account, provider: ContentProviderClient, factory: AndroidCalendarFactory<T>, id: Long): T {
            val iterCalendars = CalendarContract.CalendarEntity.newEntityIterator(
                    provider.query(syncAdapterURI(ContentUris.withAppendedId(CalendarContract.CalendarEntity.CONTENT_URI, id), account), null, null, null, null)
            val iterCalendars = CalendarEntity.newEntityIterator(
                    provider.query(syncAdapterURI(ContentUris.withAppendedId(CalendarEntity.CONTENT_URI, id), account), null, null, null, null)
            )
            try {
                if (iterCalendars.hasNext()) {
@@ -117,8 +117,8 @@ abstract class AndroidCalendar<out T: AndroidEvent>(
        }

        fun<T: AndroidCalendar<AndroidEvent>> find(account: Account, provider: ContentProviderClient, factory: AndroidCalendarFactory<T>, where: String?, whereArgs: Array<String>?): List<T> {
            val iterCalendars = CalendarContract.CalendarEntity.newEntityIterator(
                    provider.query(syncAdapterURI(CalendarContract.CalendarEntity.CONTENT_URI, account), null, where, whereArgs, null)
            val iterCalendars = CalendarEntity.newEntityIterator(
                    provider.query(syncAdapterURI(CalendarEntity.CONTENT_URI, account), null, where, whereArgs, null)
            )
            try {
                val calendars = LinkedList<T>()
@@ -137,7 +137,7 @@ abstract class AndroidCalendar<out T: AndroidEvent>(
        fun syncAdapterURI(uri: Uri, account: Account) = uri.buildUpon()
                .appendQueryParameter(Calendars.ACCOUNT_NAME, account.name)
                .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type)
                .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true")
                .appendQueryParameter(CALLER_IS_SYNCADAPTER, "true")
                .build()!!
    }

@@ -188,7 +188,7 @@ abstract class AndroidCalendar<out T: AndroidEvent>(


    fun syncAdapterURI(uri: Uri) = uri.buildUpon()
            .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true")
            .appendQueryParameter(CALLER_IS_SYNCADAPTER, "true")
            .appendQueryParameter(Calendars.ACCOUNT_NAME, account.name)
            .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type)
            .build()!!
+5 −8
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ import android.content.ContentValues
import android.content.EntityIterator
import android.net.Uri
import android.os.RemoteException
import android.provider.CalendarContract
import android.provider.CalendarContract.*
import android.util.Base64
import at.bitfire.ical4android.MiscUtils.CursorHelper.toValues
@@ -99,9 +98,9 @@ abstract class AndroidEvent(

            var iterEvents: EntityIterator? = null
            try {
                iterEvents = CalendarContract.EventsEntity.newEntityIterator(
                iterEvents = EventsEntity.newEntityIterator(
                        calendar.provider.query(
                                calendar.syncAdapterURI(ContentUris.withAppendedId(CalendarContract.EventsEntity.CONTENT_URI, id)),
                                calendar.syncAdapterURI(ContentUris.withAppendedId(EventsEntity.CONTENT_URI, id)),
                                null, null, null, null),
                        calendar.provider
                )
@@ -116,7 +115,7 @@ abstract class AndroidEvent(
                        when (subValue.uri) {
                            Attendees.CONTENT_URI -> populateAttendee(subValue.values)
                            Reminders.CONTENT_URI -> populateReminder(subValue.values)
                            CalendarContract.ExtendedProperties.CONTENT_URI -> populateExtended(subValue.values)
                            ExtendedProperties.CONTENT_URI -> populateExtended(subValue.values)
                        }
                    populateExceptions()

@@ -280,8 +279,7 @@ abstract class AndroidEvent(
            params.add(if (type == Attendees.TYPE_RESOURCE) CuType.RESOURCE else CuType.INDIVIDUAL)

            // role
            val relationship = row.getAsInteger(Attendees.ATTENDEE_RELATIONSHIP)
            when (relationship) {
            when (row.getAsInteger(Attendees.ATTENDEE_RELATIONSHIP)) {
                Attendees.RELATIONSHIP_ORGANIZER,
                Attendees.RELATIONSHIP_ATTENDEE,
                Attendees.RELATIONSHIP_PERFORMER,
@@ -685,8 +683,7 @@ abstract class AndroidEvent(
            builder.withValue(Attendees.ATTENDEE_RELATIONSHIP, relationship)
        }

        val partStat = attendee.getParameter(Parameter.PARTSTAT) as? PartStat
        val status = when(partStat) {
        val status = when(attendee.getParameter(Parameter.PARTSTAT) as? PartStat) {
            null,
            PartStat.NEEDS_ACTION -> Attendees.ATTENDEE_STATUS_INVITED
            PartStat.ACCEPTED     -> Attendees.ATTENDEE_STATUS_ACCEPTED
+2 −3
Original line number Diff line number Diff line
@@ -179,8 +179,7 @@ abstract class AndroidTask(

    protected open fun populateProperty(values: ContentValues) {
        val task = requireNotNull(task)
        val type = values.getAsString(Properties.MIMETYPE)
        when (type) {
        when (val type = values.getAsString(Properties.MIMETYPE)) {
            Category.CONTENT_ITEM_TYPE ->
                task.categories += values.getAsString(Category.CATEGORY_NAME)
            else ->
@@ -327,7 +326,7 @@ abstract class AndroidTask(
    fun getTimeZone(): TimeZone {
        val task = requireNotNull(task)

        var tz: java.util.TimeZone? = null
        var tz: TimeZone? = null
        task.dtStart?.timeZone?.let { tz = it }

        tz = tz ?: task.due?.timeZone
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ abstract class AndroidTaskList<out T: AndroidTask>(
            info.put(TaskContract.ACCOUNT_TYPE, account.type)
            info.put(TaskLists.ACCESS_LEVEL, 0)

            Constants.log.info("Creating local task list: " + info.toString())
            Constants.log.info("Creating local task list: $info")
            return provider.client.insert(TaskProvider.syncAdapterUri(provider.taskListsUri(), account), info) ?:
                    throw CalendarStorageException("Couldn't create task list (empty result from provider)")
        }
Loading