lint warnings
This commit is contained in:
parent
89d2ff9de8
commit
9608f5185f
4 changed files with 29 additions and 18 deletions
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.aps.loop
|
||||||
|
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
@ -15,6 +14,7 @@ import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
|
@ -59,6 +59,7 @@ class LoopFragment : Fragment() {
|
||||||
}, {
|
}, {
|
||||||
FabricPrivacy.logException(it)
|
FabricPrivacy.logException(it)
|
||||||
})
|
})
|
||||||
|
updateGUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
|
@ -67,18 +68,17 @@ class LoopFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateGUI() {
|
fun updateGUI() {
|
||||||
val lastRun = LoopPlugin.lastRun
|
LoopPlugin.lastRun?.let {
|
||||||
lastRun?.let {
|
|
||||||
loop_request.text = it.request?.toSpanned() ?: ""
|
loop_request.text = it.request?.toSpanned() ?: ""
|
||||||
loop_constraintsprocessed.text = it.constraintsProcessed?.toSpanned() ?: ""
|
loop_constraintsprocessed.text = it.constraintsProcessed?.toSpanned() ?: ""
|
||||||
loop_source.text = it.source ?: ""
|
loop_source.text = it.source ?: ""
|
||||||
loop_lastrun.text = it.lastAPSRun?.let { lastrun -> DateUtil.dateAndTimeString(lastrun.time) }
|
loop_lastrun.text = it.lastAPSRun?.let { lastRun -> DateUtil.dateAndTimeString(lastRun.time) }
|
||||||
?: ""
|
?: ""
|
||||||
loop_lastenact.text = it.lastAPSRun?.let { lastEnact -> DateUtil.dateAndTimeString(lastEnact.time) }
|
loop_lastenact.text = it.lastAPSRun?.let { lastEnact -> DateUtil.dateAndTimeString(lastEnact.time) }
|
||||||
?: ""
|
?: ""
|
||||||
loop_tbrsetbypump.text = it.tbrSetByPump?.let { tbrSetByPump -> Html.fromHtml(tbrSetByPump.toHtml()) }
|
loop_tbrsetbypump.text = it.tbrSetByPump?.let { tbrSetByPump -> HtmlHelper.fromHtml(tbrSetByPump.toHtml()) }
|
||||||
?: ""
|
?: ""
|
||||||
loop_smbsetbypump.text = it.smbSetByPump?.let { smbSetByPump -> Html.fromHtml(smbSetByPump.toHtml()) }
|
loop_smbsetbypump.text = it.smbSetByPump?.let { smbSetByPump -> HtmlHelper.fromHtml(smbSetByPump.toHtml()) }
|
||||||
?: ""
|
?: ""
|
||||||
|
|
||||||
val constraints =
|
val constraints =
|
||||||
|
@ -92,7 +92,7 @@ class LoopFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun clearGUI() {
|
private fun clearGUI() {
|
||||||
loop_request.text = ""
|
loop_request.text = ""
|
||||||
loop_constraints.text = ""
|
loop_constraints.text = ""
|
||||||
loop_constraintsprocessed.text = ""
|
loop_constraintsprocessed.text = ""
|
||||||
|
|
|
@ -21,10 +21,7 @@ import info.nightscout.androidaps.plugins.general.tidepool.events.EventTidepoolU
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.utils.RateLimit
|
import info.nightscout.androidaps.plugins.general.tidepool.utils.RateLimit
|
||||||
import info.nightscout.androidaps.receivers.ChargingStateReceiver
|
import info.nightscout.androidaps.receivers.ChargingStateReceiver
|
||||||
import info.nightscout.androidaps.receivers.NetworkChangeReceiver
|
import info.nightscout.androidaps.receivers.NetworkChangeReceiver
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.*
|
||||||
import info.nightscout.androidaps.utils.SP
|
|
||||||
import info.nightscout.androidaps.utils.T
|
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
@ -44,8 +41,7 @@ object TidepoolPlugin : PluginBase(PluginDescription()
|
||||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
private val listLog = ArrayList<EventTidepoolStatus>()
|
private val listLog = ArrayList<EventTidepoolStatus>()
|
||||||
@Suppress("DEPRECATION") // API level 24 to replace call
|
var textLog: Spanned = HtmlHelper.fromHtml("")
|
||||||
var textLog: Spanned = Html.fromHtml("")
|
|
||||||
|
|
||||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||||
add(disposable)
|
add(disposable)
|
||||||
|
@ -150,8 +146,7 @@ object TidepoolPlugin : PluginBase(PluginDescription()
|
||||||
newTextLog.append(log.toPreparedHtml())
|
newTextLog.append(log.toPreparedHtml())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Suppress("DEPRECATION") // API level 24 to replace call
|
textLog = HtmlHelper.fromHtml(newTextLog.toString())
|
||||||
textLog = Html.fromHtml(newTextLog.toString())
|
|
||||||
} catch (e: OutOfMemoryError) {
|
} catch (e: OutOfMemoryError) {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, "Out of memory!\nStop using this phone !!!", R.raw.error)
|
ToastUtils.showToastInUiThread(MainApp.instance().applicationContext, "Out of memory!\nStop using this phone !!!", R.raw.error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.utils
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.text.Html
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
@ -189,7 +188,8 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
|
||||||
calculatedTotalInsulin = 0.0
|
calculatedTotalInsulin = 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.bolusStep ?: 0.1
|
val bolusStep = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.bolusStep
|
||||||
|
?: 0.1
|
||||||
calculatedTotalInsulin = Round.roundTo(calculatedTotalInsulin, bolusStep)
|
calculatedTotalInsulin = Round.roundTo(calculatedTotalInsulin, bolusStep)
|
||||||
|
|
||||||
insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(calculatedTotalInsulin)).value()
|
insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(calculatedTotalInsulin)).value()
|
||||||
|
@ -273,7 +273,7 @@ class BolusWizard @JvmOverloads constructor(val profile: Profile,
|
||||||
|
|
||||||
val builder = AlertDialog.Builder(context)
|
val builder = AlertDialog.Builder(context)
|
||||||
builder.setTitle(MainApp.gs(R.string.confirmation))
|
builder.setTitle(MainApp.gs(R.string.confirmation))
|
||||||
builder.setMessage(Html.fromHtml(confirmMessage))
|
builder.setMessage(HtmlHelper.fromHtml(confirmMessage))
|
||||||
builder.setPositiveButton(MainApp.gs(R.string.ok)) { _, _ ->
|
builder.setPositiveButton(MainApp.gs(R.string.ok)) { _, _ ->
|
||||||
synchronized(builder) {
|
synchronized(builder) {
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package info.nightscout.androidaps.utils
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import android.text.Html
|
||||||
|
import android.text.Spanned
|
||||||
|
|
||||||
|
object HtmlHelper {
|
||||||
|
fun fromHtml(source: String): Spanned {
|
||||||
|
// API level 24 to replace call
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
return when {
|
||||||
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N -> Html.fromHtml(source, Html.FROM_HTML_MODE_LEGACY)
|
||||||
|
else -> Html.fromHtml(source)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue