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 f0cf085e16..9c89fdd948 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 @@ -21,6 +21,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; @@ -71,20 +72,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; @@ -142,18 +144,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); @@ -218,8 +221,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(); @@ -233,8 +238,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick profileList = profile.getProfileList(); } ArrayAdapter adapter = new ArrayAdapter(getContext(), - android.R.layout.simple_spinner_item, profileList); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + R.layout.spinner_centered, profileList); profileSpinner.setAdapter(adapter); if (profile != null) { // set selected to actual profile @@ -250,8 +254,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick reasonList.add(MainApp.sResources.getString(R.string.activity)); reasonList.add(MainApp.sResources.getString(R.string.manual)); ArrayAdapter adapterReason = new ArrayAdapter(getContext(), - android.R.layout.simple_spinner_item, reasonList); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + R.layout.spinner_centered, reasonList); reasonSpinner.setAdapter(adapterReason); // bg @@ -361,14 +364,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/IobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java index b28927d3ba..85a5c886bd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java @@ -412,7 +412,7 @@ public class IobCobCalculatorPlugin implements PluginBase { //log.debug("Locking detectSensitivity"); synchronized (dataLock) { if (autosensDataTable == null || autosensDataTable.size() < 4) { - log.debug("No bucketed data available"); + log.debug("No autosens data available"); return new AutosensResult(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/EditQuickWizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/EditQuickWizardDialog.java index a86740cdfd..352c158c1e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/EditQuickWizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/EditQuickWizardDialog.java @@ -71,8 +71,7 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic timeList.add(DateUtil.timeString(DateUtil.toDate(24 * 60 * 60 - 60))); ArrayAdapter adapter = new ArrayAdapter(getContext(), - android.R.layout.simple_spinner_item, timeList); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + R.layout.spinner_centered, timeList); fromSpinner.setAdapter(adapter); toSpinner.setAdapter(adapter); 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/History/DanaRHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/History/DanaRHistoryActivity.java index bc925c27bd..f4ad770ac1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/History/DanaRHistoryActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/History/DanaRHistoryActivity.java @@ -169,8 +169,7 @@ public class DanaRHistoryActivity extends Activity { typeList.add(new TypeList(RecordTypes.RECORD_TYPE_REFILL, getString(R.string.danar_history_refill))); typeList.add(new TypeList(RecordTypes.RECORD_TYPE_SUSPEND, getString(R.string.danar_history_syspend))); ArrayAdapter spinnerAdapter = new ArrayAdapter<>(this, - android.R.layout.simple_spinner_item, typeList); - spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + R.layout.spinner_centered, typeList); historyTypeSpinner.setAdapter(spinnerAdapter); reloadButton.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/History/DanaRHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/History/DanaRHistoryActivity.java index adbbf09e75..8b2811e382 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/History/DanaRHistoryActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/History/DanaRHistoryActivity.java @@ -168,8 +168,7 @@ public class DanaRHistoryActivity extends Activity { typeList.add(new TypeList(RecordTypes.RECORD_TYPE_GLUCOSE, getString(R.string.danar_history_glucose))); ArrayAdapter spinnerAdapter = new ArrayAdapter<>(this, - android.R.layout.simple_spinner_item, typeList); - spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + R.layout.spinner_centered, typeList); historyTypeSpinner.setAdapter(spinnerAdapter); reloadButton.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/java/info/nightscout/utils/TimeListEdit.java b/app/src/main/java/info/nightscout/utils/TimeListEdit.java index 1c4f5d4edd..ce1f604060 100644 --- a/app/src/main/java/info/nightscout/utils/TimeListEdit.java +++ b/app/src/main/java/info/nightscout/utils/TimeListEdit.java @@ -229,8 +229,7 @@ public class TimeListEdit { } ArrayAdapter adapter = new ArrayAdapter(context, - android.R.layout.simple_spinner_item, timeList); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + R.layout.spinner_centered, timeList); spinner.setAdapter(adapter); spinner.setSelection(posInList, false); } 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" /> -