bolus dialog redesign

This commit is contained in:
Milos Kozak 2017-05-16 12:09:32 +02:00
parent 4201709e2a
commit 6fff6f63a4
3 changed files with 126 additions and 124 deletions

View file

@ -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;
}
}

View file

@ -207,16 +207,6 @@
android:layout_marginTop="5dp"
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

View file

@ -18,18 +18,23 @@
android:orientation="vertical"
android:padding="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="10dp"
android:layout_alignParentStart="true"
android:text="@string/treatments_newtreatment_insulinamount_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_centerInParent="true"
android:layout_marginTop="50dp"
android:orientation="horizontal">
<ImageView
@ -47,12 +52,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="200dp"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_horizontal" />
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/treatments_newtreatment_insulinamount_plus"
@ -65,19 +70,37 @@
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_gravity="center_horizontal"
android:padding="10dp"
android:layout_alignParentStart="true"
android:layout_marginTop="5dp"
android:text="@string/treatments_newtreatment_carbsamount_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal">
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/treatments_newtreatment_carbsamount_minus"
@ -94,12 +117,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="200dp"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_horizontal" />
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/treatments_newtreatment_carbsamount_plus"
@ -111,28 +134,11 @@
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_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal"
android:padding="10dp">
</RelativeLayout>
<Button
android:id="@+id/treatments_newtreatment_deliverbutton"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="10dp"
android:text="OK"
android:textSize="20sp" />
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
</LinearLayout>