TreatmentDialog -> ui
This commit is contained in:
parent
18b434b2e2
commit
ccb42caa60
17 changed files with 87 additions and 85 deletions
|
@ -15,6 +15,7 @@ import androidx.work.PeriodicWorkRequest
|
|||
import androidx.work.WorkManager
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.DaggerApplication
|
||||
import info.activityMonitor.ActivityMonitor
|
||||
import info.nightscout.androidaps.db.CompatDBHelper
|
||||
import info.nightscout.androidaps.di.DaggerAppComponent
|
||||
import info.nightscout.androidaps.di.StaticInjector
|
||||
|
@ -47,7 +48,6 @@ import info.nightscout.rx.logging.LTag
|
|||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.ui.activityMonitor.ActivityMonitor
|
||||
import info.nightscout.ui.widget.Widget
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.exceptions.UndeliverableException
|
||||
|
@ -65,7 +65,7 @@ class MainApp : DaggerApplication() {
|
|||
|
||||
@Inject lateinit var pluginStore: PluginStore
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||
@Inject lateinit var activityMonitor: info.activityMonitor.ActivityMonitor
|
||||
@Inject lateinit var versionCheckersUtils: VersionCheckerUtils
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var config: Config
|
||||
|
|
|
@ -8,7 +8,6 @@ import info.nightscout.androidaps.dialogs.NtpProgressDialog
|
|||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.dialogs.TempBasalDialog
|
||||
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
||||
import info.nightscout.androidaps.dialogs.TreatmentDialog
|
||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||
import info.nightscout.androidaps.plugins.aps.OpenAPSFragment
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopFragment
|
||||
|
@ -44,7 +43,6 @@ abstract class FragmentsModule {
|
|||
@ContributesAndroidInjector abstract fun contributesProfileSwitchDialog(): ProfileSwitchDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTempBasalDialog(): TempBasalDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTempTargetDialog(): TempTargetDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentDialog(): TreatmentDialog
|
||||
@ContributesAndroidInjector abstract fun contributesWizardDialog(): WizardDialog
|
||||
@ContributesAndroidInjector abstract fun contributesNtpProgressDialog(): NtpProgressDialog
|
||||
@ContributesAndroidInjector abstract fun contributesPasswordCheck(): PasswordCheck
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
|
|
@ -30,11 +30,9 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
|
||||
import info.nightscout.ui.dialogs.InsulinDialog
|
||||
import info.nightscout.androidaps.dialogs.LoopDialog
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
||||
import info.nightscout.androidaps.dialogs.TreatmentDialog
|
||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
||||
import info.nightscout.androidaps.events.EventNewBG
|
||||
|
@ -60,8 +58,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOve
|
|||
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
||||
import info.nightscout.plugins.source.DexcomPlugin
|
||||
import info.nightscout.plugins.source.XdripPlugin
|
||||
import info.nightscout.androidaps.skins.SkinProvider
|
||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
|
@ -92,6 +88,8 @@ import info.nightscout.interfaces.utils.JsonHelper
|
|||
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||
import info.nightscout.plugins.general.overview.notifications.NotificationStore
|
||||
import info.nightscout.plugins.general.overview.notifications.events.EventUpdateOverviewNotification
|
||||
import info.nightscout.plugins.source.DexcomPlugin
|
||||
import info.nightscout.plugins.source.XdripPlugin
|
||||
import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus
|
||||
import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
|
@ -112,6 +110,8 @@ import info.nightscout.shared.sharedPreferences.SP
|
|||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.ui.dialogs.CalibrationDialog
|
||||
import info.nightscout.ui.dialogs.CarbsDialog
|
||||
import info.nightscout.ui.dialogs.InsulinDialog
|
||||
import info.nightscout.ui.dialogs.TreatmentDialog
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import java.util.Locale
|
||||
|
|
|
@ -348,9 +348,9 @@ class BolusWizard @Inject constructor(
|
|||
actions.add(rh.gs(R.string.slowabsorptiondetected, rh.gac(context, R.attr.cobAlertColor), (absorptionRate * 100).toInt()))
|
||||
}
|
||||
if (abs(insulinAfterConstraints - calculatedTotalInsulin) > activePlugin.activePump.pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
||||
actions.add(rh.gs(R.string.bolusconstraintappliedwarn, calculatedTotalInsulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
actions.add(rh.gs(R.string.bolus_constraint_applied_warn, calculatedTotalInsulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
if (config.NSCLIENT && insulinAfterConstraints > 0)
|
||||
actions.add(rh.gs(R.string.bolusrecordedonly).formatColor(context, rh, R.attr.warningColor))
|
||||
actions.add(rh.gs(R.string.bolus_recorded_only).formatColor(context, rh, R.attr.warningColor))
|
||||
if (useAlarm && !advisor && carbs > 0 && carbTime > 0)
|
||||
actions.add(rh.gs(R.string.alarminxmin, carbTime).formatColor(context, rh, R.attr.infoColor))
|
||||
if (advisor)
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
android:id="@+id/nav_defaultprofile"
|
||||
android:orderInCategory="1"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/nav_profilehelper" />
|
||||
android:title="@string/nav_profile_helper" />
|
||||
<group android:id="@+id/about_exit">
|
||||
<item
|
||||
android:id="@+id/nav_about"
|
||||
|
|
|
@ -203,8 +203,8 @@
|
|||
</androidx.preference.PreferenceScreen>
|
||||
|
||||
<androidx.preference.PreferenceScreen
|
||||
android:key="@string/fillbolus_title"
|
||||
android:title="@string/fillbolus_title">
|
||||
android:key="@string/fill_bolus_title"
|
||||
android:title="@string/fill_bolus_title">
|
||||
|
||||
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||
android:defaultValue="0.3"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.ui.activityMonitor
|
||||
package info.activityMonitor
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
|
@ -10,14 +10,13 @@ import android.view.ViewGroup
|
|||
import android.widget.TableLayout
|
||||
import android.widget.TableRow
|
||||
import android.widget.TextView
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.shared.SafeParse
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
||||
import info.nightscout.shared.SafeParse
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.ui.R
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
|
@ -89,20 +89,20 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
|||
})
|
||||
|
||||
val profileTypeList = Lists.newArrayList(
|
||||
rh.gs(R.string.motoldefaultprofile),
|
||||
rh.gs(R.string.dpvdefaultprofile),
|
||||
rh.gs(R.string.currentprofile),
|
||||
rh.gs(R.string.availableprofile),
|
||||
rh.gs(R.string.motol_default_profile),
|
||||
rh.gs(R.string.dpv_default_profile),
|
||||
rh.gs(R.string.current_profile),
|
||||
rh.gs(R.string.available_profile),
|
||||
rh.gs(R.string.careportal_profileswitch)
|
||||
)
|
||||
binding.profileType.setAdapter(ArrayAdapter(this, R.layout.spinner_centered, profileTypeList))
|
||||
|
||||
binding.profileType.setOnItemClickListener { _, _, _, _ ->
|
||||
when (binding.profileType.text.toString()) {
|
||||
rh.gs(R.string.motoldefaultprofile) -> switchTab(tabSelected, ProfileType.MOTOL_DEFAULT)
|
||||
rh.gs(R.string.dpvdefaultprofile) -> switchTab(tabSelected, ProfileType.DPV_DEFAULT)
|
||||
rh.gs(R.string.currentprofile) -> switchTab(tabSelected, ProfileType.CURRENT)
|
||||
rh.gs(R.string.availableprofile) -> switchTab(tabSelected, ProfileType.AVAILABLE_PROFILE)
|
||||
rh.gs(R.string.motol_default_profile) -> switchTab(tabSelected, ProfileType.MOTOL_DEFAULT)
|
||||
rh.gs(R.string.dpv_default_profile) -> switchTab(tabSelected, ProfileType.DPV_DEFAULT)
|
||||
rh.gs(R.string.current_profile) -> switchTab(tabSelected, ProfileType.CURRENT)
|
||||
rh.gs(R.string.available_profile) -> switchTab(tabSelected, ProfileType.AVAILABLE_PROFILE)
|
||||
rh.gs(R.string.careportal_profileswitch) -> switchTab(tabSelected, ProfileType.PROFILE_SWITCH)
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
|||
return@setOnClickListener
|
||||
}
|
||||
if ((pctUsed[i] < 32 || pctUsed[i] > 37)) {
|
||||
ToastUtils.warnToast(this, R.string.invalidpct)
|
||||
ToastUtils.warnToast(this, R.string.invalid_pct)
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
private fun getProfileName(age: Double, tdd: Double, weight: Double, basalSumPct: Double, tab: Int): String =
|
||||
when (typeSelected[tab]) {
|
||||
ProfileType.MOTOL_DEFAULT -> if (tdd > 0) rh.gs(R.string.formatwithtdd, age, tdd) else rh.gs(R.string.formatwithweight, age, weight)
|
||||
ProfileType.DPV_DEFAULT -> rh.gs(R.string.formatwittddandpct, age, tdd, (basalSumPct * 100).toInt())
|
||||
ProfileType.MOTOL_DEFAULT -> if (tdd > 0) rh.gs(R.string.format_with_tdd, age, tdd) else rh.gs(R.string.format_with_weight, age, weight)
|
||||
ProfileType.DPV_DEFAULT -> rh.gs(R.string.format_with_tdd_and_pct, age, tdd, (basalSumPct * 100).toInt())
|
||||
ProfileType.CURRENT -> profileFunction.getProfileName()
|
||||
ProfileType.AVAILABLE_PROFILE -> profileList[profileUsed[tab]].toString()
|
||||
ProfileType.PROFILE_SWITCH -> profileSwitch[profileSwitchUsed[tab]].originalCustomizedName
|
||||
|
@ -283,10 +283,10 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
|
|||
// Show new content
|
||||
binding.profileType.setText(
|
||||
when (typeSelected[tabSelected]) {
|
||||
ProfileType.MOTOL_DEFAULT -> rh.gs(R.string.motoldefaultprofile)
|
||||
ProfileType.DPV_DEFAULT -> rh.gs(R.string.dpvdefaultprofile)
|
||||
ProfileType.CURRENT -> rh.gs(R.string.currentprofile)
|
||||
ProfileType.AVAILABLE_PROFILE -> rh.gs(R.string.availableprofile)
|
||||
ProfileType.MOTOL_DEFAULT -> rh.gs(R.string.motol_default_profile)
|
||||
ProfileType.DPV_DEFAULT -> rh.gs(R.string.dpv_default_profile)
|
||||
ProfileType.CURRENT -> rh.gs(R.string.current_profile)
|
||||
ProfileType.AVAILABLE_PROFILE -> rh.gs(R.string.available_profile)
|
||||
ProfileType.PROFILE_SWITCH -> rh.gs(R.string.careportal_profileswitch)
|
||||
},
|
||||
false
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.ui.activities
|
|||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import info.activityMonitor.ActivityMonitor
|
||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.androidaps.interfaces.stats.DexcomTirCalculator
|
||||
import info.nightscout.androidaps.interfaces.stats.TddCalculator
|
||||
|
@ -15,7 +16,6 @@ import info.nightscout.database.entities.UserEntry.Sources
|
|||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.ui.R
|
||||
import info.nightscout.ui.databinding.ActivityStatsBinding
|
||||
import info.nightscout.ui.activityMonitor.ActivityMonitor
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
|
@ -26,7 +26,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var tddCalculator: TddCalculator
|
||||
@Inject lateinit var tirCalculator: TirCalculator
|
||||
@Inject lateinit var dexcomTirCalculator: DexcomTirCalculator
|
||||
@Inject lateinit var activityMonitor: ActivityMonitor
|
||||
@Inject lateinit var activityMonitor: info.activityMonitor.ActivityMonitor
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
|
|
|
@ -23,6 +23,7 @@ import info.nightscout.ui.dialogs.ExtendedBolusDialog
|
|||
import info.nightscout.ui.dialogs.FillDialog
|
||||
import info.nightscout.ui.dialogs.InsulinDialog
|
||||
import info.nightscout.ui.dialogs.ProfileViewerDialog
|
||||
import info.nightscout.ui.dialogs.TreatmentDialog
|
||||
import info.nightscout.ui.dialogs.WizardInfoDialog
|
||||
|
||||
@Module
|
||||
|
@ -37,6 +38,7 @@ abstract class UiModule {
|
|||
@ContributesAndroidInjector abstract fun contributesExtendedBolusDialog(): ExtendedBolusDialog
|
||||
@ContributesAndroidInjector abstract fun contributesFillDialog(): FillDialog
|
||||
@ContributesAndroidInjector abstract fun contributesInsulinDialog(): InsulinDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTreatmentDialog(): TreatmentDialog
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
|
||||
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
|
||||
|
|
|
@ -118,11 +118,11 @@ class FillDialog : DialogFragmentWithDate() {
|
|||
|
||||
val insulinAfterConstraints = constraintChecker.applyBolusConstraints(Constraint(insulin)).value()
|
||||
if (insulinAfterConstraints > 0) {
|
||||
actions.add(rh.gs(R.string.fillwarning))
|
||||
actions.add(rh.gs(R.string.fill_warning))
|
||||
actions.add("")
|
||||
actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(context, rh, R.attr.insulinButtonColor))
|
||||
if (abs(insulinAfterConstraints - insulin) > 0.01)
|
||||
actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
actions.add(rh.gs(R.string.bolus_constraint_applied_warn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
}
|
||||
val siteChange = binding.fillCatheterChange.isChecked
|
||||
if (siteChange)
|
||||
|
|
|
@ -199,9 +199,9 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
if (insulinAfterConstraints > 0) {
|
||||
actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(context, rh, R.attr.bolusColor))
|
||||
if (recordOnlyChecked)
|
||||
actions.add(rh.gs(R.string.bolusrecordedonly).formatColor(context, rh, R.attr.warningColor))
|
||||
actions.add(rh.gs(R.string.bolus_recorded_only).formatColor(context, rh, R.attr.warningColor))
|
||||
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
||||
actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
actions.add(rh.gs(R.string.bolus_constraint_applied_warn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
}
|
||||
val eatingSoonTTDuration = defaultValueHelper.determineEatingSoonTTDuration()
|
||||
val eatingSoonTT = defaultValueHelper.determineEatingSoonTT()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
package info.nightscout.ui.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
|
@ -8,8 +8,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.google.common.base.Joiner
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
|
||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||
import info.nightscout.androidaps.extensions.formatColor
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
|
@ -19,11 +18,9 @@ import info.nightscout.androidaps.utils.DecimalFormatter
|
|||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||
import info.nightscout.core.pumpExtensions.insertBolusTransaction
|
||||
import info.nightscout.core.pumpExtensions.insertCarbsTransaction
|
||||
import info.nightscout.database.entities.UserEntry.Action
|
||||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.database.entities.ValueWithUnit
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.Config
|
||||
|
@ -35,6 +32,8 @@ import info.nightscout.interfaces.utils.HtmlHelper
|
|||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.shared.SafeParse
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.ui.R
|
||||
import info.nightscout.ui.databinding.DialogTreatmentBinding
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import java.text.DecimalFormat
|
||||
|
@ -89,8 +88,10 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
savedInstanceState.putDouble("insulin", binding.insulin.value)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
onCreateViewGeneral()
|
||||
_binding = DialogTreatmentBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
|
@ -106,10 +107,14 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
val maxCarbs = constraintChecker.getMaxCarbsAllowed().value().toDouble()
|
||||
val maxInsulin = constraintChecker.getMaxBolusAllowed().value()
|
||||
val pumpDescription = activePlugin.activePump.pumpDescription
|
||||
binding.carbs.setParams(savedInstanceState?.getDouble("carbs")
|
||||
?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher)
|
||||
binding.insulin.setParams(savedInstanceState?.getDouble("insulin")
|
||||
?: 0.0, 0.0, maxInsulin, pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.okcancel.ok, textWatcher)
|
||||
binding.carbs.setParams(
|
||||
savedInstanceState?.getDouble("carbs")
|
||||
?: 0.0, 0.0, maxCarbs, 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher
|
||||
)
|
||||
binding.insulin.setParams(
|
||||
savedInstanceState?.getDouble("insulin")
|
||||
?: 0.0, 0.0, maxInsulin, pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.okcancel.ok, textWatcher
|
||||
)
|
||||
binding.recordOnlyLayout.visibility = View.GONE
|
||||
binding.insulinLabel.labelFor = binding.insulin.editTextId
|
||||
binding.carbsLabel.labelFor = binding.carbs.editTextId
|
||||
|
@ -133,9 +138,9 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
if (insulinAfterConstraints > 0) {
|
||||
actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(context, rh, R.attr.bolusColor))
|
||||
if (recordOnlyChecked)
|
||||
actions.add(rh.gs(R.string.bolusrecordedonly).formatColor(context, rh, R.attr.warningColor))
|
||||
actions.add(rh.gs(R.string.bolus_recorded_only).formatColor(context, rh, R.attr.warningColor))
|
||||
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
|
||||
actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
actions.add(rh.gs(R.string.bolus_constraint_applied_warn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
|
||||
}
|
||||
if (carbsAfterConstraints > 0) {
|
||||
actions.add(rh.gs(R.string.carbs) + ": " + rh.gs(R.string.format_carbs, carbsAfterConstraints).formatColor(context, rh, R.attr.carbsColor))
|
||||
|
@ -146,9 +151,9 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, rh.gs(R.string.overview_treatment_label), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||
val action = when {
|
||||
insulinAfterConstraints.equals(0.0) -> Action.CARBS
|
||||
carbsAfterConstraints == 0 -> Action.BOLUS
|
||||
else -> Action.TREATMENT
|
||||
insulinAfterConstraints.equals(0.0) -> UserEntry.Action.CARBS
|
||||
carbsAfterConstraints == 0 -> UserEntry.Action.BOLUS
|
||||
else -> UserEntry.Action.TREATMENT
|
||||
}
|
||||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = DetailedBolusInfo.EventType.CARBS_CORRECTION
|
||||
|
@ -157,7 +162,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
detailedBolusInfo.carbs = carbsAfterConstraints.toDouble()
|
||||
detailedBolusInfo.context = context
|
||||
if (recordOnlyChecked) {
|
||||
uel.log(action, Sources.TreatmentDialog, if (insulinAfterConstraints != 0.0) rh.gs(R.string.record) else "",
|
||||
uel.log(action, UserEntry.Sources.TreatmentDialog, if (insulinAfterConstraints != 0.0) rh.gs(R.string.record) else "",
|
||||
ValueWithUnit.Timestamp(detailedBolusInfo.timestamp).takeIf { eventTimeChanged },
|
||||
ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.record)).takeIf { insulinAfterConstraints != 0.0 },
|
||||
ValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 },
|
||||
|
@ -176,7 +181,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
)
|
||||
} else {
|
||||
if (detailedBolusInfo.insulin > 0) {
|
||||
uel.log(action, Sources.TreatmentDialog,
|
||||
uel.log(action, UserEntry.Sources.TreatmentDialog,
|
||||
ValueWithUnit.Insulin(insulinAfterConstraints),
|
||||
ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
|
||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
|
@ -187,7 +192,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
}
|
||||
})
|
||||
} else {
|
||||
uel.log(action, Sources.TreatmentDialog,
|
||||
uel.log(action, UserEntry.Sources.TreatmentDialog,
|
||||
ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
|
||||
if (detailedBolusInfo.carbs > 0) {
|
||||
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
|
||||
|
@ -209,7 +214,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if(!queryingProtection) {
|
||||
if (!queryingProtection) {
|
||||
queryingProtection = true
|
||||
activity?.let { activity ->
|
||||
val cancelFail = {
|
||||
|
@ -218,7 +223,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||
dismiss()
|
||||
}
|
||||
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
|
||||
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:hint="@string/profiletype"
|
||||
android:hint="@string/profile_type"
|
||||
android:paddingHorizontal="5dp">
|
||||
|
||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||
|
@ -140,14 +140,14 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/basalpctfromtdd_label"
|
||||
android:text="@string/basal_pct_from_tdd_label"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
<info.nightscout.androidaps.utils.ui.NumberPicker
|
||||
android:id="@+id/basal_pct_from_tdd"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="40dp"
|
||||
app:customContentDescription="@string/basalpctfromtdd_label" />
|
||||
app:customContentDescription="@string/basal_pct_from_tdd_label" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -240,7 +240,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_compare_profiles"
|
||||
android:text="@string/comapareprofile" />
|
||||
android:text="@string/compare_profile" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
|
||||
<!-- Dialogs -->
|
||||
<string name="bolusconstraintappliedwarn">Bolus constraint applied: %1$.2f U to %2$.2f U</string>
|
||||
<string name="bolus_constraint_applied_warn">Bolus constraint applied: %1$.2f U to %2$.2f U</string>
|
||||
|
||||
<string name="glucose_type">Glucose type</string>
|
||||
<string name="bg_other">Other</string>
|
||||
|
@ -50,8 +50,8 @@
|
|||
<string name="treatments_wizard_total_label">Total</string>
|
||||
|
||||
<!-- FillDialog -->
|
||||
<string name="fillwarning">Please make sure the amount matches the specification of your infusion set!</string>
|
||||
<string name="fillbolus_title">Fill/Prime standard insulin amounts</string>
|
||||
<string name="fill_warning">Please make sure the amount matches the specification of your infusion set!</string>
|
||||
<string name="fill_bolus_title">Fill/Prime standard insulin amounts</string>
|
||||
<string name="button1">Button 1</string>
|
||||
<string name="button2">Button 2</string>
|
||||
<string name="button3">Button 3</string>
|
||||
|
@ -63,7 +63,7 @@
|
|||
<string name="key_insulin_button_increment_2" translatable="false">insulin_button_increment_2</string>
|
||||
<string name="key_insulin_button_increment_3" translatable="false">insulin_button_increment_3</string>
|
||||
<string name="do_not_bolus_record_only">Do not bolus, record only</string>
|
||||
<string name="bolusrecordedonly">Bolus will be recorded only (not delivered by pump)</string>
|
||||
<string name="bolus_recorded_only">Bolus will be recorded only (not delivered by pump)</string>
|
||||
|
||||
|
||||
<!-- Treatments -->
|
||||
|
@ -103,18 +103,18 @@
|
|||
<!-- ProfileHelperActivity -->
|
||||
<string name="profile1">Profile 1</string>
|
||||
<string name="profile2">Profile 2</string>
|
||||
<string name="profiletype">Profile type</string>
|
||||
<string name="basalpctfromtdd_label">% of basal</string>
|
||||
<string name="profile_type">Profile type</string>
|
||||
<string name="basal_pct_from_tdd_label">% of basal</string>
|
||||
<string name="selected_profile">Selected:</string>
|
||||
<string name="comapareprofile">Compare profiles</string>
|
||||
<string name="nav_profilehelper">Profile helper</string>
|
||||
<string name="motoldefaultprofile">Default profile</string>
|
||||
<string name="currentprofile">Current profile</string>
|
||||
<string name="availableprofile">Available profile</string>
|
||||
<string name="formatwithtdd">Age: %1$.0f TDD: %2$.0f U</string>
|
||||
<string name="formatwittddandpct">Age: %1$.0f TDD: %2$.0f U %3$d%%</string>
|
||||
<string name="formatwithweight">Age: %1$.0f Weight: %2$.0f kg</string>
|
||||
<string name="dpvdefaultprofile">DPV Default profile</string>
|
||||
<string name="invalidpct">Invalid % entry</string>
|
||||
<string name="compare_profile">Compare profiles</string>
|
||||
<string name="nav_profile_helper">Profile helper</string>
|
||||
<string name="motol_default_profile">Default profile</string>
|
||||
<string name="current_profile">Current profile</string>
|
||||
<string name="available_profile">Available profile</string>
|
||||
<string name="format_with_tdd">Age: %1$.0f TDD: %2$.0f U</string>
|
||||
<string name="format_with_tdd_and_pct">Age: %1$.0f TDD: %2$.0f U %3$d%%</string>
|
||||
<string name="format_with_weight">Age: %1$.0f Weight: %2$.0f kg</string>
|
||||
<string name="dpv_default_profile">DPV Default profile</string>
|
||||
<string name="invalid_pct">Invalid % entry</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue