diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
index c6624bb3d3..408b49ed38 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
@@ -4,11 +4,7 @@ import android.content.Context
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.view.Window
-import android.view.WindowManager
+import android.view.*
import android.widget.AdapterView
import android.widget.AdapterView.OnItemSelectedListener
import android.widget.ArrayAdapter
@@ -136,33 +132,36 @@ class WizardDialog : DaggerDialogFragment() {
val maxCorrection = constraintChecker.getMaxBolusAllowed().value()
bolusStep = activePlugin.activePump.pumpDescription.bolusStep
- if (profileFunction.getUnits() == GlucoseUnit.MGDL)
- binding.bgInput.setParams(savedInstanceState?.getDouble("bg_input")
- ?: 0.0, 0.0, 500.0, 1.0, DecimalFormat("0"), false, binding.ok, timeTextWatcher)
- else
- binding.bgInput.setParams(savedInstanceState?.getDouble("bg_input")
- ?: 0.0, 0.0, 30.0, 0.1, DecimalFormat("0.0"), false, binding.ok, textWatcher)
+ if (profileFunction.getUnits() == GlucoseUnit.MGDL) {
+ binding.bgInput.setParams(
+ savedInstanceState?.getDouble("bg_input")
+ ?: 0.0, 0.0, 500.0, 1.0, DecimalFormat("0"), false, binding.okcancel.ok, timeTextWatcher)
+ } else {
+ binding.bgInput.setParams(
+ savedInstanceState?.getDouble("bg_input")
+ ?: 0.0, 0.0, 30.0, 0.1, DecimalFormat("0.0"), false, binding.okcancel.ok, textWatcher)
+ }
binding.carbsInput.setParams(savedInstanceState?.getDouble("carbs_input")
- ?: 0.0, 0.0, maxCarbs.toDouble(), 1.0, DecimalFormat("0"), false, binding.ok, textWatcher)
+ ?: 0.0, 0.0, maxCarbs.toDouble(), 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher)
if (correctionPercent) {
calculatedPercentage = sp.getInt(R.string.key_boluswizard_percentage, 100).toDouble()
- binding.correctionInput.setParams(calculatedPercentage, 10.0, 200.0, 1.0, DecimalFormat("0"), false, binding.ok, textWatcher)
+ binding.correctionInput.setParams(calculatedPercentage, 10.0, 200.0, 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher)
binding.correctionInput.value = calculatedPercentage
binding.correctionUnit.text = "%"
} else {
binding.correctionInput.setParams(
savedInstanceState?.getDouble("correction_input")
- ?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.ok, textWatcher)
+ ?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.okcancel.ok, textWatcher)
binding.correctionUnit.text = rh.gs(R.string.insulin_unit_shortname)
}
binding.carbTimeInput.setParams(savedInstanceState?.getDouble("carb_time_input")
- ?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, binding.ok, timeTextWatcher)
+ ?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, timeTextWatcher)
initDialog()
calculatedPercentage = sp.getInt(R.string.key_boluswizard_percentage, 100).toDouble()
binding.percentUsed.text = rh.gs(R.string.format_percent, sp.getInt(R.string.key_boluswizard_percentage, 100))
// ok button
- binding.ok.setOnClickListener {
+ binding.okcancel.ok.setOnClickListener {
if (okClicked) {
aapsLogger.debug(LTag.UI, "guarding: ok already clicked")
} else {
@@ -175,12 +174,12 @@ class WizardDialog : DaggerDialogFragment() {
}
dismiss()
}
- binding.bgEnabledIcon.setOnClickListener { binding.bgCheckbox.isChecked = !binding.bgCheckbox.isChecked }
- binding.trendEnabledIcon.setOnClickListener { binding.bgTrendCheckbox.isChecked = !binding.bgTrendCheckbox.isChecked }
- binding.cobEnabledIcon.setOnClickListener { binding.cobCheckbox.isChecked = !binding.cobCheckbox.isChecked; processCobCheckBox(); }
- binding.iobEnabledIcon.setOnClickListener { if (!binding.cobCheckbox.isChecked) binding.iobCheckbox.isChecked = !binding.iobCheckbox.isChecked }
+ binding.bgCheckboxIcon.setOnClickListener { binding.bgCheckbox.isChecked = !binding.bgCheckbox.isChecked }
+ binding.trendCheckboxIcon.setOnClickListener { binding.bgTrendCheckbox.isChecked = !binding.bgTrendCheckbox.isChecked }
+ binding.cobCheckboxIcon.setOnClickListener { binding.cobCheckbox.isChecked = !binding.cobCheckbox.isChecked; processCobCheckBox(); }
+ binding.iobCheckboxIcon.setOnClickListener { if (!binding.cobCheckbox.isChecked) binding.iobCheckbox.isChecked = !binding.iobCheckbox.isChecked }
// cancel button
- binding.cancel.setOnClickListener {
+ binding.okcancel.cancel.setOnClickListener {
aapsLogger.debug(LTag.APS, "Dialog canceled: ${this.javaClass.name}")
dismiss()
}
@@ -212,11 +211,17 @@ class WizardDialog : DaggerDialogFragment() {
sp.putBoolean(rh.gs(R.string.key_wizard_correction_percent), isChecked)
binding.correctionUnit.text = if (isChecked) "%" else rh.gs(R.string.insulin_unit_shortname)
correctionPercent = binding.correctionPercent.isChecked
- if (correctionPercent)
- binding.correctionInput.setParams(calculatedPercentage, 10.0, 200.0, 1.0, DecimalFormat("0"), false, binding.ok, textWatcher)
- else
- binding.correctionInput.setParams(savedInstanceState?.getDouble("correction_input")
- ?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.ok, textWatcher)
+ if (correctionPercent) {
+ binding.correctionInput.setParams(calculatedPercentage, 10.0, 200.0, 1.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher)
+ binding.correctionInput.customContentDescription = rh.gs(R.string.a11_correction_percentage)
+ } else {
+ binding.correctionInput.setParams(
+ savedInstanceState?.getDouble("correction_input")
+ ?: 0.0, -maxCorrection, maxCorrection, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.okcancel.ok, textWatcher
+ )
+ binding.correctionInput.customContentDescription = rh.gs(R.string.a11_correction_units)
+ }
+ binding.correctionInput.updateA11yDescription()
binding.correctionInput.value = if (correctionPercent) calculatedPercentage else Round.roundTo(calculatedCorrection, bolusStep)
}
}
@@ -224,12 +229,12 @@ class WizardDialog : DaggerDialogFragment() {
binding.profile.onItemSelectedListener = object : OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {
ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.noprofileset))
- binding.ok.visibility = View.GONE
+ binding.okcancel.ok.visibility = View.GONE
}
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
calculateInsulin()
- binding.ok.visibility = View.VISIBLE
+ binding.okcancel.ok.visibility = View.VISIBLE
}
}
// bus
@@ -241,6 +246,14 @@ class WizardDialog : DaggerDialogFragment() {
}, fabricPrivacy::logException)
)
+ setA11yLabels()
+ }
+
+ private fun setA11yLabels() {
+ binding.bgInput.editText?.id?.let { binding.bgInputLabel.labelFor = it }
+ binding.carbsInput.editText?.id?.let { binding.carbsInputLabel.labelFor = it }
+ binding.correctionInput.editText?.id?.let { binding.correctionInputLabel.labelFor = it }
+ binding.carbTimeInput.editText?.id?.let { binding.carbTimeInputLabel.labelFor = it }
}
override fun onDestroyView() {
@@ -268,14 +281,14 @@ class WizardDialog : DaggerDialogFragment() {
}
private fun processEnabledIcons() {
- binding.bgEnabledIcon.alpha = if (binding.bgCheckbox.isChecked) 1.0f else 0.2f
- binding.trendEnabledIcon.alpha = if (binding.bgTrendCheckbox.isChecked) 1.0f else 0.2f
- binding.iobEnabledIcon.alpha = if (binding.iobCheckbox.isChecked) 1.0f else 0.2f
- binding.cobEnabledIcon.alpha = if (binding.cobCheckbox.isChecked) 1.0f else 0.2f
- binding.bgEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
- binding.trendEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
- binding.iobEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
- binding.cobEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
+ binding.bgCheckboxIcon.alpha = if (binding.bgCheckbox.isChecked) 1.0f else 0.2f
+ binding.trendCheckboxIcon.alpha = if (binding.bgTrendCheckbox.isChecked) 1.0f else 0.2f
+ binding.iobCheckboxIcon.alpha = if (binding.iobCheckbox.isChecked) 1.0f else 0.2f
+ binding.cobCheckboxIcon.alpha = if (binding.cobCheckbox.isChecked) 1.0f else 0.2f
+ binding.bgCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
+ binding.trendCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
+ binding.iobCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
+ binding.cobCheckboxIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
}
private fun saveCheckedStates() {
@@ -442,10 +455,10 @@ class WizardDialog : DaggerDialogFragment() {
val insulinText = if (wizard.calculatedTotalInsulin > 0.0) rh.gs(R.string.formatinsulinunits, wizard.calculatedTotalInsulin).formatColor(rh, R.color.bolus) else ""
val carbsText = if (carbsAfterConstraint > 0.0) rh.gs(R.string.format_carbs, carbsAfterConstraint).formatColor(rh, R.color.carbs) else ""
binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.result_insulin_carbs, insulinText, carbsText))
- binding.ok.visibility = View.VISIBLE
+ binding.okcancel.ok.visibility = View.VISIBLE
} else {
binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.missing_carbs, wizard.carbsEquivalent.toInt()).formatColor(rh, R.color.carbs))
- binding.ok.visibility = View.INVISIBLE
+ binding.okcancel.ok.visibility = View.INVISIBLE
}
binding.percentUsed.text = rh.gs(R.string.format_percent, wizard.percentageCorrection)
calculatedPercentage = wizard.calculatedPercentage
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
index d1f9321746..c9a361dca5 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
@@ -347,6 +347,8 @@ class BolusWizard @Inject constructor(
)
else
commonProcessing(ctx)
+ } else {
+ OKDialog.show(ctx, rh.gs(R.string.boluswizard), rh.gs(R.string.no_action_selected))
}
}
diff --git a/app/src/main/res/drawable/cb_backgroud_bg.xml b/app/src/main/res/drawable/cb_backgroud_bg.xml
new file mode 100644
index 0000000000..cf493051a9
--- /dev/null
+++ b/app/src/main/res/drawable/cb_backgroud_bg.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/cb_backgroud_cob.xml b/app/src/main/res/drawable/cb_backgroud_cob.xml
new file mode 100644
index 0000000000..b73f1f3b39
--- /dev/null
+++ b/app/src/main/res/drawable/cb_backgroud_cob.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/cb_backgroud_iob.xml b/app/src/main/res/drawable/cb_backgroud_iob.xml
new file mode 100644
index 0000000000..bce5594f2a
--- /dev/null
+++ b/app/src/main/res/drawable/cb_backgroud_iob.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/cb_backgroud_trend.xml b/app/src/main/res/drawable/cb_backgroud_trend.xml
new file mode 100644
index 0000000000..74e90acb2f
--- /dev/null
+++ b/app/src/main/res/drawable/cb_backgroud_trend.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/checkbox_bg_icon.xml b/app/src/main/res/drawable/checkbox_bg_icon.xml
new file mode 100644
index 0000000000..0e2e6b7ed9
--- /dev/null
+++ b/app/src/main/res/drawable/checkbox_bg_icon.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/checkbox_cob_icon.xml b/app/src/main/res/drawable/checkbox_cob_icon.xml
new file mode 100644
index 0000000000..01184068a2
--- /dev/null
+++ b/app/src/main/res/drawable/checkbox_cob_icon.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/checkbox_iob_icon.xml b/app/src/main/res/drawable/checkbox_iob_icon.xml
new file mode 100644
index 0000000000..aba6d56c20
--- /dev/null
+++ b/app/src/main/res/drawable/checkbox_iob_icon.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/checkbox_trend_icon.xml b/app/src/main/res/drawable/checkbox_trend_icon.xml
new file mode 100644
index 0000000000..de7ca8e81d
--- /dev/null
+++ b/app/src/main/res/drawable/checkbox_trend_icon.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/app/src/main/res/layout/dialog_wizard.xml b/app/src/main/res/layout/dialog_wizard.xml
index 0fe3d2f660..296f9b8ba8 100644
--- a/app/src/main/res/layout/dialog_wizard.xml
+++ b/app/src/main/res/layout/dialog_wizard.xml
@@ -59,6 +59,7 @@
android:layout_height="match_parent">
+ android:layout_height="40dp"
+ app:customContentDescription="@string/a11y_current_bg" />
-
+ android:layout_gravity="center_horizontal"
+ app:customContentDescription="@string/treatments_wizard_carbs_label" />
-
-
-
+ android:layoutDirection="rtl"
+ android:padding="2dp"
+ android:text="%"
+ android:textAppearance="@style/TextAppearance.AppCompat.Medium"
+ android:textStyle="bold" />
-
+ android:layout_gravity="center_horizontal"
+ app:customContentDescription="@string/a11_correction_units" />
-
-
+ android:drawableEnd="@drawable/ic_visibility" />
-
+ android:layout_height="fill_parent"
+ android:button="@drawable/checkbox_bg_icon"
+ android:checked="true"
+ android:contentDescription="@string/treatments_wizard_bg_label" />
-
+ android:layout_height="fill_parent"
+ android:button="@drawable/checkbox_trend_icon"
+ android:checked="true"
+ android:contentDescription="@string/bg_trend_label" />
-
+ android:layout_height="fill_parent"
+ android:button="@drawable/checkbox_iob_icon"
+ android:checked="true"
+ android:contentDescription="@string/iob" />
-
+ android:layout_height="fill_parent"
+ android:button="@drawable/checkbox_cob_icon"
+ android:checked="true"
+ android:contentDescription="@string/treatments_wizard_cob_label" />
-
+
-
-
-
-
+ android:layout_gravity="center"
+ app:contentDescription="carb time" />
-
-
-
-
+ android:checked="true"
+ android:text="@string/treatments_wizard_bg_label" />
-
-
+ android:checked="false"
+ android:text="@string/treatments_wizard_tt_label" />
@@ -506,15 +459,9 @@
android:id="@+id/bg_trend_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:width="32dp"
- android:checked="false" />
+ android:checked="false"
+ android:text="@string/bg_trend_label" />
-
-
-
+ android:checked="true"
+ android:text="@string/iob" />
-
-
+ android:checked="false"
+ android:text="@string/treatments_wizard_cob_label" />
+ android:layout_height="match_parent"
+ android:focusable="true">
-
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
-
+
+
+
+
+
+ android:layout_height="match_parent"
+ android:focusable="true">
-
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
-
+
+
+
+
+
+ android:layout_height="match_parent"
+ android:focusable="true">
-
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
-
+
+
+
+
+
+
@@ -712,4 +671,4 @@
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0bbd58db3b..98678d3e8d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1141,6 +1141,27 @@
last_processed_glunovo_timestamp
Identification (email, FB or Discord nick etc)
Identification not set in dev mode
+ heigh
+ in range
+ low
+ down fast
+ down
+ down trending
+ flat
+ up trending
+ up
+ up fast
+ none
+ unknown
+ graph
+ Blood glucose quality
+ recalculated
+ double entries
+ insulin
+ dialog
+ current blood glucode
+ correct outcome with %
+ correct outcome with units
Not available
diff --git a/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt b/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt
index d32f54e791..dcf34b8107 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/ui/NumberPicker.kt
@@ -15,6 +15,8 @@ import android.view.MotionEvent
import android.view.View
import android.view.View.OnFocusChangeListener
import android.view.View.OnTouchListener
+import android.view.accessibility.AccessibilityEvent
+import android.view.accessibility.AccessibilityManager
import android.view.inputmethod.InputMethodManager
import android.widget.Button
import android.widget.EditText
@@ -50,6 +52,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
protected var focused = false
private var mUpdater: ScheduledExecutorService? = null
private var mOnValueChangedListener: OnValueChangedListener? = null
+ private var mCustomContentDescription: String? = null
private var mHandler: Handler = Handler(Looper.getMainLooper(), Handler.Callback { msg: Message ->
when (msg.what) {
@@ -86,6 +89,13 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
}
}
+ var customContentDescription: String?
+ get() = mCustomContentDescription
+ set(value) {
+ mCustomContentDescription = value
+ updateA11yDescription()
+ }
+
protected open fun inflate(context: Context) {
LayoutInflater.from(context).inflate(R.layout.number_picker_layout, this, true)
}
@@ -121,6 +131,29 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
if (!focused) value // check min/max
updateEditText()
}
+ updateA11yDescription()
+ }
+
+ fun updateA11yDescription() {
+ val description = if (mCustomContentDescription != null) mCustomContentDescription else ""
+ minusButton?.contentDescription = context.getString(R.string.a11y_min_button_description, description, formatter?.format(this.step))
+ plusButton?.contentDescription = context.getString(R.string.a11y_plus_button_description, description, formatter?.format(this.step))
+ }
+
+ fun announceValue() {
+ val manager: AccessibilityManager = context
+ .getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
+ if (manager.isEnabled) {
+ val valueDescription = formatter?.format(currentValue)
+ AccessibilityEvent.obtain().apply {
+ eventType = AccessibilityEvent.TYPE_ANNOUNCEMENT
+ className = javaClass.name
+ packageName = context.packageName
+ text.add(valueDescription)
+ }.also {
+ manager.sendAccessibilityEvent(it)
+ }
+ }
}
override fun setTag(tag: Any) {
@@ -173,6 +206,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
this.okButton = okButton
editText?.keyListener = DigitsKeyListenerWithComma.getInstance(minValue < 0, step != round(step))
if (watcher != null) editText?.removeTextChangedListener(watcher)
+ updateA11yDescription()
updateEditText()
if (watcher != null) editText?.addTextChangedListener(watcher)
}
@@ -253,6 +287,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
private fun stopUpdating() {
mUpdater?.shutdownNow()
mUpdater = null
+ announceValue()
}
override fun onClick(v: View) {
@@ -265,6 +300,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
} else {
dec(1)
}
+ announceValue()
}
}
@@ -299,5 +335,16 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
init {
initialize(context)
+ context.theme.obtainStyledAttributes(
+ attrs,
+ R.styleable.NumberPicker,
+ 0, 0).apply {
+
+ try {
+ mCustomContentDescription = getString(R.styleable.NumberPicker_customContentDescription)
+ } finally {
+ recycle()
+ }
+ }
}
-}
\ No newline at end of file
+}
diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml
index fed5806fe6..85a25abfed 100644
--- a/core/src/main/res/values/attrs.xml
+++ b/core/src/main/res/values/attrs.xml
@@ -4,4 +4,7 @@
+
+
+
\ No newline at end of file
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 275a556517..0486648df8 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -540,6 +540,8 @@
Bolus OK
Pump paired
Insight Refresh Button
+ decrement %1$s by %2$s
+ increment %1$s by %2$s
- %1$d day