adding pump selection
This commit is contained in:
parent
7832411d9c
commit
e357c7fd1b
|
@ -14,9 +14,12 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
|||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||
import info.nightscout.androidaps.startupwizard.events.EventSWUpdate;
|
||||
import info.nightscout.utils.LocaleHelper;
|
||||
import info.nightscout.utils.SP;
|
||||
//Needed for pump validation
|
||||
|
||||
public class SWDefinition {
|
||||
private static Logger log = LoggerFactory.getLogger(SWDefinition.class);
|
||||
|
@ -77,6 +80,39 @@ public class SWDefinition {
|
|||
.visibility(() -> !NSClientPlugin.getPlugin().isEnabled(PluginType.GENERAL)))
|
||||
.validator(() -> NSClientPlugin.getPlugin().nsClientService != null && NSClientPlugin.getPlugin().nsClientService.isConnected && NSClientPlugin.getPlugin().nsClientService.hasWriteAuth)
|
||||
)
|
||||
.add(new SWScreen(R.string.configbuilder_pump)
|
||||
.skippable(true)
|
||||
|
||||
.add(new SWPlugin()
|
||||
.option(PluginType.PUMP)
|
||||
.label(R.string.configbuilder_pump)
|
||||
.comment(R.string.configbuilder_pump))
|
||||
.validator(() -> MainApp.getSpecificPluginsList(PluginType.PUMP) != null)
|
||||
)
|
||||
.add(new SWScreen(R.string.setupwizard_pump_test)
|
||||
.skippable(true)
|
||||
// Adding DanaR specific fields
|
||||
.add(DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP)?new SWString()
|
||||
.preferenceId(R.string.key_danar_bt_name)
|
||||
.label(R.string.danar_bt_name_title)
|
||||
.comment(R.string.danar_bt_name_title) : new SWItem(SWItem.Type.STRING)
|
||||
)
|
||||
.add(DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP)?new SWString()
|
||||
.preferenceId(R.string.key_danar_password)
|
||||
.label(R.string.danar_password_title)
|
||||
.comment(R.string.danar_password_title): new SWItem(SWItem.Type.STRING)
|
||||
)
|
||||
// Virtual pump
|
||||
.add(VirtualPumpPlugin.getPlugin().isEnabled(PluginType.PUMP)?
|
||||
new SWRadioButton()
|
||||
.option(R.array.trueFalseArray, R.array.trueFalseValues)
|
||||
.preferenceId(R.string.key_virtualpump_uploadstatus)
|
||||
.label(R.string.virtualpump_uploadstatus_title)
|
||||
.comment(R.string.virtualpump_uploadstatus_title): new SWItem(SWItem.Type.STRING)
|
||||
)
|
||||
.validator(() -> MainApp.getSpecificPluginsList(PluginType.PUMP) != null)
|
||||
)
|
||||
|
||||
.add(new SWScreen(R.string.patientage)
|
||||
.skippable(false)
|
||||
.add(new SWRadioButton()
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class SWRadioButton extends SWItem {
|
||||
|
@ -41,7 +42,13 @@ public class SWRadioButton extends SWItem {
|
|||
public void generateDialog(View view, LinearLayout layout) {
|
||||
Context context = view.getContext();
|
||||
// Get if there is already value in SP
|
||||
String previousValue = SP.getString(preferenceId, "none");
|
||||
String previousValue = "none";
|
||||
if(preferenceId == R.string.key_virtualpump_uploadstatus) {
|
||||
Boolean booleanValue = SP.getBoolean(preferenceId, false);
|
||||
previousValue = booleanValue.toString();
|
||||
} else {
|
||||
previousValue = SP.getString(preferenceId, "none");
|
||||
}
|
||||
radioGroup = new RadioGroup(context);
|
||||
radioGroup.clearCheck();
|
||||
radioGroup.setOrientation(LinearLayout.VERTICAL);
|
||||
|
|
|
@ -105,4 +105,15 @@
|
|||
<item>@string/no</item>
|
||||
<item>@string/yes</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="trueFalseArray">
|
||||
<item>@string/yes</item>
|
||||
<item>@string/no</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="trueFalseValues">
|
||||
<item>true</item>
|
||||
<item>false</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
|
@ -523,6 +523,7 @@
|
|||
<string name="key_resistantadult" translatable="false">resistantadult</string>
|
||||
<string name="patientage_summary">Please select patient age to setup safety limits</string>
|
||||
<string name="key_i_understand" translatable="false">I_understand</string>
|
||||
<string name="key_virtualpump_uploadstatus" translatable="false">virtualpump_uploadstatus</string>
|
||||
<string name="Glimp">Glimp</string>
|
||||
<string name="batteryoptimalizationerror">Device does not appear to support battery optimization whitelisting!</string>
|
||||
<string name="pleaseallowpermission">Please Allow Permission</string>
|
||||
|
@ -1018,6 +1019,7 @@
|
|||
<string name="setupwizard_skip">Skip</string>
|
||||
<string name="setupwizard_finish">FINISH</string>
|
||||
<string name="setupwizard_language_prompt">Select your language</string>
|
||||
<string name="setupwizard_pump_test">Test pump connection</string>
|
||||
<string name="key_language" translatable="false">language</string>
|
||||
<string name="key_openapsama_min_5m_carbimpact" translatable="false">openapsama_min_5m_carbimpact</string>
|
||||
<string name="boluserrorcode">Asked: %.2fU Delivered: %.2fU Error code: %d</string>
|
||||
|
|
Loading…
Reference in a new issue