Automation dialogs refactor
This commit is contained in:
parent
0e96eb666e
commit
cbfb8a6a0f
|
@ -47,7 +47,7 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
||||||
overview_calibration_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
overview_calibration_units.text = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit() :Boolean {
|
||||||
val units = ProfileFunctions.getSystemUnits()
|
val units = ProfileFunctions.getSystemUnits()
|
||||||
val unitLabel = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
val unitLabel = if (units == Constants.MMOL) MainApp.gs(R.string.mmol) else MainApp.gs(R.string.mgdl)
|
||||||
val actions: LinkedList<String?> = LinkedList()
|
val actions: LinkedList<String?> = LinkedList()
|
||||||
|
@ -62,5 +62,6 @@ class CalibrationDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -131,7 +131,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
return if (value > 0) "+$value" else value.toString()
|
return if (value > 0) "+$value" else value.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val carbs = overview_carbs_carbs.value.toInt()
|
val carbs = overview_carbs_carbs.value.toInt()
|
||||||
val carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(Constraint(carbs)).value()
|
val carbsAfterConstraints = MainApp.getConstraintChecker().applyCarbsConstraints(Constraint(carbs)).value()
|
||||||
val units = ProfileFunctions.getSystemUnits()
|
val units = ProfileFunctions.getSystemUnits()
|
||||||
|
@ -213,5 +213,6 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -100,7 +100,7 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
?: bg, 2.0, 500.0, 1.0, DecimalFormat("0"), false, ok, bgTextWatcher)
|
?: bg, 2.0, 500.0, 1.0, DecimalFormat("0"), false, ok, bgTextWatcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val enteredBy = SP.getString("careportal_enteredby", "")
|
val enteredBy = SP.getString("careportal_enteredby", "")
|
||||||
val unitResId = if (ProfileFunctions.getSystemUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
|
val unitResId = if (ProfileFunctions.getSystemUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
|
||||||
|
|
||||||
|
@ -143,5 +143,6 @@ class CareDialog : DialogFragmentWithDate() {
|
||||||
NSUpload.uploadCareportalEntryToNS(json)
|
NSUpload.uploadCareportalEntryToNS(json)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,13 +112,13 @@ abstract class DialogFragmentWithDate : DialogFragment() {
|
||||||
log.debug("guarding: ok already clicked")
|
log.debug("guarding: ok already clicked")
|
||||||
} else {
|
} else {
|
||||||
okClicked = true
|
okClicked = true
|
||||||
submit()
|
if (submit()) dismiss()
|
||||||
|
else okClicked = false
|
||||||
}
|
}
|
||||||
dismiss()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cancel.setOnClickListener { dismiss() }
|
cancel.setOnClickListener { dismiss() }
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract fun submit()
|
abstract fun submit(): Boolean
|
||||||
}
|
}
|
|
@ -51,7 +51,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
?: extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, DecimalFormat("0"), false, ok)
|
?: extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, DecimalFormat("0"), false, ok)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val insulin = SafeParse.stringToDouble(actions_extendedbolus_insulin.text)
|
val insulin = SafeParse.stringToDouble(actions_extendedbolus_insulin.text)
|
||||||
val durationInMinutes = SafeParse.stringToInt(actions_extendedbolus_duration.text)
|
val durationInMinutes = SafeParse.stringToInt(actions_extendedbolus_duration.text)
|
||||||
val actions: LinkedList<String> = LinkedList()
|
val actions: LinkedList<String> = LinkedList()
|
||||||
|
@ -78,5 +78,6 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -70,7 +70,7 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val insulin = SafeParse.stringToDouble(fill_insulinamount.text)
|
val insulin = SafeParse.stringToDouble(fill_insulinamount.text)
|
||||||
val actions: LinkedList<String?> = LinkedList()
|
val actions: LinkedList<String?> = LinkedList()
|
||||||
|
|
||||||
|
@ -125,5 +125,6 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -111,8 +111,9 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
return if (value > 0) "+$formatted" else formatted
|
return if (value > 0) "+$formatted" else formatted
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription ?: return
|
val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription
|
||||||
|
?: return false
|
||||||
val insulin = SafeParse.stringToDouble(overview_insulin_amount.text)
|
val insulin = SafeParse.stringToDouble(overview_insulin_amount.text)
|
||||||
val insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(insulin)).value()
|
val insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(Constraint(insulin)).value()
|
||||||
val actions: LinkedList<String?> = LinkedList()
|
val actions: LinkedList<String?> = LinkedList()
|
||||||
|
@ -185,5 +186,6 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -73,8 +73,9 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile ?: return
|
val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile
|
||||||
|
?: return false
|
||||||
|
|
||||||
val actions: LinkedList<String> = LinkedList()
|
val actions: LinkedList<String> = LinkedList()
|
||||||
val duration = overview_profileswitch_duration.value
|
val duration = overview_profileswitch_duration.value
|
||||||
|
@ -99,5 +100,6 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
ProfileFunctions.doProfileSwitch(profileStore, profile, duration.toInt(), percent, timeShift, eventTime)
|
ProfileFunctions.doProfileSwitch(profileStore, profile, duration.toInt(), percent, timeShift, eventTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,11 +69,11 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
var percent = 0
|
var percent = 0
|
||||||
var absolute = 0.0
|
var absolute = 0.0
|
||||||
val durationInMinutes = SafeParse.stringToInt(actions_tempbasal_duration.text)
|
val durationInMinutes = SafeParse.stringToInt(actions_tempbasal_duration.text)
|
||||||
val profile = ProfileFunctions.getInstance().profile ?: return
|
val profile = ProfileFunctions.getInstance().profile ?: return false
|
||||||
val actions: LinkedList<String> = LinkedList()
|
val actions: LinkedList<String> = LinkedList()
|
||||||
actions.add("<b>" + MainApp.gs(R.string.setbasalquestion) + "</b>")
|
actions.add("<b>" + MainApp.gs(R.string.setbasalquestion) + "</b>")
|
||||||
if (isPercentPump) {
|
if (isPercentPump) {
|
||||||
|
@ -111,5 +111,6 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -109,7 +109,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val actions: LinkedList<String> = LinkedList()
|
val actions: LinkedList<String> = LinkedList()
|
||||||
val reason = overview_temptarget_reason.selectedItem.toString()
|
val reason = overview_temptarget_reason.selectedItem.toString()
|
||||||
val unitResId = if (ProfileFunctions.getSystemUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
|
val unitResId = if (ProfileFunctions.getSystemUnits() == Constants.MGDL) R.string.mgdl else R.string.mmol
|
||||||
|
@ -147,5 +147,6 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
if (duration == 10.0) SP.putBoolean(R.string.key_objectiveusetemptarget, true)
|
if (duration == 10.0) SP.putBoolean(R.string.key_objectiveusetemptarget, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,9 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
?: 0.0, 0.0, maxInsulin, pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
?: 0.0, 0.0, maxInsulin, pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, ok, textWatcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun submit() {
|
override fun submit(): Boolean {
|
||||||
val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription ?: return
|
val pumpDescription = ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription
|
||||||
|
?: return false
|
||||||
val insulin = SafeParse.stringToDouble(overview_treatment_insulin.text)
|
val insulin = SafeParse.stringToDouble(overview_treatment_insulin.text)
|
||||||
val carbs = SafeParse.stringToInt(overview_treatment_carbs.text)
|
val carbs = SafeParse.stringToInt(overview_treatment_carbs.text)
|
||||||
val recordOnlyChecked = overview_treatment_record_only.isChecked
|
val recordOnlyChecked = overview_treatment_record_only.isChecked
|
||||||
|
@ -125,5 +126,6 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
OKDialog.show(activity, "", MainApp.gs(R.string.no_action_selected), null)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -75,7 +75,7 @@ public class ActionStartTempTarget extends Action {
|
||||||
int unitResId = value.getUnits().equals(Constants.MGDL) ? R.string.mgdl : R.string.mmol;
|
int unitResId = value.getUnits().equals(Constants.MGDL) ? R.string.mgdl : R.string.mmol;
|
||||||
|
|
||||||
new LayoutBuilder()
|
new LayoutBuilder()
|
||||||
.add(new LabelWithElement(MainApp.gs(R.string.careportal_temporarytarget) + " [" + MainApp.gs(unitResId) + "]", "", value))
|
.add(new LabelWithElement(MainApp.gs(R.string.careportal_temporarytarget) + "\n[" + MainApp.gs(unitResId) + "]", "", value))
|
||||||
.add(new LabelWithElement(MainApp.gs(R.string.careportal_newnstreatment_duration_min_label), "", duration))
|
.add(new LabelWithElement(MainApp.gs(R.string.careportal_newnstreatment_duration_min_label), "", duration))
|
||||||
.build(root);
|
.build(root);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ class ActionListAdapter(private val fragmentManager: FragmentManager, private va
|
||||||
recyclerView.notifyDataSetChanged()
|
recyclerView.notifyDataSetChanged()
|
||||||
RxBus.send(EventAutomationUpdateGui())
|
RxBus.send(EventAutomationUpdateGui())
|
||||||
}
|
}
|
||||||
|
if (action.icon().isPresent) view.findViewById<ImageView>(R.id.automation_action_image).setImageResource(action.icon().get())
|
||||||
view.findViewById<TextView>(R.id.automation_viewActionTitle).text = action.shortDescription()
|
view.findViewById<TextView>(R.id.automation_viewActionTitle).text = action.shortDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,18 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationAddAction
|
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationAddAction
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
|
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
|
||||||
import kotlinx.android.synthetic.main.automation_dialog_choose_action.*
|
import kotlinx.android.synthetic.main.automation_dialog_choose_action.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
|
|
||||||
class ChooseActionDialog : DialogFragment() {
|
class ChooseActionDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
var checkedIndex = -1
|
private var checkedIndex = -1
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
|
@ -26,7 +25,7 @@ class ChooseActionDialog : DialogFragment() {
|
||||||
checkedIndex = bundle.getInt("checkedIndex")
|
checkedIndex = bundle.getInt("checkedIndex")
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog?.setCanceledOnTouchOutside(false)
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.automation_dialog_choose_action, container, false)
|
return inflater.inflate(R.layout.automation_dialog_choose_action, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,27 +41,19 @@ class ChooseActionDialog : DialogFragment() {
|
||||||
|
|
||||||
if (checkedIndex != -1)
|
if (checkedIndex != -1)
|
||||||
(automation_radioGroup.getChildAt(checkedIndex) as RadioButton).isChecked = true
|
(automation_radioGroup.getChildAt(checkedIndex) as RadioButton).isChecked = true
|
||||||
|
}
|
||||||
|
|
||||||
// OK button
|
override fun submit(): Boolean {
|
||||||
ok.setOnClickListener {
|
|
||||||
dismiss()
|
|
||||||
instantiateAction()?.let {
|
instantiateAction()?.let {
|
||||||
RxBus.send(EventAutomationAddAction(it))
|
RxBus.send(EventAutomationAddAction(it))
|
||||||
RxBus.send(EventAutomationUpdateGui())
|
RxBus.send(EventAutomationUpdateGui())
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel button
|
override fun onSaveInstanceState(savedInstanceState: Bundle) {
|
||||||
cancel.setOnClickListener { dismiss() }
|
super.onSaveInstanceState(savedInstanceState)
|
||||||
}
|
savedInstanceState.putInt("checkedIndex", determineCheckedIndex())
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSaveInstanceState(bundle: Bundle) {
|
|
||||||
bundle.putInt("checkedIndex", determineCheckedIndex())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun instantiateAction(): Action? {
|
private fun instantiateAction(): Action? {
|
||||||
|
@ -86,5 +77,4 @@ class ChooseActionDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,15 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
||||||
import kotlinx.android.synthetic.main.automation_dialog_choose_trigger.*
|
import kotlinx.android.synthetic.main.automation_dialog_choose_trigger.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
|
|
||||||
class ChooseTriggerDialog : DialogFragment() {
|
class ChooseTriggerDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
private var checkedIndex = -1
|
private var checkedIndex = -1
|
||||||
|
|
||||||
private var clickListener: OnClickListener? = null
|
private var clickListener: OnClickListener? = null
|
||||||
|
|
||||||
interface OnClickListener {
|
interface OnClickListener {
|
||||||
|
@ -29,7 +27,7 @@ class ChooseTriggerDialog : DialogFragment() {
|
||||||
checkedIndex = bundle.getInt("checkedIndex")
|
checkedIndex = bundle.getInt("checkedIndex")
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog?.setCanceledOnTouchOutside(false)
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.automation_dialog_choose_trigger, container, false)
|
return inflater.inflate(R.layout.automation_dialog_choose_trigger, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,30 +43,22 @@ class ChooseTriggerDialog : DialogFragment() {
|
||||||
|
|
||||||
if (checkedIndex != -1)
|
if (checkedIndex != -1)
|
||||||
(automation_chooseTriggerRadioGroup.getChildAt(checkedIndex) as RadioButton).isChecked = true
|
(automation_chooseTriggerRadioGroup.getChildAt(checkedIndex) as RadioButton).isChecked = true
|
||||||
|
}
|
||||||
|
|
||||||
// OK button
|
override fun submit(): Boolean {
|
||||||
ok.setOnClickListener {
|
|
||||||
dismiss()
|
|
||||||
instantiateTrigger()?.let {
|
instantiateTrigger()?.let {
|
||||||
clickListener?.onClick(it)
|
clickListener?.onClick(it)
|
||||||
}
|
}
|
||||||
}
|
return true
|
||||||
|
|
||||||
// Cancel button
|
|
||||||
cancel.setOnClickListener { dismiss() }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOnClickListener(clickListener: OnClickListener) {
|
fun setOnClickListener(clickListener: OnClickListener) {
|
||||||
this.clickListener = clickListener
|
this.clickListener = clickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(bundle: Bundle) {
|
override fun onSaveInstanceState(savedInstanceState: Bundle) {
|
||||||
bundle.putInt("checkedIndex", determineCheckedIndex())
|
super.onSaveInstanceState(savedInstanceState)
|
||||||
|
savedInstanceState.putInt("checkedIndex", determineCheckedIndex())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun instantiateTrigger(): Trigger? {
|
private fun instantiateTrigger(): Trigger? {
|
||||||
|
@ -92,5 +82,4 @@ class ChooseTriggerDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,15 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateAction
|
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateAction
|
||||||
import kotlinx.android.synthetic.main.automation_dialog_action.*
|
import kotlinx.android.synthetic.main.automation_dialog_action.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class EditActionDialog : DialogFragment() {
|
class EditActionDialog : DialogFragmentWithDate() {
|
||||||
private var action: Action? = null
|
private var action: Action? = null
|
||||||
private var actionPosition: Int = -1
|
private var actionPosition: Int = -1
|
||||||
|
|
||||||
|
@ -24,8 +23,7 @@ class EditActionDialog : DialogFragment() {
|
||||||
actionPosition = bundle.getInt("actionPosition", -1)
|
actionPosition = bundle.getInt("actionPosition", -1)
|
||||||
bundle.getString("action")?.let { action = Action.instantiate(JSONObject(it)) }
|
bundle.getString("action")?.let { action = Action.instantiate(JSONObject(it)) }
|
||||||
}
|
}
|
||||||
|
onCreateViewGeneral()
|
||||||
dialog?.setCanceledOnTouchOutside(false)
|
|
||||||
return inflater.inflate(R.layout.automation_dialog_action, container, false)
|
return inflater.inflate(R.layout.automation_dialog_action, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,22 +35,13 @@ class EditActionDialog : DialogFragment() {
|
||||||
automation_editActionLayout.removeAllViews()
|
automation_editActionLayout.removeAllViews()
|
||||||
it.generateDialog(automation_editActionLayout)
|
it.generateDialog(automation_editActionLayout)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// OK button
|
override fun submit(): Boolean {
|
||||||
ok.setOnClickListener {
|
|
||||||
dismiss()
|
|
||||||
action?.let {
|
action?.let {
|
||||||
RxBus.send(EventAutomationUpdateAction(it, actionPosition))
|
RxBus.send(EventAutomationUpdateAction(it, actionPosition))
|
||||||
}
|
}
|
||||||
}
|
return true
|
||||||
|
|
||||||
// Cancel button
|
|
||||||
cancel.setOnClickListener { dismiss() }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(bundle: Bundle) {
|
override fun onSaveInstanceState(bundle: Bundle) {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
|
import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
||||||
|
@ -17,9 +17,8 @@ import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import kotlinx.android.synthetic.main.automation_dialog_event.*
|
import kotlinx.android.synthetic.main.automation_dialog_event.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
|
|
||||||
class EditEventDialog : DialogFragment() {
|
class EditEventDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
private var actionListAdapter: ActionListAdapter? = null
|
private var actionListAdapter: ActionListAdapter? = null
|
||||||
private var event: AutomationEvent = AutomationEvent()
|
private var event: AutomationEvent = AutomationEvent()
|
||||||
|
@ -35,7 +34,7 @@ class EditEventDialog : DialogFragment() {
|
||||||
bundle.getString("event")?.let { event = AutomationEvent().fromJSON(it) }
|
bundle.getString("event")?.let { event = AutomationEvent().fromJSON(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog?.setCanceledOnTouchOutside(false)
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.automation_dialog_event, container, false)
|
return inflater.inflate(R.layout.automation_dialog_event, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,39 +59,6 @@ class EditEventDialog : DialogFragment() {
|
||||||
|
|
||||||
automation_addAction.setOnClickListener { fragmentManager?.let { ChooseActionDialog().show(it, "ChooseActionDialog") } }
|
automation_addAction.setOnClickListener { fragmentManager?.let { ChooseActionDialog().show(it, "ChooseActionDialog") } }
|
||||||
|
|
||||||
// OK button
|
|
||||||
ok.setOnClickListener {
|
|
||||||
// check for title
|
|
||||||
val title = automation_inputEventTitle.text.toString()
|
|
||||||
if (title.isEmpty()) {
|
|
||||||
ToastUtils.showToastInUiThread(context, R.string.automation_missing_task_name)
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
event.title = title
|
|
||||||
// check for at least one trigger
|
|
||||||
val con = event.trigger as TriggerConnector
|
|
||||||
if (con.size() == 0) {
|
|
||||||
ToastUtils.showToastInUiThread(context, R.string.automation_missing_trigger)
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
// check for at least one action
|
|
||||||
if (event.actions.isEmpty()) {
|
|
||||||
ToastUtils.showToastInUiThread(context, R.string.automation_missing_action)
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
// store
|
|
||||||
if (position == -1)
|
|
||||||
AutomationPlugin.automationEvents.add(event)
|
|
||||||
else
|
|
||||||
AutomationPlugin.automationEvents[position] = event
|
|
||||||
|
|
||||||
dismiss()
|
|
||||||
RxBus.send(EventAutomationDataChanged())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cancel button
|
|
||||||
cancel.setOnClickListener { dismiss() }
|
|
||||||
|
|
||||||
showPreconditions()
|
showPreconditions()
|
||||||
|
|
||||||
disposable.add(RxBus
|
disposable.add(RxBus
|
||||||
|
@ -137,9 +103,33 @@ class EditEventDialog : DialogFragment() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun submit() : Boolean{
|
||||||
super.onStart()
|
// check for title
|
||||||
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
val title = automation_inputEventTitle.text.toString()
|
||||||
|
if (title.isEmpty()) {
|
||||||
|
ToastUtils.showToastInUiThread(context, R.string.automation_missing_task_name)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
event.title = title
|
||||||
|
// check for at least one trigger
|
||||||
|
val con = event.trigger as TriggerConnector
|
||||||
|
if (con.size() == 0) {
|
||||||
|
ToastUtils.showToastInUiThread(context, R.string.automation_missing_trigger)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// check for at least one action
|
||||||
|
if (event.actions.isEmpty()) {
|
||||||
|
ToastUtils.showToastInUiThread(context, R.string.automation_missing_action)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// store
|
||||||
|
if (position == -1)
|
||||||
|
AutomationPlugin.automationEvents.add(event)
|
||||||
|
else
|
||||||
|
AutomationPlugin.automationEvents[position] = event
|
||||||
|
|
||||||
|
RxBus.send(EventAutomationDataChanged())
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
@ -147,10 +137,10 @@ class EditEventDialog : DialogFragment() {
|
||||||
disposable.clear()
|
disposable.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(bundle: Bundle) {
|
override fun onSaveInstanceState(savedInstanceState: Bundle) {
|
||||||
super.onSaveInstanceState(bundle)
|
super.onSaveInstanceState(savedInstanceState)
|
||||||
bundle.putString("event", event.toJSON())
|
savedInstanceState.putString("event", event.toJSON())
|
||||||
bundle.putInt("position", position)
|
savedInstanceState.putInt("position", position)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showPreconditions() {
|
private fun showPreconditions() {
|
||||||
|
@ -164,5 +154,4 @@ class EditEventDialog : DialogFragment() {
|
||||||
automation_forcedTriggerDescriptionLabel.visibility = View.GONE
|
automation_forcedTriggerDescriptionLabel.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,14 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateTrigger
|
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateTrigger
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
||||||
import kotlinx.android.synthetic.main.automation_dialog_edit_trigger.*
|
import kotlinx.android.synthetic.main.automation_dialog_edit_trigger.*
|
||||||
import kotlinx.android.synthetic.main.okcancel.*
|
|
||||||
|
|
||||||
class EditTriggerDialog : DialogFragment() {
|
class EditTriggerDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
private var trigger: Trigger? = null
|
private var trigger: Trigger? = null
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ class EditTriggerDialog : DialogFragment() {
|
||||||
bundle.getString("trigger")?.let { trigger = Trigger.instantiate(it) }
|
bundle.getString("trigger")?.let { trigger = Trigger.instantiate(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog?.setCanceledOnTouchOutside(false)
|
onCreateViewGeneral()
|
||||||
return inflater.inflate(R.layout.automation_dialog_edit_trigger, container, false)
|
return inflater.inflate(R.layout.automation_dialog_edit_trigger, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,24 +31,15 @@ class EditTriggerDialog : DialogFragment() {
|
||||||
|
|
||||||
// display root trigger
|
// display root trigger
|
||||||
trigger?.generateDialog(automation_layoutTrigger, fragmentManager)
|
trigger?.generateDialog(automation_layoutTrigger, fragmentManager)
|
||||||
|
}
|
||||||
|
|
||||||
// OK button
|
override fun submit():Boolean {
|
||||||
ok.setOnClickListener {
|
|
||||||
dismiss()
|
|
||||||
trigger?.let { trigger -> RxBus.send(EventAutomationUpdateTrigger(trigger)) }
|
trigger?.let { trigger -> RxBus.send(EventAutomationUpdateTrigger(trigger)) }
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel button
|
override fun onSaveInstanceState(savedInstanceState: Bundle) {
|
||||||
cancel.setOnClickListener { dismiss() }
|
super.onSaveInstanceState(savedInstanceState)
|
||||||
}
|
trigger?.let { savedInstanceState.putString("trigger", it.toJSON()) }
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSaveInstanceState(bundle: Bundle) {
|
|
||||||
super.onSaveInstanceState(bundle)
|
|
||||||
trigger?.let { bundle.putString("trigger", it.toJSON()) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
5
app/src/main/res/drawable/ic_action_orange_48dp.xml
Normal file
5
app/src/main/res/drawable/ic_action_orange_48dp.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="48dp" android:tint="#FF8B00"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M10.85,12.65h2.3L12,9l-1.15,3.65zM20,8.69V4h-4.69L12,0.69 8.69,4H4v4.69L0.69,12 4,15.31V20h4.69L12,23.31 15.31,20H20v-4.69L23.31,12 20,8.69zM14.3,16l-0.7,-2h-3.2l-0.7,2H7.8L11,7h2l3.2,9h-1.9z"/>
|
||||||
|
</vector>
|
5
app/src/main/res/drawable/ic_trigger_green_48dp.xml
Normal file
5
app/src/main/res/drawable/ic_trigger_green_48dp.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="48dp" android:tint="#20FF20"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M21,10.12h-6.78l2.74,-2.82c-2.73,-2.7 -7.15,-2.8 -9.88,-0.1 -2.73,2.71 -2.73,7.08 0,9.79 2.73,2.71 7.15,2.71 9.88,0C18.32,15.65 19,14.08 19,12.1h2c0,1.98 -0.88,4.55 -2.64,6.29 -3.51,3.48 -9.21,3.48 -12.72,0 -3.5,-3.47 -3.53,-9.11 -0.02,-12.58 3.51,-3.47 9.14,-3.47 12.65,0L21,3v7.12zM12.5,8v4.25l3.5,2.08 -0.72,1.21L11,13V8h1.5z"/>
|
||||||
|
</vector>
|
|
@ -25,11 +25,18 @@
|
||||||
android:id="@+id/automation_layoutText"
|
android:id="@+id/automation_layoutText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toStartOf="@id/automation_iconTrash"
|
android:layout_toStartOf="@id/automation_iconTrash"
|
||||||
android:layout_alignParentStart="true">
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/automation_action_image"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_action_orange_48dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/automation_viewActionTitle"
|
android:id="@+id/automation_viewActionTitle"
|
||||||
|
|
|
@ -1,27 +1,56 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="10dp">
|
android:focusableInTouchMode="true"
|
||||||
|
android:minWidth="300dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".plugins.general.automation.dialogs.EditActionDialog">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/dialog_title_background"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/action"
|
||||||
|
android:src="@drawable/ic_action_orange_48dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/automation_actionTitle"
|
android:id="@+id/automation_actionTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_centerInParent="true"
|
||||||
android:paddingBottom="10dp"
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:textAlignment="center"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/spacer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/automation_editActionLayout"
|
android:id="@+id/automation_editActionLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusableInTouchMode="true"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dp" />
|
android:padding="10dp" />
|
||||||
|
|
||||||
|
|
|
@ -3,26 +3,56 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
|
android:focusableInTouchMode="true"
|
||||||
|
android:minWidth="300dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".plugins.general.automation.dialogs.EditEventDialog">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusableInTouchMode="true"
|
android:orientation="vertical">
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/dialog_title_background"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/please_choose_an_action_type"
|
||||||
|
android:src="@drawable/ic_action_orange_48dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actions_care_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
android:text="@string/please_choose_an_action_type"
|
android:text="@string/please_choose_an_action_type"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/spacer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp" />
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/automation_radioGroup"
|
android:id="@+id/automation_radioGroup"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginVertical="5dp" />
|
android:padding="10dp"/>
|
||||||
|
|
||||||
<include layout="@layout/okcancel" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
|
|
|
@ -3,26 +3,49 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
|
android:focusableInTouchMode="true"
|
||||||
|
android:minWidth="300dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".plugins.general.automation.dialogs.EditEventDialog">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusableInTouchMode="true"
|
android:orientation="vertical">
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/dialog_title_background"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/please_choose_a_trigger_type"
|
||||||
|
android:src="@drawable/ic_trigger_green_48dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actions_care_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
android:text="@string/please_choose_a_trigger_type"
|
android:text="@string/please_choose_a_trigger_type"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/automation_chooseTriggerRadioGroup"
|
android:id="@+id/automation_chooseTriggerRadioGroup"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginVertical="5dp" />
|
android:padding="10dp"/>
|
||||||
|
|
||||||
<include layout="@layout/okcancel" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
|
|
|
@ -3,27 +3,49 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
|
android:focusableInTouchMode="true"
|
||||||
|
android:minWidth="300dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".plugins.general.automation.dialogs.EditEventDialog">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusableInTouchMode="true"
|
android:orientation="vertical">
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/dialog_title_background"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/triggers"
|
||||||
|
android:src="@drawable/ic_trigger_green_48dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/automation_actionTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
android:text="@string/triggers"
|
android:text="@string/triggers"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/automation_layoutTrigger"
|
android:id="@+id/automation_layoutTrigger"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:padding="10dp"
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical" />
|
||||||
|
|
||||||
<include layout="@layout/okcancel" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
|
@ -1,16 +1,58 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog">
|
android:focusableInTouchMode="true"
|
||||||
|
android:minWidth="300dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".plugins.general.automation.dialogs.EditEventDialog">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusableInTouchMode="true"
|
android:orientation="vertical">
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="10dp">
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/dialog_title_background"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/automation"
|
||||||
|
android:src="@drawable/ic_action_orange_48dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:text="@string/automation_event"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/spacer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/automation_inputEventTitle"
|
android:id="@+id/automation_inputEventTitle"
|
||||||
|
@ -18,20 +60,23 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/taskname" />
|
android:hint="@string/taskname" />
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="2dip"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:background="@color/listdelimiter" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/trigger_image"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/ic_trigger_green_48dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_toEndOf="@+id/trigger_image"
|
||||||
android:text="@string/condition"
|
android:text="@string/condition"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
@ -41,6 +86,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
android:background="@color/ribbonDefault"
|
android:background="@color/ribbonDefault"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:text="@string/edit_short" />
|
android:text="@string/edit_short" />
|
||||||
|
@ -81,9 +127,19 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/action_image"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/ic_action_orange_48dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_toEndOf="@+id/action_image"
|
||||||
android:text="@string/action"
|
android:text="@string/action"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
@ -93,6 +149,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
android:background="@color/ribbonDefault"
|
android:background="@color/ribbonDefault"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:text="@string/add_short" />
|
android:text="@string/add_short" />
|
||||||
|
@ -110,4 +167,6 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
|
@ -23,7 +23,6 @@
|
||||||
android:padding="5dp">
|
android:padding="5dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/actions_care_icon"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:contentDescription="@string/overview_calibration"
|
android:contentDescription="@string/overview_calibration"
|
||||||
|
@ -40,6 +39,7 @@
|
||||||
android:text="@string/overview_calibration"
|
android:text="@string/overview_calibration"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -1419,8 +1419,8 @@
|
||||||
<string name="cobcompared">COB %1$s %2$.0f</string>
|
<string name="cobcompared">COB %1$s %2$.0f</string>
|
||||||
<string name="taskname">Task name</string>
|
<string name="taskname">Task name</string>
|
||||||
<string name="edit_short">EDIT</string>
|
<string name="edit_short">EDIT</string>
|
||||||
<string name="please_choose_an_action_type">Please choose an action type:</string>
|
<string name="please_choose_an_action_type">Choose an action type</string>
|
||||||
<string name="please_choose_a_trigger_type">Please choose a trigger type:</string>
|
<string name="please_choose_a_trigger_type">Choose a trigger type</string>
|
||||||
<string name="triggers">Triggers:</string>
|
<string name="triggers">Triggers:</string>
|
||||||
<string name="remove_label">REMOVE</string>
|
<string name="remove_label">REMOVE</string>
|
||||||
<string name="preconditions">Preconditions:</string>
|
<string name="preconditions">Preconditions:</string>
|
||||||
|
@ -1604,7 +1604,7 @@
|
||||||
<string name="automation_trigger_pump_last_connection_description">Last connection to pump [minutes ago]</string>
|
<string name="automation_trigger_pump_last_connection_description">Last connection to pump [minutes ago]</string>
|
||||||
<string name="automation_trigger_pump_last_connection_compared">Last connection to pump %1$s %2$s min ago</string>
|
<string name="automation_trigger_pump_last_connection_compared">Last connection to pump %1$s %2$s min ago</string>
|
||||||
<string name="sendsmsactionlabel">Send SMS: %1$s</string>
|
<string name="sendsmsactionlabel">Send SMS: %1$s</string>
|
||||||
<string name="sendsmsactiondescription">Send SMS to all numbers in preferences</string>
|
<string name="sendsmsactiondescription">Send SMS to all numbers</string>
|
||||||
<string name="sendsmsactiontext">Send SMS with text</string>
|
<string name="sendsmsactiontext">Send SMS with text</string>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1689,5 +1689,6 @@
|
||||||
<string name="error">Error</string>
|
<string name="error">Error</string>
|
||||||
<string name="timeformat12h">12h</string>
|
<string name="timeformat12h">12h</string>
|
||||||
<string name="timeformat24h">24h</string>
|
<string name="timeformat24h">24h</string>
|
||||||
|
<string name="automation_event">Automation event</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue