Remove additional thread and move binding check into runOnUiThread

This commit is contained in:
Philoul 2022-05-26 09:03:07 +02:00
parent 31cb9a1156
commit 5db11a0b47

View file

@ -381,10 +381,9 @@ class AutotuneFragment : DaggerFragment() {
} }
private fun showResults() { private fun showResults() {
_binding ?: return
Thread {
context?.let { context -> context?.let { context ->
runOnUiThread { runOnUiThread {
_binding?.let {
binding.autotuneResults.removeAllViews() binding.autotuneResults.removeAllViews()
if (autotunePlugin.result.isNotBlank()) { if (autotunePlugin.result.isNotBlank()) {
var toMgDl = 1.0 var toMgDl = 1.0
@ -455,7 +454,7 @@ class AutotuneFragment : DaggerFragment() {
binding.autotuneResultsCard.visibility = if (autotunePlugin.calculationRunning && autotunePlugin.result.isEmpty()) View.GONE else View.VISIBLE binding.autotuneResultsCard.visibility = if (autotunePlugin.calculationRunning && autotunePlugin.result.isEmpty()) View.GONE else View.VISIBLE
} }
} }
}.start() }
} }
private fun toTableRowHeader(basal:Boolean = false): TableRow = private fun toTableRowHeader(basal:Boolean = false): TableRow =