Some extension on VirtualPump for testing.
This commit is contained in:
parent
48e4a041f8
commit
e2ddb48498
3 changed files with 44 additions and 11 deletions
app/src/main/java/info/nightscout/androidaps/plugins
|
@ -254,15 +254,15 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
LinearLayout ll = (LinearLayout)actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
LinearLayout ll = (LinearLayout)actionsFragmentView.findViewById(R.id.action_buttons_layout);
|
||||||
|
|
||||||
for (CustomAction customAction : customActions) {
|
for (CustomAction customAction : customActions) {
|
||||||
// TODO
|
|
||||||
|
|
||||||
|
|
||||||
SingleClickButton btn = new SingleClickButton(MainApp.instance().getApplicationContext());
|
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);
|
//btn.setTextAppearance(R.style.buttonStyle);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f);
|
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0.5f);
|
||||||
layoutParams.setMargins(10, 3, 10, 3);
|
layoutParams.setMargins(10, 3, 10, 3);
|
||||||
|
@ -273,11 +273,10 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
|
|
||||||
ll.addView(btn);
|
ll.addView(btn);
|
||||||
|
|
||||||
this.currentCustomActions.put(customAction.getName(), customAction);
|
this.currentCustomActions.put(MainApp.gs(customAction.getName()), customAction);
|
||||||
this.customButtons.add(btn);
|
this.customButtons.add(btn);
|
||||||
|
|
||||||
|
|
||||||
// TODO add to map
|
|
||||||
|
|
||||||
|
|
||||||
// <info.nightscout.utils.SingleClickButton
|
// <info.nightscout.utils.SingleClickButton
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package info.nightscout.androidaps.plugins.Actions.defs;
|
package info.nightscout.androidaps.plugins.Actions.defs;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 9/20/18.
|
* Created by andy on 9/20/18.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CustomAction {
|
public class CustomAction {
|
||||||
|
|
||||||
private String name;
|
private int name;
|
||||||
private String iconName;
|
private String iconName;
|
||||||
private CustomActionType customActionType;
|
private CustomActionType customActionType;
|
||||||
|
|
||||||
|
|
||||||
public String getName() {
|
public CustomAction(int nameResourceId, CustomActionType actionType)
|
||||||
|
{
|
||||||
return name;
|
this.name = nameResourceId;
|
||||||
|
this.customActionType = actionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
|
|
||||||
this.name = name;
|
public int getName() {
|
||||||
|
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIconName() {
|
public String getIconName() {
|
||||||
|
|
|
@ -19,6 +19,8 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.db.ExtendedBolus;
|
import info.nightscout.androidaps.db.ExtendedBolus;
|
||||||
import info.nightscout.androidaps.db.TemporaryBasal;
|
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.Common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.defs.PumpType;
|
import info.nightscout.androidaps.plugins.PumpCommon.defs.PumpType;
|
||||||
import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue