pass the activity as a parameter at fetching CalDAV calendars

This commit is contained in:
tibbi
2018-02-07 09:48:32 +01:00
parent da8eeda2bf
commit 40da9993d4
3 changed files with 5 additions and 5 deletions

View File

@ -450,7 +450,7 @@ class EventActivity : SimpleActivity() {
event_caldav_calendar_holder.beVisible()
event_caldav_calendar_divider.beVisible()
val calendars = CalDAVHandler(applicationContext).getCalDAVCalendars().filter {
val calendars = CalDAVHandler(applicationContext).getCalDAVCalendars(this).filter {
it.canWrite() && config.getSyncedCalendarIdsAsList().contains(it.id.toString())
}
updateCurrentCalendarInfo(if (mEventCalendarId == STORED_LOCALLY_ONLY) null else getCalendarWithId(calendars, getCalendarId()))

View File

@ -1,12 +1,12 @@
package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.support.v7.widget.SwitchCompat
import android.text.TextUtils
import android.view.ViewGroup
import android.widget.RelativeLayout
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.activities.SimpleActivity
import com.simplemobiletools.calendar.extensions.config
import com.simplemobiletools.calendar.helpers.CalDAVHandler
import com.simplemobiletools.commons.extensions.setupDialogStuff
@ -14,14 +14,14 @@ import kotlinx.android.synthetic.main.calendar_item_account.view.*
import kotlinx.android.synthetic.main.calendar_item_calendar.view.*
import kotlinx.android.synthetic.main.dialog_select_calendars.view.*
class SelectCalendarsDialog(val activity: Activity, val callback: () -> Unit) {
class SelectCalendarsDialog(val activity: SimpleActivity, val callback: () -> Unit) {
var prevAccount = ""
var dialog: AlertDialog
var view = (activity.layoutInflater.inflate(R.layout.dialog_select_calendars, null) as ViewGroup)
init {
val ids = activity.config.getSyncedCalendarIdsAsList()
val calendars = CalDAVHandler(activity).getCalDAVCalendars()
val calendars = CalDAVHandler(activity.applicationContext).getCalDAVCalendars(activity)
val sorted = calendars.sortedWith(compareBy({ it.accountName }, { it.displayName }))
sorted.forEach {
if (prevAccount != it.accountName) {

View File

@ -19,7 +19,7 @@ class SelectEventTypeColorDialog(val activity: Activity, val eventType: EventTyp
private val dialog: AlertDialog?
private val radioGroup: RadioGroup
private var wasInit = false
private val colors = CalDAVHandler(activity).getAvailableCalDAVCalendarColors(eventType)
private val colors = CalDAVHandler(activity.applicationContext).getAvailableCalDAVCalendarColors(eventType)
init {
val view = activity.layoutInflater.inflate(R.layout.dialog_select_radio_group, null) as ViewGroup