unify units spacing
This commit is contained in:
parent
9ca20f425f
commit
09e5c82d4d
14 changed files with 89 additions and 66 deletions
|
@ -15,14 +15,19 @@ import info.nightscout.androidaps.db.CareportalEvent
|
||||||
import info.nightscout.androidaps.db.Source
|
import info.nightscout.androidaps.db.Source
|
||||||
import info.nightscout.androidaps.db.TempTarget
|
import info.nightscout.androidaps.db.TempTarget
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
|
import info.nightscout.androidaps.plugins.treatments.CarbsGenerator
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.extensions.formatColor
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import kotlinx.android.synthetic.main.dialog_carbs.*
|
import kotlinx.android.synthetic.main.dialog_carbs.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
|
@ -159,13 +164,13 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
val activitySelected = overview_carbs_activity_tt.isChecked
|
val activitySelected = overview_carbs_activity_tt.isChecked
|
||||||
if (activitySelected)
|
if (activitySelected)
|
||||||
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + "<font color='" + resourceHelper.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(activityTT) + " " + unitLabel + " (" + activityTTDuration + " " + resourceHelper.gs(R.string.unit_minute_short) + ")</font>")
|
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(activityTT) + " " + unitLabel + " (" + resourceHelper.gs(R.string.format_mins, activityTTDuration) + ")").formatColor(resourceHelper, R.color.tempTargetConfirmation))
|
||||||
val eatingSoonSelected = overview_carbs_eating_soon_tt.isChecked
|
val eatingSoonSelected = overview_carbs_eating_soon_tt.isChecked
|
||||||
if (eatingSoonSelected)
|
if (eatingSoonSelected)
|
||||||
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + "<font color='" + resourceHelper.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + eatingSoonTTDuration + " " + resourceHelper.gs(R.string.unit_minute_short) + ")</font>")
|
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + resourceHelper.gs(R.string.format_mins, eatingSoonTTDuration) + ")").formatColor(resourceHelper, R.color.tempTargetConfirmation))
|
||||||
val hypoSelected = overview_carbs_hypo_tt.isChecked
|
val hypoSelected = overview_carbs_hypo_tt.isChecked
|
||||||
if (hypoSelected)
|
if (hypoSelected)
|
||||||
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + "<font color='" + resourceHelper.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(hypoTT) + " " + unitLabel + " (" + hypoTTDuration + " " + resourceHelper.gs(R.string.unit_minute_short) + ")</font>")
|
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(hypoTT) + " " + unitLabel + " (" + resourceHelper.gs(R.string.format_mins, hypoTTDuration) + ")").formatColor(resourceHelper, R.color.tempTargetConfirmation))
|
||||||
|
|
||||||
val timeOffset = overview_carbs_time.value.toInt()
|
val timeOffset = overview_carbs_time.value.toInt()
|
||||||
eventTime -= eventTime % 1000
|
eventTime -= eventTime % 1000
|
||||||
|
|
|
@ -17,6 +17,7 @@ import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.SafeParse
|
import info.nightscout.androidaps.utils.SafeParse
|
||||||
|
import info.nightscout.androidaps.utils.extensions.formatColor
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import kotlinx.android.synthetic.main.dialog_extendedbolus.*
|
import kotlinx.android.synthetic.main.dialog_extendedbolus.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
|
@ -68,7 +69,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
actions.add(resourceHelper.gs(R.string.formatinsulinunits, insulinAfterConstraint))
|
actions.add(resourceHelper.gs(R.string.formatinsulinunits, insulinAfterConstraint))
|
||||||
actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes))
|
actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes))
|
||||||
if (abs(insulinAfterConstraint - insulin) > 0.01)
|
if (abs(insulinAfterConstraint - insulin) > 0.01)
|
||||||
actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.constraintapllied) + "</font>")
|
actions.add(resourceHelper.gs(R.string.constraintapllied).formatColor(resourceHelper, R.color.warning))
|
||||||
|
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
|
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
|
||||||
|
|
|
@ -7,8 +7,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import dagger.android.HasAndroidInjector
|
|
||||||
import info.nightscout.androidaps.MainApp
|
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
|
@ -20,18 +18,15 @@ import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.SafeParse
|
import info.nightscout.androidaps.utils.SafeParse
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.extensions.formatColor
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
|
||||||
import kotlinx.android.synthetic.main.dialog_fill.*
|
import kotlinx.android.synthetic.main.dialog_fill.*
|
||||||
import kotlinx.android.synthetic.main.notes.*
|
import kotlinx.android.synthetic.main.notes.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
import org.json.JSONException
|
|
||||||
import org.json.JSONObject
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
@ -97,16 +92,16 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
if (insulinAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0) {
|
||||||
actions.add(resourceHelper.gs(R.string.fillwarning))
|
actions.add(resourceHelper.gs(R.string.fillwarning))
|
||||||
actions.add("")
|
actions.add("")
|
||||||
actions.add(resourceHelper.gs(R.string.bolus) + ": " + "<font color='" + resourceHelper.gc(R.color.colorInsulinButton) + "'>" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump) + resourceHelper.gs(R.string.insulin_unit_shortname) + "</font>")
|
actions.add(resourceHelper.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, resourceHelper).formatColor(resourceHelper, R.color.colorInsulinButton))
|
||||||
if (abs(insulinAfterConstraints - insulin) > 0.01)
|
if (abs(insulinAfterConstraints - insulin) > 0.01)
|
||||||
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarning, resourceHelper.gc(R.color.warning), insulin, insulinAfterConstraints))
|
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(resourceHelper, R.color.warning))
|
||||||
}
|
}
|
||||||
val siteChange = fill_catheter_change.isChecked
|
val siteChange = fill_catheter_change.isChecked
|
||||||
if (siteChange)
|
if (siteChange)
|
||||||
actions.add("" + "<font color='" + resourceHelper.gc(R.color.actionsConfirm) + "'>" + resourceHelper.gs(R.string.record_pump_site_change) + "</font>")
|
actions.add(resourceHelper.gs(R.string.record_pump_site_change).formatColor(resourceHelper, R.color.actionsConfirm))
|
||||||
val insulinChange = fill_cartridge_change.isChecked
|
val insulinChange = fill_cartridge_change.isChecked
|
||||||
if (insulinChange)
|
if (insulinChange)
|
||||||
actions.add("" + "<font color='" + resourceHelper.gc(R.color.actionsConfirm) + "'>" + resourceHelper.gs(R.string.record_insulin_cartridge_change) + "</font>")
|
actions.add(resourceHelper.gs(R.string.record_insulin_cartridge_change).formatColor(resourceHelper, R.color.actionsConfirm))
|
||||||
val notes = notes.text.toString()
|
val notes = notes.text.toString()
|
||||||
if (notes.isNotEmpty())
|
if (notes.isNotEmpty())
|
||||||
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
|
actions.add(resourceHelper.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
|
||||||
|
|
|
@ -26,6 +26,7 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.*
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.extensions.formatColor
|
||||||
import info.nightscout.androidaps.utils.extensions.toSignedString
|
import info.nightscout.androidaps.utils.extensions.toSignedString
|
||||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
@ -137,16 +138,16 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
val eatingSoonChecked = overview_insulin_start_eating_soon_tt.isChecked
|
val eatingSoonChecked = overview_insulin_start_eating_soon_tt.isChecked
|
||||||
|
|
||||||
if (insulinAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0) {
|
||||||
actions.add(resourceHelper.gs(R.string.bolus) + ": " + "<font color='" + resourceHelper.gc(R.color.bolus) + "'>" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump) + resourceHelper.gs(R.string.insulin_unit_shortname) + "</font>")
|
actions.add(resourceHelper.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, resourceHelper).formatColor(resourceHelper, R.color.bolus))
|
||||||
if (recordOnlyChecked)
|
if (recordOnlyChecked)
|
||||||
actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.bolusrecordedonly) + "</font>")
|
actions.add(resourceHelper.gs(R.string.bolusrecordedonly).formatColor(resourceHelper, R.color.warning))
|
||||||
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
||||||
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarning, resourceHelper.gc(R.color.warning), insulin, insulinAfterConstraints))
|
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(resourceHelper, R.color.warning))
|
||||||
}
|
}
|
||||||
val eatingSoonTTDuration = defaultValueHelper.determineEatingSoonTTDuration()
|
val eatingSoonTTDuration = defaultValueHelper.determineEatingSoonTTDuration()
|
||||||
val eatingSoonTT = defaultValueHelper.determineEatingSoonTT()
|
val eatingSoonTT = defaultValueHelper.determineEatingSoonTT()
|
||||||
if (eatingSoonChecked)
|
if (eatingSoonChecked)
|
||||||
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + "<font color='" + resourceHelper.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + eatingSoonTTDuration + " " + resourceHelper.gs(R.string.unit_minute_short) + ")</font>")
|
actions.add(resourceHelper.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + resourceHelper.gs(R.string.format_mins, eatingSoonTTDuration) + ")").formatColor(resourceHelper, R.color.tempTargetConfirmation))
|
||||||
|
|
||||||
val timeOffset = overview_insulin_time.value.toInt()
|
val timeOffset = overview_insulin_time.value.toInt()
|
||||||
val time = DateUtil.now() + T.mins(timeOffset.toLong()).msecs()
|
val time = DateUtil.now() + T.mins(timeOffset.toLong()).msecs()
|
||||||
|
|
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.SafeParse
|
import info.nightscout.androidaps.utils.SafeParse
|
||||||
|
import info.nightscout.androidaps.utils.extensions.formatColor
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import kotlinx.android.synthetic.main.dialog_tempbasal.*
|
import kotlinx.android.synthetic.main.dialog_tempbasal.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
import kotlinx.android.synthetic.main.okcancel.*
|
||||||
|
@ -98,7 +99,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
actions.add(resourceHelper.gs(R.string.tempbasal_label) + ": " + resourceHelper.gs(R.string.pump_basebasalrate, absolute))
|
actions.add(resourceHelper.gs(R.string.tempbasal_label) + ": " + resourceHelper.gs(R.string.pump_basebasalrate, absolute))
|
||||||
actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes))
|
actions.add(resourceHelper.gs(R.string.duration) + ": " + resourceHelper.gs(R.string.format_mins, durationInMinutes))
|
||||||
if (abs(absolute - basalAbsoluteInput) > 0.01)
|
if (abs(absolute - basalAbsoluteInput) > 0.01)
|
||||||
actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.constraintapllied) + "</font>")
|
actions.add(resourceHelper.gs(R.string.constraintapllied).formatColor(resourceHelper, R.color.warning))
|
||||||
}
|
}
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
|
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), Runnable {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.SafeParse
|
import info.nightscout.androidaps.utils.SafeParse
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
import info.nightscout.androidaps.utils.extensions.formatColor
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import kotlinx.android.synthetic.main.dialog_insulin.*
|
import kotlinx.android.synthetic.main.dialog_insulin.*
|
||||||
import kotlinx.android.synthetic.main.dialog_treatment.*
|
import kotlinx.android.synthetic.main.dialog_treatment.*
|
||||||
|
@ -101,16 +102,16 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
val carbsAfterConstraints = constraintChecker.applyCarbsConstraints(Constraint(carbs)).value()
|
val carbsAfterConstraints = constraintChecker.applyCarbsConstraints(Constraint(carbs)).value()
|
||||||
|
|
||||||
if (insulinAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0) {
|
||||||
actions.add(resourceHelper.gs(R.string.bolus) + ": " + "<font color='" + resourceHelper.gc(R.color.bolus) + "'>" + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump) + resourceHelper.gs(R.string.insulin_unit_shortname) + "</font>")
|
actions.add(resourceHelper.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, resourceHelper).formatColor(resourceHelper, R.color.bolus))
|
||||||
if (recordOnlyChecked)
|
if (recordOnlyChecked)
|
||||||
actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.bolusrecordedonly) + "</font>")
|
actions.add(resourceHelper.gs(R.string.bolusrecordedonly).formatColor(resourceHelper, R.color.warning))
|
||||||
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
||||||
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarning, resourceHelper.gc(R.color.warning), insulin, insulinAfterConstraints))
|
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(resourceHelper, R.color.warning))
|
||||||
}
|
}
|
||||||
if (carbsAfterConstraints > 0) {
|
if (carbsAfterConstraints > 0) {
|
||||||
actions.add(resourceHelper.gs(R.string.carbs) + ": " + "<font color='" + resourceHelper.gc(R.color.carbs) + "'>" + resourceHelper.gs(R.string.format_carbs, carbsAfterConstraints) + "</font>")
|
actions.add(resourceHelper.gs(R.string.carbs) + ": " + resourceHelper.gs(R.string.format_carbs, carbsAfterConstraints).formatColor(resourceHelper, R.color.carbs))
|
||||||
if (carbsAfterConstraints != carbs)
|
if (carbsAfterConstraints != carbs)
|
||||||
actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.carbsconstraintapplied) + "</font>")
|
actions.add(resourceHelper.gs(R.string.carbsconstraintapplied).formatColor(resourceHelper, R.color.warning))
|
||||||
}
|
}
|
||||||
if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
|
|
|
@ -20,15 +20,15 @@ import info.nightscout.androidaps.logging.LTag
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
|
||||||
import info.nightscout.androidaps.utils.Round
|
import info.nightscout.androidaps.utils.Round
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.extensions.formatColor
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -275,7 +275,7 @@ class BolusWizard @Inject constructor(
|
||||||
val actions: LinkedList<String> = LinkedList()
|
val actions: LinkedList<String> = LinkedList()
|
||||||
if (insulinAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0) {
|
||||||
val pct = if (percentageCorrection != 100.0) " (" + percentageCorrection.toInt() + "%)" else ""
|
val pct = if (percentageCorrection != 100.0) " (" + percentageCorrection.toInt() + "%)" else ""
|
||||||
actions.add(resourceHelper.gs(R.string.bolus) + ": " + "<font color='" + resourceHelper.gc(R.color.bolus) + "'>" + resourceHelper.gs(R.string.formatinsulinunits, insulinAfterConstraints) + pct + "</font>")
|
actions.add(resourceHelper.gs(R.string.bolus) + ": " + resourceHelper.gs(R.string.formatinsulinunits, insulinAfterConstraints).formatColor(resourceHelper, R.color.bolus) + pct)
|
||||||
}
|
}
|
||||||
if (carbs > 0) {
|
if (carbs > 0) {
|
||||||
var timeShift = ""
|
var timeShift = ""
|
||||||
|
@ -284,19 +284,18 @@ class BolusWizard @Inject constructor(
|
||||||
} else if (carbTime < 0) {
|
} else if (carbTime < 0) {
|
||||||
timeShift += " (-" + resourceHelper.gs(R.string.mins, carbTime) + ")"
|
timeShift += " (-" + resourceHelper.gs(R.string.mins, carbTime) + ")"
|
||||||
}
|
}
|
||||||
actions.add(resourceHelper.gs(R.string.carbs) + ": " + "<font color='" + resourceHelper.gc(R.color.carbs) + "'>" + carbs + "g" + timeShift + "</font>")
|
actions.add(resourceHelper.gs(R.string.carbs) + ": " + resourceHelper.gs(R.string.format_carbs, carbs).formatColor(resourceHelper, R.color.carbs) + timeShift)
|
||||||
}
|
}
|
||||||
if (insulinFromCOB > 0) {
|
if (insulinFromCOB > 0) {
|
||||||
actions.add(resourceHelper.gs(R.string.insulinFromCob, resourceHelper.gc(R.color.cobAlert), insulinFromBolusIOB + insulinFromBasalsIOB + insulinFromCOB + insulinFromBG))
|
actions.add(resourceHelper.gs(R.string.cobvsiob) + ": " + resourceHelper.gs(R.string.formatsignedinsulinunits, insulinFromBolusIOB + insulinFromBasalsIOB + insulinFromCOB + insulinFromBG).formatColor(resourceHelper, R.color.cobAlert))
|
||||||
val absorptionRate = iobCobCalculatorPlugin.slowAbsorptionPercentage(60)
|
val absorptionRate = iobCobCalculatorPlugin.slowAbsorptionPercentage(60)
|
||||||
if (absorptionRate > .25)
|
if (absorptionRate > .25)
|
||||||
actions.add(resourceHelper.gs(R.string.slowabsorptiondetected, resourceHelper.gc(R.color.cobAlert), (absorptionRate * 100).toInt()))
|
actions.add(resourceHelper.gs(R.string.slowabsorptiondetected, resourceHelper.gc(R.color.cobAlert), (absorptionRate * 100).toInt()))
|
||||||
}
|
}
|
||||||
if (abs(insulinAfterConstraints - calculatedTotalInsulin) > pump.pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints)) {
|
if (abs(insulinAfterConstraints - calculatedTotalInsulin) > pump.pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
||||||
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarning, resourceHelper.gc(R.color.warning), calculatedTotalInsulin, insulinAfterConstraints))
|
actions.add(resourceHelper.gs(R.string.bolusconstraintappliedwarn, calculatedTotalInsulin, insulinAfterConstraints).formatColor(resourceHelper, R.color.warning))
|
||||||
}
|
|
||||||
if (config.NSCLIENT)
|
if (config.NSCLIENT)
|
||||||
actions.add("<font color='" + resourceHelper.gc(R.color.warning) + "'>" + resourceHelper.gs(R.string.bolusrecordedonly) + "</font>")
|
actions.add(resourceHelper.gs(R.string.bolusrecordedonly).formatColor(resourceHelper, R.color.warning))
|
||||||
|
|
||||||
return HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))
|
return HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1256,8 +1256,8 @@
|
||||||
<string name="sendsmsactiontext">Send SMS with text</string>
|
<string name="sendsmsactiontext">Send SMS with text</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="insulinFromCob"><![CDATA[COB vs IOB: <font color=\'%1$s\'>%2$+.2fU</font>]]></string>
|
<string name="cobvsiob">COB vs IOB</string>
|
||||||
<string name="bolusconstraintappliedwarning"><![CDATA[<font color=\'%1$s\'>Bolus constraint applied: %2$.2fU to %3$.2fU</font>]]></string>
|
<string name="bolusconstraintappliedwarn">Bolus constraint applied: %1$.2f U to %2$.2f U</string>
|
||||||
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Slow carbs absorption detected: %2$d%% of time. Double check your calculation. COB can be overestimated thus more insulin could be given !!!!!</font>]]></string>
|
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!! Slow carbs absorption detected: %2$d%% of time. Double check your calculation. COB can be overestimated thus more insulin could be given !!!!!</font>]]></string>
|
||||||
<string name="key_boluswizard_percentage" translatable="false">boluswizard_percentage</string>
|
<string name="key_boluswizard_percentage" translatable="false">boluswizard_percentage</string>
|
||||||
<string name="partialboluswizard">Deliver this part of bolus wizard result [%]</string>
|
<string name="partialboluswizard">Deliver this part of bolus wizard result [%]</string>
|
||||||
|
@ -1281,7 +1281,6 @@
|
||||||
<string name="unitsnosemicolon">Units</string>
|
<string name="unitsnosemicolon">Units</string>
|
||||||
<string name="doyouwantswitchprofile">Do you want to switch profile and discard changes made to current profile?</string>
|
<string name="doyouwantswitchprofile">Do you want to switch profile and discard changes made to current profile?</string>
|
||||||
<string name="key_wizard_calculation_visible" translatable="false">wizard_calculation_visible</string>
|
<string name="key_wizard_calculation_visible" translatable="false">wizard_calculation_visible</string>
|
||||||
<string name="format_carbs">%1$dg</string>
|
|
||||||
<string name="common_on">On</string>
|
<string name="common_on">On</string>
|
||||||
<string name="common_off">Off</string>
|
<string name="common_off">Off</string>
|
||||||
<string name="objectives_button_unfinish">Clear finished</string>
|
<string name="objectives_button_unfinish">Clear finished</string>
|
||||||
|
|
|
@ -243,9 +243,9 @@ public class Treatment implements DataPointWithLabelInterface, DbObjectBase {
|
||||||
@Override
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
String label = "";
|
String label = "";
|
||||||
if (insulin > 0) label += DecimalFormatter.toPumpSupportedBolus(insulin, activePlugin.getActivePump()) + "U";
|
if (insulin > 0) label += DecimalFormatter.toPumpSupportedBolus(insulin, activePlugin.getActivePump(), resourceHelper);
|
||||||
if (carbs > 0)
|
if (carbs > 0)
|
||||||
label += "~" + DecimalFormatter.to0Decimal(carbs) + "g";
|
label += "~" + resourceHelper.gs(R.string.format_carbs, (int) carbs);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
val val1 = profile1.getBasalTimeFromMidnight(hour * 60 * 60)
|
val val1 = profile1.getBasalTimeFromMidnight(hour * 60 * 60)
|
||||||
val val2 = profile2.getBasalTimeFromMidnight(hour * 60 * 60)
|
val val2 = profile2.getBasalTimeFromMidnight(hour * 60 * 60)
|
||||||
if (val1 != prev1 || val2 != prev2) {
|
if (val1 != prev1 || val2 != prev2) {
|
||||||
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.00"), resourceHelper.gs(R.string.profile_ins_units_per_hour)))
|
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.00"), " " + resourceHelper.gs(R.string.profile_ins_units_per_hour)))
|
||||||
s.append("<br>")
|
s.append("<br>")
|
||||||
}
|
}
|
||||||
prev1 = val1
|
prev1 = val1
|
||||||
|
@ -217,7 +217,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
val val1 = profile1.getIcTimeFromMidnight(hour * 60 * 60)
|
val val1 = profile1.getIcTimeFromMidnight(hour * 60 * 60)
|
||||||
val val2 = profile2.getIcTimeFromMidnight(hour * 60 * 60)
|
val val2 = profile2.getIcTimeFromMidnight(hour * 60 * 60)
|
||||||
if (val1 != prev1 || val2 != prev2) {
|
if (val1 != prev1 || val2 != prev2) {
|
||||||
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), resourceHelper.gs(R.string.profile_carbs_per_unit)))
|
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), " " + resourceHelper.gs(R.string.profile_carbs_per_unit)))
|
||||||
s.append("<br>")
|
s.append("<br>")
|
||||||
}
|
}
|
||||||
prev1 = val1
|
prev1 = val1
|
||||||
|
@ -234,7 +234,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
||||||
val val1 = Profile.fromMgdlToUnits(profile1.getIsfMgdlTimeFromMidnight(hour * 60 * 60), profile1.units)
|
val val1 = Profile.fromMgdlToUnits(profile1.getIsfMgdlTimeFromMidnight(hour * 60 * 60), profile1.units)
|
||||||
val val2 = Profile.fromMgdlToUnits(profile2.getIsfMgdlTimeFromMidnight(hour * 60 * 60), profile1.units)
|
val val2 = Profile.fromMgdlToUnits(profile2.getIsfMgdlTimeFromMidnight(hour * 60 * 60), profile1.units)
|
||||||
if (val1 != prev1 || val2 != prev2) {
|
if (val1 != prev1 || val2 != prev2) {
|
||||||
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), profile1.units + resourceHelper.gs(R.string.profile_per_unit)))
|
s.append(formatColors(Profile.format_HH_MM(hour * 60 * 60), val1, val2, DecimalFormat("0.0"), profile1.units + " " + resourceHelper.gs(R.string.profile_per_unit)))
|
||||||
s.append("<br>")
|
s.append("<br>")
|
||||||
}
|
}
|
||||||
prev1 = val1
|
prev1 = val1
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class APSResult {
|
||||||
|
|
||||||
// smb
|
// smb
|
||||||
if (smb != 0)
|
if (smb != 0)
|
||||||
ret += ("SMB: " + DecimalFormatter.toPumpSupportedBolus(smb, activePlugin.getActivePump()) + " U\n");
|
ret += ("SMB: " + DecimalFormatter.toPumpSupportedBolus(smb, activePlugin.getActivePump(), resourceHelper) + "\n");
|
||||||
|
|
||||||
if (isCarbsRequired()) {
|
if (isCarbsRequired()) {
|
||||||
ret += getCarbsRequiredText()+"\n";
|
ret += getCarbsRequiredText()+"\n";
|
||||||
|
@ -166,7 +166,7 @@ public class APSResult {
|
||||||
|
|
||||||
// smb
|
// smb
|
||||||
if (smb != 0)
|
if (smb != 0)
|
||||||
ret += ("<b>" + "SMB" + "</b>: " + DecimalFormatter.toPumpSupportedBolus(smb, activePlugin.getActivePump()) + " U<br>");
|
ret += ("<b>" + "SMB" + "</b>: " + DecimalFormatter.toPumpSupportedBolus(smb, activePlugin.getActivePump(), resourceHelper) + "<br>");
|
||||||
|
|
||||||
if (isCarbsRequired()) {
|
if (isCarbsRequired()) {
|
||||||
ret += getCarbsRequiredText()+"<br>";
|
ret += getCarbsRequiredText()+"<br>";
|
||||||
|
|
|
@ -2,7 +2,9 @@ package info.nightscout.androidaps.utils;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.core.R;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 11.07.2016.
|
* Created by mike on 11.07.2016.
|
||||||
|
@ -51,6 +53,12 @@ public class DecimalFormatter {
|
||||||
: to1Decimal(value);
|
: to1Decimal(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String toPumpSupportedBolus(double value, PumpInterface pump, ResourceHelper resourceHelper) {
|
||||||
|
return pump.getPumpDescription().bolusStep <= 0.051
|
||||||
|
? resourceHelper.gs(R.string.formatinsulinunits, value)
|
||||||
|
: resourceHelper.gs(R.string.formatinsulinunits1, value);
|
||||||
|
}
|
||||||
|
|
||||||
public static DecimalFormat pumpSupportedBolusFormat(PumpInterface pump) {
|
public static DecimalFormat pumpSupportedBolusFormat(PumpInterface pump) {
|
||||||
return pump.getPumpDescription().bolusStep <= 0.051
|
return pump.getPumpDescription().bolusStep <= 0.051
|
||||||
? new DecimalFormat("0.00")
|
? new DecimalFormat("0.00")
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package info.nightscout.androidaps.utils.extensions
|
||||||
|
|
||||||
|
import androidx.annotation.ColorRes
|
||||||
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
|
||||||
|
fun String.formatBold(): String =
|
||||||
|
"<b>$this</b>"
|
||||||
|
|
||||||
|
fun String.formatColor(resourceHelper: ResourceHelper, @ColorRes colorId: Int): String =
|
||||||
|
"<font color='" + resourceHelper.gc(colorId) + "'>" + this + "</font>"
|
||||||
|
|
|
@ -41,12 +41,14 @@
|
||||||
<string name="disconnected">Disconnected</string>
|
<string name="disconnected">Disconnected</string>
|
||||||
<string name="disconnecting">Disconnecting</string>
|
<string name="disconnecting">Disconnecting</string>
|
||||||
<string name="androidaps_start">AndroidAPS started</string>
|
<string name="androidaps_start">AndroidAPS started</string>
|
||||||
|
<string name="formatinsulinunits1">%1$.1f U</string>
|
||||||
<string name="formatinsulinunits">%1$.2f U</string>
|
<string name="formatinsulinunits">%1$.2f U</string>
|
||||||
|
<string name="formatsignedinsulinunits">%1$+.2f U</string>
|
||||||
|
<string name="format_carbs">%1$d g</string>
|
||||||
<string name="reservoirvalue">%1$.0f / %2$d U</string>
|
<string name="reservoirvalue">%1$.0f / %2$d U</string>
|
||||||
<string name="pump_basebasalrate">%1$.2f U/h</string>
|
<string name="pump_basebasalrate">%1$.2f U/h</string>
|
||||||
<string name="format_hours">%1$.2f h</string>
|
<string name="format_hours">%1$.2f h</string>
|
||||||
<string name="format_mins">%1$d mins</string>
|
<string name="format_mins">%1$d mins</string>
|
||||||
<string name="format_mins_short">%1$dm</string>
|
|
||||||
<string name="pumpbusy">Pump is busy</string>
|
<string name="pumpbusy">Pump is busy</string>
|
||||||
<string name="connectionerror">Pump connection error</string>
|
<string name="connectionerror">Pump connection error</string>
|
||||||
<string name="youareonallowedlimit">You reached allowed limit</string>
|
<string name="youareonallowedlimit">You reached allowed limit</string>
|
||||||
|
|
Loading…
Reference in a new issue