bolus dialog numberpickers
This commit is contained in:
parent
ef4a1feda2
commit
4fc935f0bd
|
@ -62,10 +62,10 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
|
||||||
|
|
||||||
bgNumber = (NumberPicker) view.findViewById(R.id.overview_calibration_bg);
|
bgNumber = (NumberPicker) view.findViewById(R.id.overview_calibration_bg);
|
||||||
|
|
||||||
if (units.equals(Constants.MMOL))
|
if (units.equals(Constants.MMOL))
|
||||||
bgNumber.setParams(bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
|
bgNumber.setParams(bg, 0d, 30d, 0.1d, new DecimalFormat("0.0"), false);
|
||||||
else
|
else
|
||||||
bgNumber.setParams(bg, 0d, 500d, 1d, new DecimalFormat("0"), false);
|
bgNumber.setParams(bg, 0d, 500d, 1d, new DecimalFormat("0"), false);
|
||||||
|
|
||||||
unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
|
unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
|
||||||
unitsView.setText(units);
|
unitsView.setText(units);
|
||||||
|
@ -77,7 +77,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.ok:
|
case R.id.ok:
|
||||||
final Double bg = SafeParse.stringToDouble(bgNumber.getText().toString());
|
final Double bg = SafeParse.stringToDouble(bgNumber.getText());
|
||||||
XdripCalibrations.confirmAndSendCalibration(bg, context);
|
XdripCalibrations.confirmAndSendCalibration(bg, context);
|
||||||
dismiss();
|
dismiss();
|
||||||
Answers.getInstance().logCustom(new CustomEvent("Calibration"));
|
Answers.getInstance().logCustom(new CustomEvent("Calibration"));
|
||||||
|
|
|
@ -29,13 +29,14 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.db.CareportalEvent;
|
import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
import info.nightscout.utils.NumberPicker;
|
||||||
import info.nightscout.utils.PlusMinusEditText;
|
import info.nightscout.utils.PlusMinusEditText;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
|
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
|
||||||
|
|
||||||
PlusMinusEditText editCarbs;
|
NumberPicker editCarbs;
|
||||||
PlusMinusEditText editInsulin;
|
NumberPicker editInsulin;
|
||||||
|
|
||||||
Handler mHandler;
|
Handler mHandler;
|
||||||
public static HandlerThread mHandlerThread;
|
public static HandlerThread mHandlerThread;
|
||||||
|
@ -60,19 +61,15 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||||
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
||||||
|
|
||||||
editCarbs = new PlusMinusEditText(view, R.id.treatments_newtreatment_carbsamount, R.id.treatments_newtreatment_carbsamount_plus, R.id.treatments_newtreatment_carbsamount_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
|
editCarbs = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_carbsamount);
|
||||||
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, MainApp.getConfigBuilder().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false);
|
editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
||||||
|
|
||||||
|
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
|
||||||
|
editInsulin.setParams(0d, 0d, maxInsulin, MainApp.getConfigBuilder().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
if (getDialog() != null)
|
|
||||||
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
|
|
|
@ -12,135 +12,57 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dp">
|
android:padding="10dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:text="@string/bolus"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_gravity="center_horizontal"
|
||||||
android:text="@string/treatments_newtreatment_insulinamount_label"
|
android:layout_marginBottom="5dp"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
android:layout_marginTop="15dp"
|
||||||
android:textStyle="bold" />
|
android:text="@string/treatments_newtreatment_insulinamount_label"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<LinearLayout
|
<info.nightscout.utils.NumberPicker
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/treatments_newtreatment_insulinamount"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="130dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_height="40dp"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_gravity="end"
|
||||||
android:orientation="horizontal">
|
android:layout_marginLeft="30dp"
|
||||||
|
android:layout_marginRight="30dp" />
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
android:id="@+id/treatments_newtreatment_insulinamount_minus"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_gravity="center"
|
android:layout_marginBottom="5dp"
|
||||||
android:background="@drawable/circle"
|
android:layout_marginTop="15dp"
|
||||||
android:backgroundTint="#ffffff"
|
android:text="@string/treatments_newtreatment_carbsamount_label"
|
||||||
android:src="@drawable/ic_action_minus"
|
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||||
android:tint="#ffffff" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<EditText
|
<info.nightscout.utils.NumberPicker
|
||||||
android:id="@+id/treatments_newtreatment_insulinamount"
|
android:id="@+id/treatments_newtreatment_carbsamount"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="130dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:gravity="center_horizontal"
|
android:layout_marginBottom="15dp" />
|
||||||
android:inputType="numberDecimal"
|
|
||||||
android:minWidth="100dp"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text=""
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/treatments_newtreatment_insulinamount_plus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/circle"
|
|
||||||
android:backgroundTint="#ffffff"
|
|
||||||
android:src="@drawable/ic_action_add"
|
|
||||||
android:tint="#ffffff" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="2dip"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:background="@color/listdelimiter" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:text="@string/treatments_newtreatment_carbsamount_label"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/treatments_newtreatment_carbsamount_minus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/circle"
|
|
||||||
android:backgroundTint="#ffffff"
|
|
||||||
android:src="@drawable/ic_action_minus"
|
|
||||||
android:tint="#ffffff" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/treatments_newtreatment_carbsamount"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:inputType="numberDecimal"
|
|
||||||
android:minWidth="100dp"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text=""
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/treatments_newtreatment_carbsamount_plus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/circle"
|
|
||||||
android:backgroundTint="#ffffff"
|
|
||||||
android:src="@drawable/ic_action_add"
|
|
||||||
android:tint="#ffffff" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/mdtp_done_button" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
|
@ -39,8 +39,8 @@
|
||||||
<string name="tempbasals_netinsulin_label_string">Ins:</string>
|
<string name="tempbasals_netinsulin_label_string">Ins:</string>
|
||||||
<string name="tempbasals_iob_label_string">IOB:</string>
|
<string name="tempbasals_iob_label_string">IOB:</string>
|
||||||
<string name="tempbasals_iobtotal_label_string">Total IOB:</string>
|
<string name="tempbasals_iobtotal_label_string">Total IOB:</string>
|
||||||
<string name="treatments_newtreatment_insulinamount_label">Insulin amount</string>
|
<string name="treatments_newtreatment_insulinamount_label">Insulin</string>
|
||||||
<string name="treatments_newtreatment_carbsamount_label">Carbs amount</string>
|
<string name="treatments_newtreatment_carbsamount_label">Carbs</string>
|
||||||
<string name="treatments_wizard_bg_label">BG</string>
|
<string name="treatments_wizard_bg_label">BG</string>
|
||||||
<string name="treatments_wizard_carbs_label">Carbs</string>
|
<string name="treatments_wizard_carbs_label">Carbs</string>
|
||||||
<string name="treatments_wizard_correction_label">Corr</string>
|
<string name="treatments_wizard_correction_label">Corr</string>
|
||||||
|
|
Loading…
Reference in a new issue