Automation Day selection (duration) and Active profile selection for Autotune
This commit is contained in:
parent
cfd3ffc6ed
commit
9cec728234
|
@ -13,7 +13,7 @@ class InputDuration(
|
||||||
) : Element() {
|
) : Element() {
|
||||||
|
|
||||||
enum class TimeUnit {
|
enum class TimeUnit {
|
||||||
MINUTES, HOURS
|
MINUTES, HOURS, DAYS
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun addToLayout(root: LinearLayout) {
|
override fun addToLayout(root: LinearLayout) {
|
||||||
|
@ -21,6 +21,9 @@ class InputDuration(
|
||||||
if (unit == TimeUnit.MINUTES) {
|
if (unit == TimeUnit.MINUTES) {
|
||||||
numberPicker = MinutesNumberPicker(root.context, null)
|
numberPicker = MinutesNumberPicker(root.context, null)
|
||||||
numberPicker.setParams(value.toDouble(), 5.0, 24 * 60.0, 10.0, DecimalFormat("0"), false, root.findViewById(R.id.ok))
|
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 {
|
} else {
|
||||||
numberPicker = NumberPicker(root.context, null)
|
numberPicker = NumberPicker(root.context, null)
|
||||||
numberPicker.setParams(value.toDouble(), 1.0, 24.0, 1.0, DecimalFormat("0"), false, root.findViewById(R.id.ok))
|
numberPicker.setParams(value.toDouble(), 1.0, 24.0, 1.0, DecimalFormat("0"), false, root.findViewById(R.id.ok))
|
||||||
|
|
|
@ -10,14 +10,15 @@ import info.nightscout.androidaps.automation.R
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
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
|
var value: String = name
|
||||||
|
|
||||||
override fun addToLayout(root: LinearLayout) {
|
override fun addToLayout(root: LinearLayout) {
|
||||||
val profileStore = activePlugin.activeProfileSource.profile ?: return
|
val profileStore = activePlugin.activeProfileSource.profile ?: return
|
||||||
val profileList = profileStore.getProfileList()
|
val profileList = profileStore.getProfileList()
|
||||||
|
if (addActive)
|
||||||
|
profileList.add(0, rh.gs(R.string.active))
|
||||||
root.addView(
|
root.addView(
|
||||||
Spinner(root.context).apply {
|
Spinner(root.context).apply {
|
||||||
adapter = ArrayAdapter(root.context, R.layout.spinner_centered, profileList).apply {
|
adapter = ArrayAdapter(root.context, R.layout.spinner_centered, profileList).apply {
|
||||||
|
|
Loading…
Reference in a new issue