superbolus must be explicitly enabled

This commit is contained in:
Milos Kozak 2017-04-22 11:08:57 +02:00
parent 3b34e55fda
commit 1f2967e866
6 changed files with 30 additions and 7 deletions

View file

@ -69,6 +69,7 @@ import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.PlusMinusEditText; import info.nightscout.utils.PlusMinusEditText;
import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils; import info.nightscout.utils.ToastUtils;
@ -246,6 +247,8 @@ public class WizardDialog extends DialogFragment {
carbsInput.addTextChangedListener(textWatcher); carbsInput.addTextChangedListener(textWatcher);
bgInput.addTextChangedListener(textWatcher); bgInput.addTextChangedListener(textWatcher);
superbolusCheckbox.setVisibility(SP.getBoolean(R.string.key_usesuperbolus, false) ? View.VISIBLE : View.GONE);
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit); Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
Double maxCorrection = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit); Double maxCorrection = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
@ -368,8 +371,8 @@ public class WizardDialog extends DialogFragment {
ArrayList<CharSequence> profileList; ArrayList<CharSequence> profileList;
profileList = profile.getProfileList(); profileList = profile.getProfileList();
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(), ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(),
android.R.layout.simple_spinner_item, profileList); R.layout.spinner_centered, profileList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
profileSpinner.setAdapter(adapter); profileSpinner.setAdapter(adapter);
// set selected to actual profile // set selected to actual profile
for (int p = 0; p < profileList.size(); p++) { for (int p = 0; p < profileList.size(); p++) {

View file

@ -261,7 +261,6 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:width="120dp"
android:padding="10dp" android:padding="10dp"
android:text="@string/careportal_newnstreatment_profile_label" android:text="@string/careportal_newnstreatment_profile_label"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
@ -270,7 +269,7 @@
android:id="@+id/treatments_wizard_profile" android:id="@+id/treatments_wizard_profile"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="0.5" /> android:layout_weight="0.5" />
@ -537,7 +536,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:width="80dp" android:width="80dp"
android:text="@string/treatments_wizard_sb_label" android:text="@string/superbolus"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView <TextView

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:textColor="#FFFFFF"></TextView>

View file

@ -540,5 +540,7 @@
<string name="loopsuperbolusfor">Superbolus (%d m)</string> <string name="loopsuperbolusfor">Superbolus (%d m)</string>
<string name="treatments_wizard_bgtrend_label">15min trend</string> <string name="treatments_wizard_bgtrend_label">15min trend</string>
<string name="treatments_wizard_cob_label">COB</string> <string name="treatments_wizard_cob_label">COB</string>
<string name="treatments_wizard_sb_label">Superbolus</string> <string name="superbolus">Superbolus</string>
<string name="enablesuperbolus">Povolit superbolus</string>
<string name="enablesuperbolus_summary">Povolení superbolusu v kalkulátoru. Nepovolujte, dokud se nenaučíte, co to opravdu dělá. MŮŽE ZPŮSOBIT PŘEDÁVKOVÁNÍ INZULÍNEM PŘI NESPRÁVNÉM POUŽITÍ!</string>
</resources> </resources>

View file

@ -580,7 +580,7 @@
<string name="smscommunicator_loopresumed">Loop resumed</string> <string name="smscommunicator_loopresumed">Loop resumed</string>
<string name="treatments_wizard_bgtrend_label">15min trend</string> <string name="treatments_wizard_bgtrend_label">15min trend</string>
<string name="treatments_wizard_cob_label">COB</string> <string name="treatments_wizard_cob_label">COB</string>
<string name="treatments_wizard_sb_label">Superbolus</string> <string name="superbolus">Superbolus</string>
<string name="ns_logappstartedevent">Log app start to NS</string> <string name="ns_logappstartedevent">Log app start to NS</string>
<string name="key_ns_logappstartedevent" translatable="false">ns_logappstartedevent</string> <string name="key_ns_logappstartedevent" translatable="false">ns_logappstartedevent</string>
<string name="restartingapp">Exiting application to apply settings.</string> <string name="restartingapp">Exiting application to apply settings.</string>
@ -589,4 +589,7 @@
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string> <string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
<string name="insulin_shortname">INS</string> <string name="insulin_shortname">INS</string>
<string name="fastactinginsulinprolonged">Fast Acting Insuin Prolonged</string> <string name="fastactinginsulinprolonged">Fast Acting Insuin Prolonged</string>
<string name="key_usesuperbolus" translatable="false">key_usersuperbolus</string>
<string name="enablesuperbolus">Enable superbolus in wizard</string>
<string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string>
</resources> </resources>

View file

@ -18,6 +18,14 @@
android:key="ns_sync_use_absolute" android:key="ns_sync_use_absolute"
android:title="@string/ns_sync_use_absolute_title" /> android:title="@string/ns_sync_use_absolute_title" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:title="@string/superbolus">
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_usesuperbolus"
android:title="@string/enablesuperbolus"
android:summary="@string/enablesuperbolus_summary"/>
</PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/openapsma"> android:title="@string/openapsma">
<SwitchPreference <SwitchPreference