recheck caldav calendars at startup from a background thread

This commit is contained in:
tibbi 2017-10-07 21:03:49 +02:00
parent 8cd98798f6
commit 381b2bc999
2 changed files with 6 additions and 4 deletions

View File

@ -78,9 +78,9 @@ class MainActivity : SimpleActivity(), NavigationListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
storeStoragePaths()
calendar_fab.setOnClickListener { launchNewEventIntent() }
checkWhatsNewDialog()
storeStoragePaths()
if (resources.getBoolean(R.bool.portrait_only))
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
@ -88,7 +88,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
val uri = intent.data
if (uri.authority == "com.android.calendar") {
// clicking date on a widget: content://com.android.calendar/time/1507309245683
// clicking date on a third party widget: content://com.android.calendar/time/1507309245683
if (intent?.extras?.getBoolean("DETAIL_VIEW", false) == true) {
val timestamp = uri.pathSegments.last()
if (timestamp.areDigitsOnly()) {

View File

@ -238,8 +238,10 @@ fun Context.getSyncedCalDAVCalendars() = CalDAVHandler(this).getCalDAVCalendars(
fun Context.recheckCalDAVCalendars(callback: () -> Unit) {
if (config.caldavSync) {
CalDAVHandler(this).refreshCalendars(null, callback)
updateWidgets()
Thread({
CalDAVHandler(this).refreshCalendars(null, callback)
updateWidgets()
}).start()
}
}