Automation Day selection (duration) and Active profile selection for Autotune

This commit is contained in:
Philoul 2022-05-05 23:27:07 +02:00
parent cfd3ffc6ed
commit 9cec728234
2 changed files with 7 additions and 3 deletions

View file

@ -13,7 +13,7 @@ class InputDuration(
) : Element() {
enum class TimeUnit {
MINUTES, HOURS
MINUTES, HOURS, DAYS
}
override fun addToLayout(root: LinearLayout) {
@ -21,6 +21,9 @@ class InputDuration(
if (unit == TimeUnit.MINUTES) {
numberPicker = MinutesNumberPicker(root.context, null)
numberPicker.setParams(value.toDouble(), 5.0, 24 * 60.0, 10.0, DecimalFormat("0"), false, root.findViewById(R.id.ok))
} else if (unit == TimeUnit.DAYS) {
numberPicker = MinutesNumberPicker(root.context, null)
numberPicker.setParams(value.toDouble(), 1.0, 30.0, 1.0, DecimalFormat("0"), false, root.findViewById(R.id.ok))
} else {
numberPicker = NumberPicker(root.context, null)
numberPicker.setParams(value.toDouble(), 1.0, 24.0, 1.0, DecimalFormat("0"), false, root.findViewById(R.id.ok))

View file

@ -10,14 +10,15 @@ import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ResourceHelper
class InputProfileName(private val rh: ResourceHelper, private val activePlugin: ActivePlugin, val name: String = "") : Element() {
class InputProfileName(private val rh: ResourceHelper, private val activePlugin: ActivePlugin, val name: String = "", val addActive: Boolean = false) : Element() {
var value: String = name
override fun addToLayout(root: LinearLayout) {
val profileStore = activePlugin.activeProfileSource.profile ?: return
val profileList = profileStore.getProfileList()
if (addActive)
profileList.add(0, rh.gs(R.string.active))
root.addView(
Spinner(root.context).apply {
adapter = ArrayAdapter(root.context, R.layout.spinner_centered, profileList).apply {