bolus dialog redesign
This commit is contained in:
parent
4201709e2a
commit
6fff6f63a4
|
@ -31,7 +31,8 @@ import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
|
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
|
||||||
|
|
||||||
Button deliverButton;
|
Button okButton;
|
||||||
|
Button cancelButton;
|
||||||
TextView insulin;
|
TextView insulin;
|
||||||
TextView carbs;
|
TextView carbs;
|
||||||
|
|
||||||
|
@ -52,9 +53,11 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.overview_newtreatment_dialog, null, false);
|
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().requestFeature(Window.FEATURE_NO_TITLE);
|
||||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||||
insulin = (TextView) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
insulin = (TextView) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
||||||
|
@ -79,7 +82,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.treatments_newtreatment_deliverbutton:
|
case R.id.ok:
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Double insulin = SafeParse.stringToDouble(this.insulin.getText().toString());
|
Double insulin = SafeParse.stringToDouble(this.insulin.getText().toString());
|
||||||
|
@ -131,6 +134,9 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case R.id.cancel:
|
||||||
|
dismiss();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,16 +207,6 @@
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:background="@color/listdelimiter" />
|
android:background="@color/listdelimiter" />
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|
|
@ -18,121 +18,127 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dp">
|
android:padding="10dp">
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text="@string/treatments_newtreatment_insulinamount_label"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/treatments_newtreatment_insulinamount_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_insulinamount"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:inputType="numberDecimal"
|
|
||||||
android:minWidth="200dp"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text=""
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:gravity="center_horizontal" />
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text="@string/treatments_newtreatment_carbsamount_label"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_gravity="center_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:inputType="numberDecimal"
|
|
||||||
android:minWidth="200dp"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text=""
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:gravity="center_horizontal" />
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/treatments_newtreatment_deliverbutton"
|
|
||||||
style="?android:attr/buttonStyle"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_alignParentStart="true"
|
||||||
android:padding="10dp"
|
android:text="@string/treatments_newtreatment_insulinamount_label"
|
||||||
android:text="OK"
|
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||||
android:textSize="20sp" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/treatments_newtreatment_insulinamount_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_insulinamount"
|
||||||
|
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_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" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue