EROS: do not run commands on UI thread
This commit is contained in:
parent
3a33529307
commit
da45219b98
2 changed files with 6 additions and 2 deletions
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.HandlerThread
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
|
@ -54,6 +56,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
|
||||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||||
|
private val loopHandler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
||||||
|
|
||||||
private lateinit var binding: OmnipodErosPodManagementBinding
|
private lateinit var binding: OmnipodErosPodManagementBinding
|
||||||
|
|
||||||
|
@ -97,7 +100,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
binding.buttonResetRileylinkConfig.setOnClickListener {
|
binding.buttonResetRileylinkConfig.setOnClickListener {
|
||||||
// TODO improvement: properly disable button until task is finished
|
// TODO improvement: properly disable button until task is finished
|
||||||
serviceTaskExecutor.startTask(ResetRileyLinkConfigurationTask(injector))
|
loopHandler.post { serviceTaskExecutor.startTask(ResetRileyLinkConfigurationTask(injector)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttonPlayTestBeep.setOnClickListener {
|
binding.buttonPlayTestBeep.setOnClickListener {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
import android.os.HandlerThread
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -86,7 +87,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
private val loopHandler = Handler(Looper.getMainLooper())
|
private val loopHandler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
||||||
private lateinit var refreshLoop: Runnable
|
private lateinit var refreshLoop: Runnable
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
Loading…
Reference in a new issue