This commit is contained in:
Milos Kozak 2022-05-19 12:51:51 +02:00
parent 1cdbde89bc
commit 73fa9f5814
2 changed files with 14 additions and 13 deletions

View file

@ -385,7 +385,7 @@ class AutotuneFragment : DaggerFragment() {
if (autotunePlugin.result.isNotBlank()) { if (autotunePlugin.result.isNotBlank()) {
var toMgDl = 1.0 var toMgDl = 1.0
if (profileFunction.getUnits() == GlucoseUnit.MMOL) toMgDl = Constants.MMOLL_TO_MGDL if (profileFunction.getUnits() == GlucoseUnit.MMOL) toMgDl = Constants.MMOLL_TO_MGDL
var isf_Format = if (profileFunction.getUnits() == GlucoseUnit.MMOL) "%.2f" else "%.1f" val isfFormat = if (profileFunction.getUnits() == GlucoseUnit.MMOL) "%.2f" else "%.1f"
binding.autotuneResults.addView( binding.autotuneResults.addView(
TableLayout(context).also { layout -> TableLayout(context).also { layout ->
layout.addView( layout.addView(
@ -402,7 +402,7 @@ class AutotuneFragment : DaggerFragment() {
layout.addView(toTableRowValue(rh.gs(R.string.insulin_peak), autotunePlugin.pumpProfile.localInsulin.peak.toDouble(), tuned.localInsulin.peak.toDouble(), "%.0f")) layout.addView(toTableRowValue(rh.gs(R.string.insulin_peak), autotunePlugin.pumpProfile.localInsulin.peak.toDouble(), tuned.localInsulin.peak.toDouble(), "%.0f"))
layout.addView(toTableRowValue(rh.gs(R.string.dia), Round.roundTo(autotunePlugin.pumpProfile.localInsulin.dia, 0.1), Round.roundTo(tuned.localInsulin.dia, 0.1),"%.1f")) layout.addView(toTableRowValue(rh.gs(R.string.dia), Round.roundTo(autotunePlugin.pumpProfile.localInsulin.dia, 0.1), Round.roundTo(tuned.localInsulin.dia, 0.1),"%.1f"))
} }
layout.addView(toTableRowValue(rh.gs(R.string.isf_short), Round.roundTo(autotunePlugin.pumpProfile.isf / toMgDl, 0.001), Round.roundTo(tuned.isf / toMgDl, 0.001), isf_Format)) layout.addView(toTableRowValue(rh.gs(R.string.isf_short), Round.roundTo(autotunePlugin.pumpProfile.isf / toMgDl, 0.001), Round.roundTo(tuned.isf / toMgDl, 0.001), isfFormat))
layout.addView(toTableRowValue(rh.gs(R.string.ic_short), Round.roundTo(autotunePlugin.pumpProfile.ic, 0.001), Round.roundTo(tuned.ic, 0.001), "%.2f")) layout.addView(toTableRowValue(rh.gs(R.string.ic_short), Round.roundTo(autotunePlugin.pumpProfile.ic, 0.001), Round.roundTo(tuned.ic, 0.001), "%.2f"))
layout.addView( layout.addView(
TextView(context).apply { TextView(context).apply {

View file

@ -18,7 +18,6 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.ActivitySmscommunicatorOtpBinding import info.nightscout.androidaps.databinding.ActivitySmscommunicatorOtpBinding
import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePassword import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePassword
import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePasswordValidationResult import info.nightscout.androidaps.plugins.general.smsCommunicator.otp.OneTimePasswordValidationResult
@ -55,12 +54,14 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
OneTimePasswordValidationResult.ERROR_WRONG_OTP -> "WRONG OTP" OneTimePasswordValidationResult.ERROR_WRONG_OTP -> "WRONG OTP"
} }
binding.otpVerifyLabel.setTextColor(when (checkResult) { binding.otpVerifyLabel.setTextColor(
when (checkResult) {
OneTimePasswordValidationResult.OK -> Color.GREEN OneTimePasswordValidationResult.OK -> Color.GREEN
OneTimePasswordValidationResult.ERROR_WRONG_LENGTH -> Color.YELLOW OneTimePasswordValidationResult.ERROR_WRONG_LENGTH -> Color.YELLOW
OneTimePasswordValidationResult.ERROR_WRONG_PIN -> Color.RED OneTimePasswordValidationResult.ERROR_WRONG_PIN -> Color.RED
OneTimePasswordValidationResult.ERROR_WRONG_OTP -> Color.RED OneTimePasswordValidationResult.ERROR_WRONG_OTP -> Color.RED
}) }
)
} }
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
@ -69,7 +70,8 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
}) })
binding.otpReset.setOnClickListener { binding.otpReset.setOnClickListener {
OKDialog.showConfirmation(this, OKDialog.showConfirmation(
this,
rh.gs(R.string.smscommunicator_otp_reset_title), rh.gs(R.string.smscommunicator_otp_reset_title),
rh.gs(R.string.smscommunicator_otp_reset_prompt), rh.gs(R.string.smscommunicator_otp_reset_prompt),
Runnable { Runnable {
@ -81,7 +83,8 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
} }
binding.otpProvisioning.setOnLongClickListener { binding.otpProvisioning.setOnLongClickListener {
OKDialog.showConfirmation(this, OKDialog.showConfirmation(
this,
rh.gs(R.string.smscommunicator_otp_export_title), rh.gs(R.string.smscommunicator_otp_export_title),
rh.gs(R.string.smscommunicator_otp_export_prompt), rh.gs(R.string.smscommunicator_otp_export_prompt),
Runnable { Runnable {
@ -118,7 +121,5 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
} else { } else {
binding.otpProvisioning.visibility = View.GONE binding.otpProvisioning.visibility = View.GONE
} }
binding.otpVerifyEdit.text = binding.otpVerifyEdit.text
} }
} }