Merge pull request #1676 from osodebailar/fix/run-aps-calculaion-in-thread

Fix - run aps calculation in thread
This commit is contained in:
Milos Kozak 2022-04-25 18:35:48 +02:00 committed by GitHub
commit f60dc15bb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -59,7 +59,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
setOnRefreshListener {
binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
openAPSAMAPlugin.invoke("OpenAPSAMA swiperefresh", false)
Thread { openAPSAMAPlugin.invoke("OpenAPSAMA swiperefresh", false) }.start()
}
}
@ -76,7 +76,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
when (item.itemId) {
ID_MENU_RUN -> {
binding.lastrun.text = rh.gs(R.string.executing)
openAPSAMAPlugin.invoke("OpenAPSAMA menu", false)
Thread { openAPSAMAPlugin.invoke("OpenAPSAMA menu", false) }.start()
true
}

View file

@ -36,6 +36,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var jsonFormatter: JSONFormatter
private lateinit var refreshDialog: Runnable
private val ID_MENU_RUN = 1
@ -58,10 +59,9 @@ class OpenAPSSMBFragment : DaggerFragment() {
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
setOnRefreshListener {
binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
activePlugin.activeAPS.invoke("OpenAPSSMB swiperefresh", false)
Thread { activePlugin.activeAPS.invoke("OpenAPSSMB swiperefresh", false) }.start()
}
}
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
@ -75,7 +75,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
when (item.itemId) {
ID_MENU_RUN -> {
binding.lastrun.text = rh.gs(R.string.executing)
activePlugin.activeAPS.invoke("OpenAPSSMB menu", false)
Thread { activePlugin.activeAPS.invoke("OpenAPSSMB menu", false) }.start()
true
}