Added insulin descriptions to SW screen

This commit is contained in:
Roumen Georgiev 2018-05-10 13:48:18 +03:00
parent 06180e3bbd
commit 33a6135e75
3 changed files with 18 additions and 1 deletions

View file

@ -119,6 +119,12 @@ public class SWDefinition {
.add(new SWPlugin() .add(new SWPlugin()
.option(PluginType.INSULIN) .option(PluginType.INSULIN)
.label(R.string.configbuilder_insulin)) .label(R.string.configbuilder_insulin))
.add(new SWInfotext()
.label(MainApp.gs(R.string.fastactinginsulincomment)+" = "+MainApp.gs(R.string.rapid_acting_oref)))
.add(new SWInfotext()
.label(MainApp.gs(R.string.ultrafastactinginsulincomment)+" = "+MainApp.gs(R.string.ultrarapid_oref)))
.add(new SWInfotext()
.label(MainApp.gs(R.string.free_peak_oref_description)+" = "+MainApp.gs(R.string.free_peak_oref)))
.validator(() -> MainApp.getConfigBuilder().getActiveInsulin() != null) .validator(() -> MainApp.getConfigBuilder().getActiveInsulin() != null)
) )
.add(new SWScreen(R.string.configbuilder_bgsource) .add(new SWScreen(R.string.configbuilder_bgsource)

View file

@ -15,18 +15,27 @@ import org.slf4j.LoggerFactory;
public class SWInfotext extends SWItem { public class SWInfotext extends SWItem {
private static Logger log = LoggerFactory.getLogger(SWInfotext.class); private static Logger log = LoggerFactory.getLogger(SWInfotext.class);
private String textLabel = null;
public SWInfotext() { public SWInfotext() {
super(Type.TEXT); super(Type.TEXT);
} }
public SWInfotext label(String newLabel){
this.textLabel = newLabel;
return this;
}
@Override @Override
public void generateDialog(View view, LinearLayout layout) { public void generateDialog(View view, LinearLayout layout) {
Context context = view.getContext(); Context context = view.getContext();
TextView l = new TextView(context); TextView l = new TextView(context);
l.setId(view.generateViewId()); l.setId(view.generateViewId());
l.setText(label); if(textLabel != null)
l.setText(textLabel);
else
l.setText(label);
layout.addView(l); layout.addView(l);
} }

View file

@ -668,6 +668,8 @@
<string name="free_peak_oref">Free-Peak Oref</string> <string name="free_peak_oref">Free-Peak Oref</string>
<string name="rapid_acting_oref">Rapid-Acting Oref</string> <string name="rapid_acting_oref">Rapid-Acting Oref</string>
<string name="ultrarapid_oref">Ultra-Rapid Oref</string> <string name="ultrarapid_oref">Ultra-Rapid Oref</string>
<string name="free_peak_oref_description">Custom insulin</string>
<string name="rapid_acting_oref_description">Rapid-Acting Oref</string>
<string name="dia_too_short" formatted="false">DIA of %f too short - using %f instead!</string> <string name="dia_too_short" formatted="false">DIA of %f too short - using %f instead!</string>
<string name="activate_profile">Activate profile</string> <string name="activate_profile">Activate profile</string>
<string name="date">Date</string> <string name="date">Date</string>