remove loop from actions

This commit is contained in:
Milos Kozak 2019-07-16 17:05:51 +02:00
parent 888a63a5b0
commit 67b06f51fe
2 changed files with 21 additions and 23 deletions

View file

@ -26,6 +26,14 @@ import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
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.actions.ActionLoopDisable;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionLoopEnable;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionLoopResume;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionLoopSuspend;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionNotification;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionProfileSwitchPercent;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionStartTempTarget;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionStopTempTarget;
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged; import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged;
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui; import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
@ -214,4 +222,15 @@ public class AutomationPlugin extends PluginBase {
} }
storeToSP(); // save last run time storeToSP(); // save last run time
} }
public static final List<Action> actionDummyObjects = new ArrayList<Action>() {{
//add(new ActionLoopDisable());
//add(new ActionLoopEnable());
//add(new ActionLoopResume());
//add(new ActionLoopSuspend());
add(new ActionStartTempTarget());
add(new ActionStopTempTarget());
add(new ActionNotification());
add(new ActionProfileSwitchPercent());
}};
} }

View file

@ -10,23 +10,13 @@ import android.widget.RadioGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.Unbinder; import butterknife.Unbinder;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
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.actions.ActionLoopDisable;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionLoopEnable;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionLoopResume;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionLoopSuspend;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionNotification;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionProfileSwitchPercent;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionStartTempTarget;
import info.nightscout.androidaps.plugins.general.automation.actions.ActionStopTempTarget;
public class ChooseActionDialog extends DialogFragment { public class ChooseActionDialog extends DialogFragment {
@ -36,17 +26,6 @@ public class ChooseActionDialog extends DialogFragment {
private static OnClickListener mClickListener = null; private static OnClickListener mClickListener = null;
private static final List<Action> actionDummyObjects = new ArrayList<Action>() {{
add(new ActionLoopDisable());
add(new ActionLoopEnable());
add(new ActionLoopResume());
add(new ActionLoopSuspend());
add(new ActionStartTempTarget());
add(new ActionStopTempTarget());
add(new ActionNotification());
add(new ActionProfileSwitchPercent());
}};
private Unbinder mUnbinder; private Unbinder mUnbinder;
@BindView(R.id.radioGroup) @BindView(R.id.radioGroup)
@ -66,7 +45,7 @@ public class ChooseActionDialog extends DialogFragment {
View view = inflater.inflate(R.layout.automation_dialog_choose_action, container, false); View view = inflater.inflate(R.layout.automation_dialog_choose_action, container, false);
mUnbinder = ButterKnife.bind(this, view); mUnbinder = ButterKnife.bind(this, view);
for (Action a : actionDummyObjects) { for (Action a : AutomationPlugin.actionDummyObjects) {
RadioButton radioButton = new RadioButton(getContext()); RadioButton radioButton = new RadioButton(getContext());
radioButton.setText(a.friendlyName()); radioButton.setText(a.friendlyName());
radioButton.setTag(a); radioButton.setTag(a);