Some extension on VirtualPump for testing.

This commit is contained in:
Andy Rozman 2018-09-20 18:04:06 +01:00
parent 48e4a041f8
commit e2ddb48498
3 changed files with 44 additions and 11 deletions

View file

@ -254,15 +254,15 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
LinearLayout ll = (LinearLayout)actionsFragmentView.findViewById(R.id.action_buttons_layout);
for (CustomAction customAction : customActions) {
// TODO
SingleClickButton btn = new SingleClickButton(MainApp.instance().getApplicationContext());
btn.setText(customAction.getName());
btn.setText(MainApp.gs(customAction.getName()));
// TODO style and drawableTop
//btn.setTextAppearance(R.style.buttonStyle);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f);
layoutParams.setMargins(10, 3, 10, 3);
@ -273,11 +273,10 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
ll.addView(btn);
this.currentCustomActions.put(customAction.getName(), customAction);
this.currentCustomActions.put(MainApp.gs(customAction.getName()), customAction);
this.customButtons.add(btn);
// TODO add to map
// <info.nightscout.utils.SingleClickButton

View file

@ -1,24 +1,28 @@
package info.nightscout.androidaps.plugins.Actions.defs;
import info.nightscout.androidaps.R;
/**
* Created by andy on 9/20/18.
*/
public class CustomAction {
private String name;
private int name;
private String iconName;
private CustomActionType customActionType;
public String getName() {
return name;
public CustomAction(int nameResourceId, CustomActionType actionType)
{
this.name = nameResourceId;
this.customActionType = actionType;
}
public void setName(String name) {
this.name = name;
public int getName() {
return name;
}
public String getIconName() {

View file

@ -19,6 +19,8 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.plugins.Actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.Actions.defs.CustomActionType;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpCommon.defs.PumpType;
import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
@ -119,4 +121,32 @@ public class VirtualPumpFragment extends SubscriberFragment {
}
});
}
enum VirtualActions implements CustomActionType
{
TestAction1(R.string.en_lang),
TestAction2(R.string.ga_lang),
;
CustomAction customAction;
VirtualActions(int nameResourceId)
{
this.customAction = new CustomAction(nameResourceId, this);
}
@Override
public String getKey() {
return this.name();
}
}
}