diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java index 823cc8121d..c3f7a50984 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java @@ -20,6 +20,7 @@ import android.widget.CompoundButton; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RadioButton; +import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TextView; @@ -70,20 +71,21 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick NSProfile profile; String units; - LinearLayout layoutBg; + RelativeLayout layoutBg; LinearLayout layoutBgSource; - LinearLayout layoutInsulin; - LinearLayout layoutCarbs; - LinearLayout layoutSplit; - LinearLayout layoutDuration; - LinearLayout layoutPercent; - LinearLayout layoutAbsolute; - LinearLayout layoutCarbTime; - LinearLayout layoutProfile; + RelativeLayout layoutInsulin; + RelativeLayout layoutCarbs; + RelativeLayout layoutSplit; + RelativeLayout layoutDuration; + RelativeLayout layoutPercent; + RelativeLayout layoutAbsolute; + RelativeLayout layoutCarbTime; + RelativeLayout layoutProfile; LinearLayout layoutTempTarget; Button dateButton; Button timeButton; Button okButton; + Button cancelButton; TextView bgUnitsView; RadioButton meterRadioButton; @@ -141,18 +143,19 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().setTitle(getString(options.eventName)); + setStyle(DialogFragment.STYLE_NORMAL, getTheme()); View view = inflater.inflate(R.layout.careportal_newnstreatment_dialog, container, false); - layoutBg = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_bg_layout); + layoutBg = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_bg_layout); layoutBgSource = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_bgsource_layout); - layoutInsulin = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_insulin_layout); - layoutCarbs = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_carbs_layout); - layoutSplit = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_split_layout); - layoutDuration = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_duration_layout); - layoutPercent = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_percent_layout); - layoutAbsolute = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_absolute_layout); - layoutCarbTime = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_carbtime_layout); - layoutProfile = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_profile_layout); + layoutInsulin = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_insulin_layout); + layoutCarbs = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_carbs_layout); + layoutSplit = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_split_layout); + layoutDuration = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_duration_layout); + layoutPercent = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_percent_layout); + layoutAbsolute = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_absolute_layout); + layoutCarbTime = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_carbtime_layout); + layoutProfile = (RelativeLayout) view.findViewById(R.id.careportal_newnstreatment_profile_layout); layoutTempTarget = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_temptarget_layout); bgUnitsView = (TextView) view.findViewById(R.id.careportal_newnstreatment_bgunits); @@ -217,8 +220,10 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick dateButton.setOnClickListener(this); timeButton.setOnClickListener(this); - okButton = (Button) view.findViewById(R.id.careportal_newnstreatment_ok); + okButton = (Button) view.findViewById(R.id.ok); okButton.setOnClickListener(this); + cancelButton = (Button) view.findViewById(R.id.cancel); + cancelButton.setOnClickListener(this); // profile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile(); @@ -358,14 +363,17 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick tpd.dismissOnPause(true); tpd.show(context.getFragmentManager(), "Timepickerdialog"); break; - case R.id.careportal_newnstreatment_ok: + case R.id.ok: createNSTreatment(); dismiss(); break; + case R.id.cancel: + dismiss(); + break; } } - private void showOrHide(LinearLayout layout, boolean visible) { + private void showOrHide(ViewGroup layout, boolean visible) { if (visible) layout.setVisibility(View.VISIBLE); else layout.setVisibility(View.GONE); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java index e97104437d..8144d39ff5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java @@ -31,7 +31,8 @@ import info.nightscout.utils.SafeParse; public class NewTreatmentDialog extends DialogFragment implements OnClickListener { - Button deliverButton; + Button okButton; + Button cancelButton; TextView insulin; TextView carbs; @@ -52,9 +53,11 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene Bundle savedInstanceState) { View view = inflater.inflate(R.layout.overview_newtreatment_dialog, null, false); - deliverButton = (Button) view.findViewById(R.id.treatments_newtreatment_deliverbutton); + okButton = (Button) view.findViewById(R.id.ok); + okButton.setOnClickListener(this); + cancelButton = (Button) view.findViewById(R.id.cancel); + cancelButton.setOnClickListener(this); - deliverButton.setOnClickListener(this); getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); insulin = (TextView) view.findViewById(R.id.treatments_newtreatment_insulinamount); @@ -79,7 +82,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene @Override public void onClick(View view) { switch (view.getId()) { - case R.id.treatments_newtreatment_deliverbutton: + case R.id.ok: try { Double insulin = SafeParse.stringToDouble(this.insulin.getText().toString()); @@ -131,6 +134,9 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene e.printStackTrace(); } break; + case R.id.cancel: + dismiss(); + break; } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java index 0e8e156edd..5bb0206e07 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java @@ -64,6 +64,8 @@ public class DanaRFragment extends Fragment { TextView reservoirView; TextView iobView; TextView firmwareView; + TextView basalStepView; + TextView bolusStepView; Button viewProfileButton; Button historyButton; Button statsButton; @@ -110,6 +112,8 @@ public class DanaRFragment extends Fragment { viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile); historyButton = (Button) view.findViewById(R.id.danar_history); statsButton = (Button) view.findViewById(R.id.danar_stats); + basalStepView = (TextView) view.findViewById(R.id.danar_basalstep); + bolusStepView = (TextView) view.findViewById(R.id.danar_bolusstep); viewProfileButton.setOnClickListener(new View.OnClickListener() { @@ -245,6 +249,9 @@ public class DanaRFragment extends Fragment { } else { firmwareView.setText("OLD"); } + basalStepView.setText("" + pump.basalStep); + bolusStepView.setText("" + pump.bolusStep); + } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java index 4a76c8649f..f469277fb7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java @@ -62,6 +62,8 @@ public class DanaRKoreanFragment extends Fragment { TextView reservoirView; TextView iobView; TextView firmwareView; + TextView basalStepView; + TextView bolusStepView; Button viewProfileButton; Button historyButton; Button statsButton; @@ -108,6 +110,8 @@ public class DanaRKoreanFragment extends Fragment { viewProfileButton = (Button) view.findViewById(R.id.danar_viewprofile); historyButton = (Button) view.findViewById(R.id.danar_history); statsButton = (Button) view.findViewById(R.id.danar_stats); + basalStepView = (TextView) view.findViewById(R.id.danar_basalstep); + bolusStepView = (TextView) view.findViewById(R.id.danar_bolusstep); viewProfileButton.setOnClickListener(new View.OnClickListener() { @@ -244,6 +248,8 @@ public class DanaRKoreanFragment extends Fragment { } else { firmwareView.setText("OLD"); } + basalStepView.setText("" + pump.basalStep); + bolusStepView.setText("" + pump.bolusStep); } }); diff --git a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml index 70a4a09eb3..59c43c3cad 100644 --- a/app/src/main/res/layout/careportal_newnstreatment_dialog.xml +++ b/app/src/main/res/layout/careportal_newnstreatment_dialog.xml @@ -1,5 +1,6 @@ - + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + android:layout_centerInParent="true" + android:orientation="horizontal"> - + - + + + + + - + + android:layout_gravity="center_horizontal" + android:orientation="vertical"> + android:checked="true" + android:text="@string/careportal_newnstreatment_sensor" /> + + + - + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + + android:orientation="horizontal"> - + - + - + + + - + - + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - - - - + android:orientation="horizontal"> - + + + + + + + + - + - + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + android:layout_centerInParent="true" + android:orientation="horizontal"> + + - + - + + + - - + + + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + android:layout_centerInParent="true" + android:orientation="horizontal"> + + - + - + + + - + - + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + android:layout_centerInParent="true" + android:orientation="horizontal"> + + - + - + + + - - + + + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + android:layout_centerInParent="true" + android:orientation="horizontal"> + + - + - + + + - - + + + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + android:layout_centerInParent="true" + android:orientation="horizontal"> + + - + - + + + - + - + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> + + android:layout_height="wrap_content" + android:layout_centerInParent="true" /> + - + + android:orientation="vertical"> - + + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" /> - + - + + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - + android:layout_centerHorizontal="true" + android:orientation="horizontal"> - + + + - + + + - + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> - - + + + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:textAppearance="@android:style/TextAppearance.Material.Small" + android:textStyle="bold" /> -