extended bolus dialog refactor
This commit is contained in:
parent
547f09ffbd
commit
1823cd3f24
|
@ -30,14 +30,15 @@ import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
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 NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener {
|
public class NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener {
|
||||||
private static Logger log = LoggerFactory.getLogger(NewExtendedBolusDialog.class);
|
private static Logger log = LoggerFactory.getLogger(NewExtendedBolusDialog.class);
|
||||||
|
|
||||||
PlusMinusEditText editInsulin;
|
NumberPicker editInsulin;
|
||||||
PlusMinusEditText editDuration;
|
NumberPicker editDuration;
|
||||||
|
|
||||||
Handler mHandler;
|
Handler mHandler;
|
||||||
public static HandlerThread mHandlerThread;
|
public static HandlerThread mHandlerThread;
|
||||||
|
@ -56,11 +57,13 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
||||||
View view = inflater.inflate(R.layout.overview_newextendedbolus_dialog, container, false);
|
View view = inflater.inflate(R.layout.overview_newextendedbolus_dialog, container, false);
|
||||||
|
|
||||||
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
||||||
editInsulin = new PlusMinusEditText(view, R.id.overview_newextendedbolus_insulin, R.id.overview_newextendedbolus_insulin_plus, R.id.overview_newextendedbolus_insulin_minus, 0d, 0d, maxInsulin, 0.1d, new DecimalFormat("0.00"), false);
|
editInsulin = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_insulin);
|
||||||
|
editInsulin.setParams(0d, 0d, maxInsulin, 0.1d, new DecimalFormat("0.00"), false);
|
||||||
|
|
||||||
double extendedDurationStep = MainApp.getConfigBuilder().getPumpDescription().extendedBolusDurationStep;
|
double extendedDurationStep = MainApp.getConfigBuilder().getPumpDescription().extendedBolusDurationStep;
|
||||||
double extendedMaxDuration = MainApp.getConfigBuilder().getPumpDescription().extendedBolusMaxDuration;
|
double extendedMaxDuration = MainApp.getConfigBuilder().getPumpDescription().extendedBolusMaxDuration;
|
||||||
editDuration = new PlusMinusEditText(view, R.id.overview_newextendedbolus_duration, R.id.overview_newextendedbolus_duration_plus, R.id.overview_newextendedbolus_duration_minus, extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false);
|
editDuration = (NumberPicker) view.findViewById(R.id.overview_newextendedbolus_duration);
|
||||||
|
editDuration.setParams(extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false);
|
||||||
|
|
||||||
view.findViewById(R.id.ok).setOnClickListener(this);
|
view.findViewById(R.id.ok).setOnClickListener(this);
|
||||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||||
|
|
|
@ -1,145 +1,80 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog">
|
android:minWidth="300dp"
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dp">
|
android:padding="10dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/careportal_newnstreatment_insulin_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<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:width="120dp"
|
||||||
|
android:padding="10dp"
|
||||||
android:text="@string/treatments_newtreatment_insulinamount_label"
|
android:text="@string/treatments_newtreatment_insulinamount_label"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<LinearLayout
|
<info.nightscout.utils.NumberPicker
|
||||||
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/overview_newextendedbolus_insulin_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/overview_newextendedbolus_insulin"
|
android:id="@+id/overview_newextendedbolus_insulin"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="130dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp" />
|
||||||
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/overview_newextendedbolus_insulin_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
|
<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_vertical"
|
||||||
android:layout_marginTop="5dp"
|
android:gravity="left"
|
||||||
|
android:minWidth="45dp"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:text="U"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/careportal_newnstreatment_duration_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:width="120dp"
|
||||||
|
android:padding="10dp"
|
||||||
android:text="@string/careportal_newnstreatment_duration_label"
|
android:text="@string/careportal_newnstreatment_duration_label"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<LinearLayout
|
<info.nightscout.utils.NumberPicker
|
||||||
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/overview_newextendedbolus_duration_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/overview_newextendedbolus_duration"
|
android:id="@+id/overview_newextendedbolus_duration"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="130dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp" />
|
||||||
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
|
<TextView
|
||||||
android:id="@+id/overview_newextendedbolus_duration_plus"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center_vertical"
|
||||||
android:background="@drawable/circle"
|
android:gravity="left"
|
||||||
android:backgroundTint="#ffffff"
|
android:minWidth="45dp"
|
||||||
android:src="@drawable/ic_action_add"
|
android:paddingLeft="5dp"
|
||||||
android:tint="#ffffff" />
|
android:text="min"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/mdtp_done_button" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
Loading…
Reference in a new issue