mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-03 17:59:51 +02:00
Fix crashs caused by the timelimit widget
This commit is contained in:
parent
f518e56e7f
commit
fa7c9edb49
1 changed files with 3 additions and 2 deletions
|
@ -24,6 +24,7 @@ import android.widget.RemoteViewsService
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import io.timelimit.android.R
|
import io.timelimit.android.R
|
||||||
|
import io.timelimit.android.async.Threads
|
||||||
import io.timelimit.android.logic.DefaultAppLogic
|
import io.timelimit.android.logic.DefaultAppLogic
|
||||||
import io.timelimit.android.util.TimeTextUtil
|
import io.timelimit.android.util.TimeTextUtil
|
||||||
|
|
||||||
|
@ -52,11 +53,11 @@ class TimesWidgetService: RemoteViewsService() {
|
||||||
|
|
||||||
private val factory = object : RemoteViewsFactory {
|
private val factory = object : RemoteViewsFactory {
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
categoriesLive.observeForever(categoriesObserver)
|
Threads.mainThreadHandler.post { categoriesLive.observeForever(categoriesObserver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
categoriesLive.removeObserver(categoriesObserver)
|
Threads.mainThreadHandler.post { categoriesLive.removeObserver(categoriesObserver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDataSetChanged() {
|
override fun onDataSetChanged() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue