Objectives: show I have learned
This commit is contained in:
parent
5ca85f3c1c
commit
e20df7a4c3
15 changed files with 401 additions and 292 deletions
|
@ -2,24 +2,38 @@ package info.nightscout.plugins.constraints.di
|
|||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.plugins.constraints.objectives.ObjectivesFragment
|
||||
import info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog
|
||||
import info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective0
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective1
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective10
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective2
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective3
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective4
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective5
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective6
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective7
|
||||
import info.nightscout.plugins.constraints.objectives.objectives.Objective9
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
abstract class ObjectivesModule {
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesObjectivesFragment(): info.nightscout.plugins.constraints.objectives.ObjectivesFragment
|
||||
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): info.nightscout.plugins.constraints.objectives.activities.ObjectivesExamDialog
|
||||
@ContributesAndroidInjector abstract fun contributesNtpProgressDialog(): info.nightscout.plugins.constraints.objectives.dialogs.NtpProgressDialog
|
||||
@ContributesAndroidInjector abstract fun contributesObjectivesFragment(): ObjectivesFragment
|
||||
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): ObjectivesExamDialog
|
||||
@ContributesAndroidInjector abstract fun contributesNtpProgressDialog(): NtpProgressDialog
|
||||
|
||||
@ContributesAndroidInjector abstract fun objectiveInjector(): info.nightscout.plugins.constraints.objectives.objectives.Objective
|
||||
@ContributesAndroidInjector abstract fun objective0Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective0
|
||||
@ContributesAndroidInjector abstract fun objective1Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective1
|
||||
@ContributesAndroidInjector abstract fun objective2Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective2
|
||||
@ContributesAndroidInjector abstract fun objective3Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective3
|
||||
@ContributesAndroidInjector abstract fun objective4Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective4
|
||||
@ContributesAndroidInjector abstract fun objective5Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective5
|
||||
@ContributesAndroidInjector abstract fun objective6Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective6
|
||||
@ContributesAndroidInjector abstract fun objective7Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective7
|
||||
@ContributesAndroidInjector abstract fun objective9Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective9
|
||||
@ContributesAndroidInjector abstract fun objective10Injector(): info.nightscout.plugins.constraints.objectives.objectives.Objective10
|
||||
@ContributesAndroidInjector abstract fun objectiveInjector(): Objective
|
||||
@ContributesAndroidInjector abstract fun objective0Injector(): Objective0
|
||||
@ContributesAndroidInjector abstract fun objective1Injector(): Objective1
|
||||
@ContributesAndroidInjector abstract fun objective2Injector(): Objective2
|
||||
@ContributesAndroidInjector abstract fun objective3Injector(): Objective3
|
||||
@ContributesAndroidInjector abstract fun objective4Injector(): Objective4
|
||||
@ContributesAndroidInjector abstract fun objective5Injector(): Objective5
|
||||
@ContributesAndroidInjector abstract fun objective6Injector(): Objective6
|
||||
@ContributesAndroidInjector abstract fun objective7Injector(): Objective7
|
||||
@ContributesAndroidInjector abstract fun objective9Injector(): Objective9
|
||||
@ContributesAndroidInjector abstract fun objective10Injector(): Objective10
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.plugins.constraints.objectives
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
|
@ -159,13 +160,13 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
if (objective.objective != 0) {
|
||||
holder.binding.objective.visibility = View.VISIBLE
|
||||
holder.binding.objective.text = rh.gs(objective.objective)
|
||||
} else
|
||||
holder.binding.objective.visibility = View.GONE
|
||||
} else holder.binding.objective.visibility = View.GONE
|
||||
|
||||
if (objective.gate != 0) {
|
||||
holder.binding.gate.visibility = View.VISIBLE
|
||||
holder.binding.gate.text = rh.gs(objective.gate)
|
||||
} else
|
||||
holder.binding.gate.visibility = View.GONE
|
||||
} else holder.binding.gate.visibility = View.GONE
|
||||
|
||||
if (!objective.isStarted) {
|
||||
holder.binding.gate.setTextColor(rh.gac(context, info.nightscout.core.ui.R.attr.defaultTextColor))
|
||||
holder.binding.verify.visibility = View.GONE
|
||||
|
@ -173,6 +174,8 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
holder.binding.accomplished.visibility = View.GONE
|
||||
holder.binding.unfinish.visibility = View.GONE
|
||||
holder.binding.unstart.visibility = View.GONE
|
||||
holder.binding.learnedLabel.visibility = View.GONE
|
||||
holder.binding.learned.removeAllViews()
|
||||
if (position == 0 || objectivesPlugin.allPriorAccomplished(position))
|
||||
holder.binding.start.visibility = View.VISIBLE
|
||||
else
|
||||
|
@ -185,6 +188,14 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
holder.binding.accomplished.visibility = View.VISIBLE
|
||||
holder.binding.unfinish.visibility = View.VISIBLE
|
||||
holder.binding.unstart.visibility = View.GONE
|
||||
holder.binding.learnedLabel.visibility = View.VISIBLE
|
||||
holder.binding.learned.removeAllViews()
|
||||
for (task in objective.tasks) {
|
||||
if (task.shouldBeIgnored()) continue
|
||||
for (learned in task.learned) {
|
||||
holder.binding.learned.addView(TextView(context).also { it.text = rh.gs(learned.learned) })
|
||||
}
|
||||
}
|
||||
} else if (objective.isStarted) {
|
||||
holder.binding.gate.setTextColor(rh.gac(context, info.nightscout.core.ui.R.attr.defaultTextColor))
|
||||
holder.binding.verify.visibility = View.VISIBLE
|
||||
|
@ -195,12 +206,14 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
holder.binding.unstart.visibility = View.VISIBLE
|
||||
holder.binding.progress.visibility = View.VISIBLE
|
||||
holder.binding.progress.removeAllViews()
|
||||
holder.binding.learnedLabel.visibility = View.GONE
|
||||
holder.binding.learned.removeAllViews()
|
||||
for (task in objective.tasks) {
|
||||
if (task.shouldBeIgnored()) continue
|
||||
// name
|
||||
val name = TextView(holder.binding.progress.context)
|
||||
name.text = "${rh.gs(task.task)}:"
|
||||
name.setTextColor(rh.gac(context, info.nightscout.core.ui.R.attr.defaultTextColor) )
|
||||
name.setTextColor(rh.gac(context, info.nightscout.core.ui.R.attr.defaultTextColor))
|
||||
holder.binding.progress.addView(name, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
// hint
|
||||
task.hints.forEach { h ->
|
||||
|
@ -226,6 +239,16 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
dialog.show(childFragmentManager, "ObjectivesFragment")
|
||||
}
|
||||
}
|
||||
if (task.isCompleted()) {
|
||||
if (task.learned.isNotEmpty())
|
||||
holder.binding.progress.addView(
|
||||
TextView(context).also {
|
||||
it.text = rh.gs(R.string.what_i_ve_learned)
|
||||
it.setTypeface(it.typeface, Typeface.BOLD)
|
||||
})
|
||||
for (learned in task.learned)
|
||||
holder.binding.progress.addView(TextView(context).also { it.text = rh.gs(learned.learned) })
|
||||
}
|
||||
// horizontal line
|
||||
val separator = View(holder.binding.progress.context)
|
||||
separator.setBackgroundColor(rh.gac(context, info.nightscout.core.ui.R.attr.separatorColor))
|
||||
|
@ -325,26 +348,6 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
rxBus.send(EventObjectivesUpdateGui())
|
||||
rxBus.send(EventSWUpdate(false))
|
||||
}
|
||||
if (objective.hasSpecialInput && !objective.isAccomplished && objective.isStarted && objective.specialActionEnabled()) {
|
||||
// generate random request code if none exists
|
||||
val request = sp.getString(R.string.key_objectives_request_code, String.format("%1$05d", (Math.random() * 99999).toInt()))
|
||||
sp.putString(R.string.key_objectives_request_code, request)
|
||||
holder.binding.requestcode.text = rh.gs(R.string.requestcode, request)
|
||||
holder.binding.requestcode.visibility = View.VISIBLE
|
||||
holder.binding.enterbutton.visibility = View.VISIBLE
|
||||
holder.binding.input.visibility = View.VISIBLE
|
||||
holder.binding.inputhint.visibility = View.VISIBLE
|
||||
holder.binding.enterbutton.setOnClickListener {
|
||||
val input = holder.binding.input.text.toString()
|
||||
activity?.let { activity -> objective.specialAction(activity, input) }
|
||||
rxBus.send(EventObjectivesUpdateGui())
|
||||
}
|
||||
} else {
|
||||
holder.binding.enterbutton.visibility = View.GONE
|
||||
holder.binding.input.visibility = View.GONE
|
||||
holder.binding.inputhint.visibility = View.GONE
|
||||
holder.binding.requestcode.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
|
|
|
@ -37,8 +37,6 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe
|
|||
|
||||
var tasks: MutableList<Task> = ArrayList()
|
||||
|
||||
var hasSpecialInput = false
|
||||
|
||||
val isCompleted: Boolean
|
||||
get() {
|
||||
for (task in tasks) {
|
||||
|
@ -81,6 +79,7 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe
|
|||
abstract inner class Task(var objective: Objective, @StringRes val task: Int) {
|
||||
|
||||
var hints = ArrayList<Hint>()
|
||||
var learned = ArrayList<Learned>()
|
||||
|
||||
abstract fun isCompleted(): Boolean
|
||||
|
||||
|
@ -94,6 +93,11 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe
|
|||
return this
|
||||
}
|
||||
|
||||
fun learned(learned: Learned): Task {
|
||||
this.learned.add(learned)
|
||||
return this
|
||||
}
|
||||
|
||||
open fun shouldBeIgnored(): Boolean = false
|
||||
}
|
||||
|
||||
|
@ -179,4 +183,14 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe
|
|||
return textView
|
||||
}
|
||||
}
|
||||
|
||||
inner class Learned internal constructor(@StringRes var learned: Int) {
|
||||
|
||||
fun generate(context: Context): TextView {
|
||||
val textView = TextView(context)
|
||||
textView.setText(learned)
|
||||
textView.setLinkTextColor(rh.gac(context, com.google.android.material.R.attr.colorSecondary))
|
||||
return textView
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,11 +39,13 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
|
|||
return !virtualPumpPlugin.isEnabled()
|
||||
}
|
||||
})
|
||||
tasks.add(object : Task(this, R.string.objectives_pumpstatusavailableinns) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false)
|
||||
}
|
||||
})
|
||||
tasks.add(
|
||||
object : Task(this, R.string.objectives_pumpstatusavailableinns) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false)
|
||||
}
|
||||
}.learned(Learned(R.string.objectives_0_learned))
|
||||
)
|
||||
tasks.add(object : Task(this, R.string.hasbgdata) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return iobCobCalculator.ads.lastBg() != null
|
||||
|
|
|
@ -44,10 +44,13 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i
|
|||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false)
|
||||
}
|
||||
}.hint(Hint(R.string.useaction_hint)))
|
||||
tasks.add(object : Task(this, R.string.objectives_usescale) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false)
|
||||
}
|
||||
}.hint(Hint(R.string.usescale_hint)))
|
||||
tasks.add(
|
||||
object : Task(this, R.string.objectives_usescale) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false)
|
||||
}
|
||||
}.hint(Hint(R.string.usescale_hint))
|
||||
.learned(Learned(R.string.objectives_usage_learned))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -7,6 +7,9 @@ import info.nightscout.shared.utils.T
|
|||
class Objective10(injector: HasAndroidInjector) : Objective(injector, "auto", R.string.objectives_auto_objective, R.string.objectives_auto_gate) {
|
||||
|
||||
init {
|
||||
tasks.add(MinimumDurationTask(this, T.days(28).msecs()))
|
||||
tasks.add(
|
||||
MinimumDurationTask(this, T.days(28).msecs())
|
||||
.learned(Learned(R.string.objectives_autosens_learned))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -7,216 +7,271 @@ import info.nightscout.plugins.constraints.R
|
|||
class Objective2(injector: HasAndroidInjector) : Objective(injector, "exam", R.string.objectives_exam_objective, R.string.objectives_exam_gate) {
|
||||
|
||||
init {
|
||||
tasks.add(ExamTask(this, R.string.prerequisites_label, R.string.prerequisites_what, "prerequisites")
|
||||
.option(Option(R.string.prerequisites_nightscout, true))
|
||||
.option(Option(R.string.prerequisites_computer, true))
|
||||
.option(Option(R.string.prerequisites_pump, true))
|
||||
.option(Option(R.string.prerequisites_beanandroiddeveloper, false))
|
||||
.hint(Hint(R.string.prerequisites_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.prerequisites_label, R.string.prerequisites_what, "prerequisites")
|
||||
.option(Option(R.string.prerequisites_nightscout, true))
|
||||
.option(Option(R.string.prerequisites_computer, true))
|
||||
.option(Option(R.string.prerequisites_pump, true))
|
||||
.option(Option(R.string.prerequisites_beanandroiddeveloper, false))
|
||||
.hint(Hint(R.string.prerequisites_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_prerequisites))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.prerequisites2_label, R.string.prerequisites2_what, "prerequisites2")
|
||||
.option(Option(R.string.prerequisites2_profile, true))
|
||||
.option(Option(R.string.prerequisites2_device, true))
|
||||
.option(Option(R.string.prerequisites2_internet, false))
|
||||
.option(Option(R.string.prerequisites2_supportedcgm, true))
|
||||
.hint(Hint(R.string.prerequisites2_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.prerequisites2_label, R.string.prerequisites2_what, "prerequisites2")
|
||||
.option(Option(R.string.prerequisites2_profile, true))
|
||||
.option(Option(R.string.prerequisites2_device, true))
|
||||
.option(Option(R.string.prerequisites2_internet, false))
|
||||
.option(Option(R.string.prerequisites2_supportedcgm, true))
|
||||
.hint(Hint(R.string.prerequisites2_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_prerequisites2))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.basaltest_label, R.string.basaltest_when, "basaltest")
|
||||
.option(Option(R.string.basaltest_fixed, false))
|
||||
.option(Option(R.string.basaltest_havingregularhighlow, true))
|
||||
.option(Option(R.string.basaltest_weekly, false))
|
||||
.option(Option(R.string.basaltest_beforeloop, true))
|
||||
.hint(Hint(R.string.basaltest_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.basaltest_label, R.string.basaltest_when, "basaltest")
|
||||
.option(Option(R.string.basaltest_fixed, false))
|
||||
.option(Option(R.string.basaltest_havingregularhighlow, true))
|
||||
.option(Option(R.string.basaltest_weekly, false))
|
||||
.option(Option(R.string.basaltest_beforeloop, true))
|
||||
.hint(Hint(R.string.basaltest_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_basaltest))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.dia_label_exam, R.string.dia_whatmeansdia, "dia")
|
||||
.option(Option(R.string.dia_profile, true))
|
||||
.option(Option(R.string.dia_minimumis5h, true))
|
||||
.option(Option(R.string.dia_meaningisequaltodiapump, false))
|
||||
.option(Option(R.string.dia_valuemustbedetermined, true))
|
||||
.hint(Hint(R.string.dia_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.dia_label_exam, R.string.dia_whatmeansdia, "dia")
|
||||
.option(Option(R.string.dia_profile, true))
|
||||
.option(Option(R.string.dia_minimumis5h, true))
|
||||
.option(Option(R.string.dia_meaningisequaltodiapump, false))
|
||||
.option(Option(R.string.dia_valuemustbedetermined, true))
|
||||
.hint(Hint(R.string.dia_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_dia))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.isf_label_exam, R.string.blank, "isf")
|
||||
.option(Option(R.string.isf_decreasingvalue, true))
|
||||
.option(Option(R.string.isf_preferences, false))
|
||||
.option(Option(R.string.isf_increasingvalue, false))
|
||||
.option(Option(R.string.isf_noeffect, false))
|
||||
.hint(Hint(R.string.isf_hint1))
|
||||
.hint(Hint(R.string.isf_hint2))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.isf_label_exam, R.string.blank, "isf")
|
||||
.option(Option(R.string.isf_decreasingvalue, true))
|
||||
.option(Option(R.string.isf_preferences, false))
|
||||
.option(Option(R.string.isf_increasingvalue, false))
|
||||
.option(Option(R.string.isf_noeffect, false))
|
||||
.hint(Hint(R.string.isf_hint1))
|
||||
.hint(Hint(R.string.isf_hint2))
|
||||
.learned(Learned(R.string.objectives_exam_learned_isf))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.ic_label_exam, R.string.blank, "ic")
|
||||
.option(Option(R.string.ic_increasingvalue, true))
|
||||
.option(Option(R.string.ic_decreasingvalue, false))
|
||||
.option(Option(R.string.ic_multiple, true))
|
||||
.option(Option(R.string.ic_isf, false))
|
||||
.hint(Hint(R.string.ic_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.ic_label_exam, R.string.blank, "ic")
|
||||
.option(Option(R.string.ic_increasingvalue, true))
|
||||
.option(Option(R.string.ic_decreasingvalue, false))
|
||||
.option(Option(R.string.ic_multiple, true))
|
||||
.option(Option(R.string.ic_isf, false))
|
||||
.hint(Hint(R.string.ic_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_ic))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.hypott_label, R.string.hypott_whenhypott, "hypott")
|
||||
.option(Option(R.string.hypott_preventoversmb, true))
|
||||
.option(Option(R.string.hypott_exercise, false))
|
||||
.option(Option(R.string.hypott_wrongbasal, false))
|
||||
.option(Option(R.string.hypott_0basal, false))
|
||||
.hint(Hint(R.string.hypott_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.hypott_label, R.string.hypott_whenhypott, "hypott")
|
||||
.option(Option(R.string.hypott_preventoversmb, true))
|
||||
.option(Option(R.string.hypott_exercise, false))
|
||||
.option(Option(R.string.hypott_wrongbasal, false))
|
||||
.option(Option(R.string.hypott_0basal, false))
|
||||
.hint(Hint(R.string.hypott_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_hypott))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.profileswitch_label, R.string.profileswitch_pctwillchange, "profileswitch")
|
||||
.option(Option(R.string.profileswitch_basallower, true))
|
||||
.option(Option(R.string.profileswitch_isfhigher, true))
|
||||
.option(Option(R.string.profileswitch_iclower, false))
|
||||
.option(Option(R.string.profileswitch_unchanged, false))
|
||||
.hint(Hint(R.string.profileswitch_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.profileswitch_label, R.string.profileswitch_pctwillchange, "profileswitch")
|
||||
.option(Option(R.string.profileswitch_basallower, true))
|
||||
.option(Option(R.string.profileswitch_isfhigher, true))
|
||||
.option(Option(R.string.profileswitch_iclower, false))
|
||||
.option(Option(R.string.profileswitch_unchanged, false))
|
||||
.hint(Hint(R.string.profileswitch_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_profileswitch))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.profileswitch2_label, R.string.profileswitch2_pctwillchange, "profileswitch2")
|
||||
.option(Option(R.string.profileswitch2_bghigher, false))
|
||||
.option(Option(R.string.profileswitch2_basalhigher, true))
|
||||
.option(Option(R.string.profileswitch2_bgunchanged, true))
|
||||
.option(Option(R.string.profileswitch2_isfhigher, false))
|
||||
.hint(Hint(R.string.profileswitch_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.profileswitch2_label, R.string.profileswitch2_pctwillchange, "profileswitch2")
|
||||
.option(Option(R.string.profileswitch2_bghigher, false))
|
||||
.option(Option(R.string.profileswitch2_basalhigher, true))
|
||||
.option(Option(R.string.profileswitch2_bgunchanged, true))
|
||||
.option(Option(R.string.profileswitch2_isfhigher, false))
|
||||
.hint(Hint(R.string.profileswitch_hint1))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.profileswitchtime_label, R.string.profileswitchtime_iwant, "profileswitchtime")
|
||||
.option(Option(R.string.profileswitchtime_2, false))
|
||||
.option(Option(R.string.profileswitchtime__2, true))
|
||||
.option(Option(R.string.profileswitchtime_tt, false))
|
||||
.option(Option(R.string.profileswitchtime_100, false))
|
||||
.hint(Hint(R.string.profileswitchtime_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.profileswitchtime_label, R.string.profileswitchtime_iwant, "profileswitchtime")
|
||||
.option(Option(R.string.profileswitchtime_2, false))
|
||||
.option(Option(R.string.profileswitchtime__2, true))
|
||||
.option(Option(R.string.profileswitchtime_tt, false))
|
||||
.option(Option(R.string.profileswitchtime_100, false))
|
||||
.hint(Hint(R.string.profileswitchtime_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_profileswitchtime))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.profileswitch4_label, R.string.blank, "profileswitch4")
|
||||
.option(Option(R.string.profileswitch4_rates, true))
|
||||
.option(Option(R.string.profileswitch4_internet, true))
|
||||
.option(Option(R.string.profileswitch4_sufficient, false))
|
||||
.option(Option(R.string.profileswitch4_multi, true))
|
||||
.hint(Hint(R.string.profileswitch_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.profileswitch4_label, R.string.blank, "profileswitch4")
|
||||
.option(Option(R.string.profileswitch4_rates, true))
|
||||
.option(Option(R.string.profileswitch4_internet, true))
|
||||
.option(Option(R.string.profileswitch4_sufficient, false))
|
||||
.option(Option(R.string.profileswitch4_multi, true))
|
||||
.hint(Hint(R.string.profileswitch_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_profileswitch4))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.exerciseprofile_label, R.string.exerciseprofile_whattodo, "exercise")
|
||||
.option(Option(R.string.exerciseprofile_switchprofileabove100, false))
|
||||
.option(Option(R.string.exerciseprofile_switchprofilebelow100, true))
|
||||
.option(Option(R.string.exerciseprofile_suspendloop, false))
|
||||
.option(Option(R.string.exerciseprofile_leaveat100, false))
|
||||
.hint(Hint(R.string.exerciseprofile_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.exerciseprofile_label, R.string.exerciseprofile_whattodo, "exercise")
|
||||
.option(Option(R.string.exerciseprofile_switchprofileabove100, false))
|
||||
.option(Option(R.string.exerciseprofile_switchprofilebelow100, true))
|
||||
.option(Option(R.string.exerciseprofile_suspendloop, false))
|
||||
.option(Option(R.string.exerciseprofile_leaveat100, false))
|
||||
.hint(Hint(R.string.exerciseprofile_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_exercise))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.exercise_label, R.string.exercise_whattodo, "exercise2")
|
||||
.option(Option(R.string.exercise_settt, true))
|
||||
.option(Option(R.string.exercise_setfinished, false))
|
||||
.option(Option(R.string.exercise_setunchanged, false))
|
||||
.option(Option(R.string.exercise_15g, false))
|
||||
.hint(Hint(R.string.exercise_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.exercise_label, R.string.exercise_whattodo, "exercise2")
|
||||
.option(Option(R.string.exercise_settt, true))
|
||||
.option(Option(R.string.exercise_setfinished, false))
|
||||
.option(Option(R.string.exercise_setunchanged, false))
|
||||
.option(Option(R.string.exercise_15g, false))
|
||||
.hint(Hint(R.string.exercise_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_exercise2))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.noisycgm_label, R.string.noisycgm_whattodo, "noisycgm")
|
||||
.option(Option(R.string.noisycgm_nothing, false))
|
||||
.option(Option(R.string.noisycgm_pause, true))
|
||||
.option(Option(R.string.noisycgm_replacesensor, true))
|
||||
.option(Option(R.string.noisycgm_checksmoothing, true))
|
||||
.hint(Hint(R.string.noisycgm_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.noisycgm_label, R.string.noisycgm_whattodo, "noisycgm")
|
||||
.option(Option(R.string.noisycgm_nothing, false))
|
||||
.option(Option(R.string.noisycgm_pause, true))
|
||||
.option(Option(R.string.noisycgm_replacesensor, true))
|
||||
.option(Option(R.string.noisycgm_checksmoothing, true))
|
||||
.hint(Hint(R.string.noisycgm_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_noisycgm))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.pumpdisconnect_label, R.string.blank, "pumpdisconnect")
|
||||
.option(Option(R.string.pumpdisconnect_unnecessary, false))
|
||||
.option(Option(R.string.pumpdisconnect_missinginsulin, true))
|
||||
.option(Option(R.string.pumpdisconnect_notstop, false))
|
||||
.option(Option(R.string.pumpdisconnect_openloop, false))
|
||||
.hint(Hint(R.string.pumpdisconnect_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.pumpdisconnect_label, R.string.blank, "pumpdisconnect")
|
||||
.option(Option(R.string.pumpdisconnect_unnecessary, false))
|
||||
.option(Option(R.string.pumpdisconnect_missinginsulin, true))
|
||||
.option(Option(R.string.pumpdisconnect_notstop, false))
|
||||
.option(Option(R.string.pumpdisconnect_openloop, false))
|
||||
.hint(Hint(R.string.pumpdisconnect_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_pumpdisconnect))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.insulin_plugins, R.string.insulin_ultrarapid, "insulin")
|
||||
.option(Option(R.string.insulin_novorapid, false))
|
||||
.option(Option(R.string.insulin_humalog, false))
|
||||
.option(Option(R.string.insulin_actrapid, false))
|
||||
.option(Option(R.string.insulin_fiasp, true))
|
||||
.hint(Hint(R.string.insulin_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.insulin_plugins, R.string.insulin_ultrarapid, "insulin")
|
||||
.option(Option(R.string.insulin_novorapid, false))
|
||||
.option(Option(R.string.insulin_humalog, false))
|
||||
.option(Option(R.string.insulin_actrapid, false))
|
||||
.option(Option(R.string.insulin_fiasp, true))
|
||||
.hint(Hint(R.string.insulin_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_insulin))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.sensitivity_label, R.string.blank, "sensitivity")
|
||||
.option(Option(R.string.sensitivity_adjust, true))
|
||||
.option(Option(R.string.sensitivity_edit, false))
|
||||
.option(Option(R.string.sensitivity_cannula, true))
|
||||
.option(Option(R.string.sensitivity_time, true))
|
||||
.hint(Hint(R.string.sensitivity_hint1))
|
||||
.hint(Hint(R.string.sensitivity_hint2))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.sensitivity_label, R.string.blank, "sensitivity")
|
||||
.option(Option(R.string.sensitivity_adjust, true))
|
||||
.option(Option(R.string.sensitivity_edit, false))
|
||||
.option(Option(R.string.sensitivity_cannula, true))
|
||||
.option(Option(R.string.sensitivity_time, true))
|
||||
.hint(Hint(R.string.sensitivity_hint1))
|
||||
.hint(Hint(R.string.sensitivity_hint2))
|
||||
.learned(Learned(R.string.objectives_exam_learned_sensitivity))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.objectives_label, R.string.objectives_howtosave, "objectives")
|
||||
.option(Option(R.string.objectives_notesettings, false))
|
||||
.option(Option(R.string.objectives_afterobjective, true))
|
||||
.option(Option(R.string.objectives_afterchange, true))
|
||||
.option(Option(R.string.objectives_afterinitialsetup, true))
|
||||
.hint(Hint(R.string.objectives_hint1))
|
||||
.hint(Hint(R.string.objectives_hint2))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.objectives_label, R.string.objectives_howtosave, "objectives")
|
||||
.option(Option(R.string.objectives_notesettings, false))
|
||||
.option(Option(R.string.objectives_afterobjective, true))
|
||||
.option(Option(R.string.objectives_afterchange, true))
|
||||
.option(Option(R.string.objectives_afterinitialsetup, true))
|
||||
.hint(Hint(R.string.objectives_hint1))
|
||||
.hint(Hint(R.string.objectives_hint2))
|
||||
.learned(Learned(R.string.objectives_exam_learned_objectives))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.objectives2_label, R.string.objectives_howtosave, "objectives2")
|
||||
.option(Option(R.string.objectives2_maintenance, true))
|
||||
.option(Option(R.string.objectives2_internalstorage, true))
|
||||
.option(Option(R.string.objectives2_cloud, true))
|
||||
.option(Option(R.string.objectives2_easyrestore, false))
|
||||
.hint(Hint(R.string.objectives_hint1))
|
||||
.hint(Hint(R.string.objectives_hint2))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.objectives2_label, R.string.objectives_howtosave, "objectives2")
|
||||
.option(Option(R.string.objectives2_maintenance, true))
|
||||
.option(Option(R.string.objectives2_internalstorage, true))
|
||||
.option(Option(R.string.objectives2_cloud, true))
|
||||
.option(Option(R.string.objectives2_easyrestore, false))
|
||||
.hint(Hint(R.string.objectives_hint1))
|
||||
.hint(Hint(R.string.objectives_hint2))
|
||||
.learned(Learned(R.string.objectives_exam_learned_objectives2))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.update_label, R.string.blank, "update")
|
||||
.option(Option(R.string.update_git, true))
|
||||
.option(Option(R.string.update_askfriend, false))
|
||||
.option(Option(R.string.update_keys, true))
|
||||
.option(Option(R.string.update_asap, true))
|
||||
.hint(Hint(R.string.update_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.update_label, R.string.blank, "update")
|
||||
.option(Option(R.string.update_git, true))
|
||||
.option(Option(R.string.update_askfriend, false))
|
||||
.option(Option(R.string.update_keys, true))
|
||||
.option(Option(R.string.update_asap, true))
|
||||
.hint(Hint(R.string.update_hint1))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.troubleshooting_label, R.string.troubleshooting_wheretoask, "troubleshooting")
|
||||
.option(Option(R.string.troubleshooting_fb, true))
|
||||
.option(Option(R.string.troubleshooting_wiki, true))
|
||||
.option(Option(R.string.troubleshooting_gitter, true))
|
||||
.option(Option(R.string.troubleshooting_yourendo, false))
|
||||
.hint(Hint(R.string.troubleshooting_hint1))
|
||||
.hint(Hint(R.string.troubleshooting_hint2))
|
||||
.hint(Hint(R.string.troubleshooting_hint3))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.troubleshooting_label, R.string.troubleshooting_wheretoask, "troubleshooting")
|
||||
.option(Option(R.string.troubleshooting_fb, true))
|
||||
.option(Option(R.string.troubleshooting_wiki, true))
|
||||
.option(Option(R.string.troubleshooting_gitter, true))
|
||||
.option(Option(R.string.troubleshooting_yourendo, false))
|
||||
.hint(Hint(R.string.troubleshooting_hint1))
|
||||
.hint(Hint(R.string.troubleshooting_hint2))
|
||||
.hint(Hint(R.string.troubleshooting_hint3))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.wrongcarbs_label, R.string.wrongcarbs_whattodo, "wrongcarbs")
|
||||
.option(Option(R.string.wrongcarbs_addinsulin, false))
|
||||
.option(Option(R.string.wrongcarbs_treatmentstab, true))
|
||||
.option(Option(R.string.wrongcarbs_donothing, false))
|
||||
.option(Option(R.string.wrongcarbs_bolus, false))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.wrongcarbs_label, R.string.wrongcarbs_whattodo, "wrongcarbs")
|
||||
.option(Option(R.string.wrongcarbs_addinsulin, false))
|
||||
.option(Option(R.string.wrongcarbs_treatmentstab, true))
|
||||
.option(Option(R.string.wrongcarbs_donothing, false))
|
||||
.option(Option(R.string.wrongcarbs_bolus, false))
|
||||
.learned(Learned(R.string.objectives_exam_learned_wrongcarbs))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.wronginsulin_label, R.string.wronginsulin_whattodo, "wronginsulin")
|
||||
.option(Option(R.string.wronginsulin_careportal, false))
|
||||
.option(Option(R.string.wronginsulin_compare, true))
|
||||
.option(Option(R.string.wronginsulin_prime, true))
|
||||
.option(Option(R.string.wrongcarbs_donothing, false))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.wronginsulin_label, R.string.wronginsulin_whattodo, "wronginsulin")
|
||||
.option(Option(R.string.wronginsulin_careportal, false))
|
||||
.option(Option(R.string.wronginsulin_compare, true))
|
||||
.option(Option(R.string.wronginsulin_prime, true))
|
||||
.option(Option(R.string.wrongcarbs_donothing, false))
|
||||
)
|
||||
tasks.add(ExamTask(this, info.nightscout.core.ui.R.string.iob_label, R.string.blank, "iob")
|
||||
.option(Option(R.string.iob_value, true))
|
||||
.option(Option(R.string.iob_hightemp, false))
|
||||
.option(Option(R.string.iob_negiob, true))
|
||||
.option(Option(R.string.iob_posiob, true))
|
||||
tasks.add(
|
||||
ExamTask(this, info.nightscout.core.ui.R.string.iob_label, R.string.blank, "iob")
|
||||
.option(Option(R.string.iob_value, true))
|
||||
.option(Option(R.string.iob_hightemp, false))
|
||||
.option(Option(R.string.iob_negiob, true))
|
||||
.option(Option(R.string.iob_posiob, true))
|
||||
.learned(Learned(R.string.objectives_exam_learned_iob))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.cob_label, R.string.cob_question, "cob1")
|
||||
.option(Option(R.string.cob_longer, true))
|
||||
.option(Option(R.string.cob_shorter, false))
|
||||
.option(Option(R.string.cob_no_effect, false))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.cob_label, R.string.cob_question, "cob1")
|
||||
.option(Option(R.string.cob_longer, true))
|
||||
.option(Option(R.string.cob_shorter, false))
|
||||
.option(Option(R.string.cob_no_effect, false))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.cob_label, R.string.cob2_question, "cob2")
|
||||
.option(Option(R.string.cob2_longer, false))
|
||||
.option(Option(R.string.cob2_shorter, true))
|
||||
.option(Option(R.string.cob2_no_effect, false))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.cob_label, R.string.cob2_question, "cob2")
|
||||
.option(Option(R.string.cob2_longer, false))
|
||||
.option(Option(R.string.cob2_shorter, true))
|
||||
.option(Option(R.string.cob2_no_effect, false))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.cob_label, R.string.cob3_question, "cob3")
|
||||
.option(Option(R.string.cob3_longer, false))
|
||||
.option(Option(R.string.cob3_shorter, false))
|
||||
.option(Option(R.string.cob3_no_effect, true))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.cob_label, R.string.cob3_question, "cob3")
|
||||
.option(Option(R.string.cob3_longer, false))
|
||||
.option(Option(R.string.cob3_shorter, false))
|
||||
.option(Option(R.string.cob3_no_effect, true))
|
||||
.learned(Learned(R.string.objectives_exam_learned_cob))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.breadgrams_label, R.string.blank, "breadgrams")
|
||||
.option(Option(R.string.breadgrams_grams, true))
|
||||
.option(Option(R.string.breadgrams_exchange, false))
|
||||
.option(Option(R.string.breadgrams_decay, true))
|
||||
.option(Option(R.string.breadgrams_calc, true))
|
||||
.hint(Hint(R.string.breadgrams_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.breadgrams_label, R.string.blank, "breadgrams")
|
||||
.option(Option(R.string.breadgrams_grams, true))
|
||||
.option(Option(R.string.breadgrams_exchange, false))
|
||||
.option(Option(R.string.breadgrams_decay, true))
|
||||
.option(Option(R.string.breadgrams_calc, true))
|
||||
.hint(Hint(R.string.breadgrams_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_breadgrams))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.extendedcarbs_label, R.string.extendedcarbs_handling, "extendedcarbs")
|
||||
.option(Option(R.string.extendedcarbs_future, true))
|
||||
.option(Option(R.string.extendedcarbs_free, false))
|
||||
.option(Option(R.string.extendedcarbs_fat, true))
|
||||
.option(Option(R.string.extendedcarbs_rescue, false))
|
||||
.hint(Hint(R.string.extendedcarbs_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.extendedcarbs_label, R.string.extendedcarbs_handling, "extendedcarbs")
|
||||
.option(Option(R.string.extendedcarbs_future, true))
|
||||
.option(Option(R.string.extendedcarbs_free, false))
|
||||
.option(Option(R.string.extendedcarbs_fat, true))
|
||||
.option(Option(R.string.extendedcarbs_rescue, false))
|
||||
.hint(Hint(R.string.extendedcarbs_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_ecarbs))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.nsclient_label, R.string.nsclient_howcanyou, "nsclient")
|
||||
.option(Option(R.string.nsclient_nightscout, true))
|
||||
.option(Option(R.string.nsclient_dexcomfollow, true))
|
||||
.option(Option(R.string.nsclient_data, true))
|
||||
.option(Option(R.string.nsclient_fullcontrol, false))
|
||||
.hint(Hint(R.string.nsclient_hint1))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.nsclient_label, R.string.nsclient_howcanyou, "nsclient")
|
||||
.option(Option(R.string.nsclient_nightscout, true))
|
||||
.option(Option(R.string.nsclient_dexcomfollow, true))
|
||||
.option(Option(R.string.nsclient_data, true))
|
||||
.option(Option(R.string.nsclient_fullcontrol, false))
|
||||
.hint(Hint(R.string.nsclient_hint1))
|
||||
.learned(Learned(R.string.objectives_exam_learned_nsclient))
|
||||
)
|
||||
tasks.add(ExamTask(this, R.string.other_medication_label, R.string.other_medication_text, "otherMedicationWarning")
|
||||
.option(Option(info.nightscout.core.ui.R.string.yes, true))
|
||||
.option(Option(info.nightscout.core.ui.R.string.no, false))
|
||||
tasks.add(
|
||||
ExamTask(this, R.string.other_medication_label, R.string.other_medication_text, "otherMedicationWarning")
|
||||
.option(Option(info.nightscout.core.ui.R.string.yes, true))
|
||||
.option(Option(info.nightscout.core.ui.R.string.no, false))
|
||||
)
|
||||
for (task in tasks) (task as ExamTask).options.shuffle()
|
||||
|
||||
|
|
|
@ -13,15 +13,19 @@ class Objective3 @Inject constructor(injector: HasAndroidInjector) : Objective(i
|
|||
|
||||
init {
|
||||
tasks.add(MinimumDurationTask(this, T.days(7).msecs()))
|
||||
tasks.add(object : Task(this, R.string.objectives_manualenacts) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED
|
||||
}
|
||||
tasks.add(
|
||||
object : Task(this, R.string.objectives_manualenacts) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED
|
||||
}
|
||||
|
||||
override val progress: String
|
||||
get() = if (sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED) rh.gs(R.string.completed_well_done) else sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0)
|
||||
.toString() + " / " + MANUAL_ENACTS_NEEDED
|
||||
})
|
||||
override val progress: String
|
||||
get() =
|
||||
if (sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED)
|
||||
rh.gs(R.string.completed_well_done)
|
||||
else sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0).toString() + " / " + MANUAL_ENACTS_NEEDED
|
||||
}.learned(Learned(R.string.objectives_openloop_learned))
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -1,7 +1,29 @@
|
|||
package info.nightscout.plugins.constraints.objectives.objectives
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
import info.nightscout.plugins.constraints.R
|
||||
import javax.inject.Inject
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
class Objective4(injector: HasAndroidInjector) : Objective(injector, "maxbasal", R.string.objectives_maxbasal_objective, R.string.objectives_maxbasal_gate)
|
||||
class Objective4(injector: HasAndroidInjector) : Objective(injector, "maxbasal", R.string.objectives_maxbasal_objective, R.string.objectives_maxbasal_gate) {
|
||||
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
init {
|
||||
tasks.add(
|
||||
object : Task(this, R.string.objectives_maxbasal_gate) {
|
||||
override fun isCompleted(): Boolean {
|
||||
val profile = profileFunction.getProfile() ?: return false
|
||||
val maxBasalSet = (activePlugin.activeAPS as Constraints).applyBasalConstraints(Constraint(Constants.REALLYHIGHBASALRATE), profile)
|
||||
val maxDailyBasal = profile.getMaxDailyBasal()
|
||||
return maxBasalSet.value() > 2.8 * maxDailyBasal
|
||||
}
|
||||
}.learned(Learned(R.string.objectives_maxbasal_learned))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -14,12 +14,14 @@ class Objective5(injector: HasAndroidInjector) : Objective(injector, "maxiobzero
|
|||
|
||||
init {
|
||||
tasks.add(MinimumDurationTask(this, T.days(5).msecs()))
|
||||
tasks.add(object : Task(this, R.string.closedmodeenabled) {
|
||||
override fun isCompleted(): Boolean {
|
||||
val closedLoopEnabled = Constraint(true)
|
||||
safetyPlugin.isClosedLoopAllowed(closedLoopEnabled)
|
||||
return closedLoopEnabled.value()
|
||||
}
|
||||
})
|
||||
tasks.add(
|
||||
object : Task(this, R.string.closedmodeenabled) {
|
||||
override fun isCompleted(): Boolean {
|
||||
val closedLoopEnabled = Constraint(true)
|
||||
safetyPlugin.isClosedLoopAllowed(closedLoopEnabled)
|
||||
return closedLoopEnabled.value()
|
||||
}
|
||||
}.learned(Learned(R.string.objectives_maxiobzero_learned))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R
|
|||
val maxIOB = constraintChecker.getMaxIOBAllowed().value()
|
||||
return maxIOB > 0
|
||||
}
|
||||
})
|
||||
}.learned(Learned(R.string.objectives_maxiob_learned))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -7,6 +7,9 @@ import info.nightscout.shared.utils.T
|
|||
class Objective7(injector: HasAndroidInjector) : Objective(injector, "autosens", R.string.objectives_autosens_objective, R.string.objectives_autosens_gate) {
|
||||
|
||||
init {
|
||||
tasks.add(MinimumDurationTask(this, T.days(7).msecs()))
|
||||
tasks.add(
|
||||
MinimumDurationTask(this, T.days(7).msecs())
|
||||
.learned(Learned(R.string.objectives_autosens_learned))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -7,6 +7,9 @@ import info.nightscout.shared.utils.T
|
|||
class Objective9(injector: HasAndroidInjector) : Objective(injector, "smb", R.string.objectives_smb_objective, R.string.objectives_smb_gate) {
|
||||
|
||||
init {
|
||||
tasks.add(MinimumDurationTask(this, T.days(28).msecs()))
|
||||
tasks.add(
|
||||
MinimumDurationTask(this, T.days(28).msecs())
|
||||
.learned(Learned(R.string.objectives_smb_learned))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -85,42 +85,6 @@
|
|||
android:layout_gravity="end"
|
||||
android:text="@string/objectives_button_unstart" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/inputhint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/enter_code_obtained_from_developers_to_bypass_the_rest_of_objectives" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/requestcode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Request code: XXXXX" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/input"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
tools:hint="XXXXXXXXXX"
|
||||
android:importantForAutofill="no" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/enterbutton"
|
||||
style="@style/OkCancelButton.Text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/objectives_button_enter" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accomplished"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -128,6 +92,23 @@
|
|||
android:layout_marginTop="8dp"
|
||||
tools:text="Accomplished" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/learned_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:text="@string/what_i_ve_learned"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/learned"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<string name="objectives_maxbasal_learned">Take care about safety features and adjust safety parameters when necessary.</string>
|
||||
<string name="objectives_maxiobzero_objective">Starting to close the loop with Low Glucose Suspend</string>
|
||||
<string name="objectives_maxiobzero_gate">Run in closed loop with max IOB = 0 for a few days without too many LGS events</string>
|
||||
<string name="objectives_maxiobzero_learned">Setting MaxIOB to prevents you from hypo and will not add more insulin above basal rate (except situation with negative IOB)</string>
|
||||
<string name="objectives_maxiobzero_learned">Setting MaxIOB to zero prevents you from hypo and will not add more insulin above basal rate (except situation with negative IOB)</string>
|
||||
<string name="objectives_maxiob_objective">Tuning the closed loop, raising max IOB above 0 and gradually lowering BG targets</string>
|
||||
<string name="objectives_maxiob_gate">Run for a few days, and at least one night with no low BG alarms, before dropping BG</string>
|
||||
<string name="objectives_maxiob_learned">Update MaxIOB as a child grows. Do not allow to the system give you more insulin than you can cover by food = really high value is a bad idea.</string>
|
||||
|
@ -45,11 +45,9 @@
|
|||
<string name="objectives_useactions">In Config Builder enable Actions plugin, make it visible and display its content from top menu</string>
|
||||
<string name="objectives_useloop">Display content of Loop plugin</string>
|
||||
<string name="objectives_usescale">Use scale function by long-pressing BG chart</string>
|
||||
<string name="objectives_button_enter">Enter</string>
|
||||
<string name="enter_code_obtained_from_developers_to_bypass_the_rest_of_objectives">If you have at least 3 months of closed loop experience with other systems you might qualify for a code to skip objectives. See https://androidaps.readthedocs.io/en/latest/EN/Usage/Objectives.html#skip-objectives for details.</string>
|
||||
<string name="objectives_exam_objective">Prove your knowledge</string>
|
||||
<string name="objectives_exam_gate">Study the questions. You are given four possible answers for each question. There may be more than one correct answer. Please check all those that are correct and select VERIFY.</string>
|
||||
<string name="objectives_exam_learned_prerequisites">You don\'t need to be a developer but you need NS to pass Objectives, compatible pump and computer to build AAPS for the first time and for every update update.</string>
|
||||
<string name="objectives_exam_learned_prerequisites">You don\'t need to be a developer but you need NS to pass Objectives, compatible pump and computer to build AAPS for the first time and for every update.</string>
|
||||
<string name="objectives_exam_learned_prerequisites2">AAPS can be run offline.</string>
|
||||
<string name="objectives_exam_learned_basaltest">Profile should be reviewed and updated. Better profile = better results.</string>
|
||||
<string name="objectives_exam_learned_dia">DIA in looping has different meaning (time until all insulin is absorbed) then in classic pump therapy (time until most insulin is absorbed).</string>
|
||||
|
@ -66,7 +64,7 @@
|
|||
<string name="objectives_exam_learned_insulin">Letting know which insulin is in pump is necessary because it does affect IOB calculation.</string>
|
||||
<string name="objectives_exam_learned_sensitivity">Sensitivity detection is part of the algorithm which allows adapt insulin dosage to different situations.</string>
|
||||
<string name="objectives_exam_learned_objectives">Your progress in Objectives is stored along with other settings and it should be backed up.</string>
|
||||
<string name="objectives_exam_learned_objectives2">Always keep exported settings, generated APK also outside phone. Phone can be lost, damaged etc. Good place can be any cloud accessible from phone. In this case you can restore AAPS on another device in a few minutes. Good practice is store used master password on a safe place too. Without it is your backup useless. The same is valid for signing keys (.jks file) and passwords used to build AAPS. The rest is not important - it can be anytime downloaded from internet again.</string>
|
||||
<string name="objectives_exam_learned_objectives2">Always keep exported settings and generated APK also outside phone. Phone can be lost, damaged etc. Good place can be any cloud accessible from phone. In this case you can restore AAPS on another device in a few minutes. Good practice is store used master password on a safe place too. Without it is your backup useless. The same is valid for signing keys (.jks file) and passwords used to build AAPS. The rest is not important - it can be anytime downloaded from internet again.</string>
|
||||
<string name="objectives_exam_learned_wrongcarbs">If you made wrong input to AAPS or it doesn\'t match reality, resolve it asap. It could lead to overdosing. AAPS should be always informed the best possible way about carbs, insulin etc.</string>
|
||||
<string name="objectives_exam_learned_iob">If you analyze if AAPS is working well for you watching IOB graph can give you a lof of useful information.</string>
|
||||
<string name="objectives_exam_learned_cob">COB calculation depends on relation between ISF an IC. Increasing ISF or decreasing IC will lead to longer absorption times. But profile switch with percentage change both values at the same time and absorption time is not affected.</string>
|
||||
|
@ -85,5 +83,6 @@
|
|||
<string name="notconnected">Not connected to the internet</string>
|
||||
<string name="failedretrievetime">Failed retrieve time</string>
|
||||
<string name="requirementnotmet">Objective requirements not met</string>
|
||||
<string name="what_i_ve_learned">What I\'ve learned:</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue