do set bg on init in careportal dialog

This commit is contained in:
Milos Kozak 2016-09-18 03:09:53 +02:00
parent 4378c9af14
commit a3721f8932
3 changed files with 13 additions and 12 deletions

View file

@ -3,8 +3,9 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -223,19 +223,19 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
bgUnitsView.setText(units);
// Set BG if not old
BgReading lastBg = MainApp.getDbHelper().lastBg();
Double lastBgValue = 0d;
if (lastBg != null) {
lastBgValue = lastBg.valueToUnits(units);
sensorRadioButton.setChecked(true);
} else {
meterRadioButton.setChecked(true);
}
// BgReading lastBg = MainApp.getDbHelper().lastBg();
// Double lastBgValue = 0d;
// if (lastBg != null) {
// lastBgValue = lastBg.valueToUnits(units);
// sensorRadioButton.setChecked(true);
// } else {
// meterRadioButton.setChecked(true);
// }
if (units.equals(Constants.MMOL))
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, lastBgValue, 0d, 40d, 0.1d, new DecimalFormat("0.0"), false);
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, 0d, 0d, 40d, 0.1d, new DecimalFormat("0.0"), false);
else
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, lastBgValue, 0d, 500d, 1d, new DecimalFormat("0"), false);
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, 0d, 0d, 500d, 1d, new DecimalFormat("0"), false);
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
editCarbs = new PlusMinusEditText(view, R.id.careportal_newnstreatment_carbsinput, R.id.careportal_newnstreatment_carbs_plus, R.id.careportal_newnstreatment_carbs_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);