NewCarbsDialog: add duration, help.

This commit is contained in:
Johannes Mockenhaupt 2018-04-04 19:59:16 +02:00
parent e9ac979a1b
commit d2491ca429
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
4 changed files with 274 additions and 160 deletions

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.Overview.Dialogs; package info.nightscout.androidaps.plugins.Overview.Dialogs;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.HandlerThread; import android.os.HandlerThread;
@ -9,7 +8,6 @@ import android.support.v7.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -18,20 +16,16 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -45,6 +39,8 @@ import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.OpenAPSSMB.DetermineBasalResultSMB;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
@ -54,16 +50,10 @@ import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils; import info.nightscout.utils.ToastUtils;
public class NewCarbsDialog extends DialogFragment implements OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener, CompoundButton.OnCheckedChangeListener { public class NewCarbsDialog extends DialogFragment implements OnClickListener, CompoundButton.OnCheckedChangeListener {
private static Logger log = LoggerFactory.getLogger(NewCarbsDialog.class); private static Logger log = LoggerFactory.getLogger(NewCarbsDialog.class);
private NumberPicker editCarbs; private ImageView helpView;
private TextView dateButton;
private TextView timeButton;
private Date initialEventTime;
private Date eventTime;
private Button fav1Button; private Button fav1Button;
private Button fav2Button; private Button fav2Button;
@ -77,6 +67,11 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
private RadioButton startHypoTTCheckbox; private RadioButton startHypoTTCheckbox;
private boolean togglingTT; private boolean togglingTT;
private NumberPicker editTime;
private LinearLayout durationLayout;
private NumberPicker editDuration;
private NumberPicker editCarbs;
private Integer maxCarbs; private Integer maxCarbs;
//one shot guards //one shot guards
@ -104,6 +99,16 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
}; };
private void validateInputs() { private void validateInputs() {
Integer time = SafeParse.stringToInt(editTime.getText());
if (time > 12 * 60 || time < -12 * 60) {
editTime.setValue(0d);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.carbsconstraintapplied));
}
Integer duration = SafeParse.stringToInt(editDuration.getText());
if (duration > 10) {
editDuration.setValue(0d);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.carbsconstraintapplied));
}
Integer carbs = SafeParse.stringToInt(editCarbs.getText()); Integer carbs = SafeParse.stringToInt(editCarbs.getText());
if (carbs > maxCarbs) { if (carbs > maxCarbs) {
editCarbs.setValue(0d); editCarbs.setValue(0d);
@ -122,10 +127,12 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
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);
helpView = view.findViewById(R.id.newcarbs_help);
helpView.setOnClickListener(this);
maxCarbs = MainApp.getConstraintChecker().getMaxCarbsAllowed().value(); maxCarbs = MainApp.getConstraintChecker().getMaxCarbsAllowed().value();
editCarbs = view.findViewById(R.id.newcarb_carbsamount); editCarbs = view.findViewById(R.id.newcarb_carbsamount);
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher); editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
startActivityTTCheckbox = view.findViewById(R.id.newcarbs_activity_tt); startActivityTTCheckbox = view.findViewById(R.id.newcarbs_activity_tt);
@ -135,15 +142,13 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
startHypoTTCheckbox = view.findViewById(R.id.newcarbs_hypo_tt); startHypoTTCheckbox = view.findViewById(R.id.newcarbs_hypo_tt);
startHypoTTCheckbox.setOnCheckedChangeListener(this); startHypoTTCheckbox.setOnCheckedChangeListener(this);
dateButton = view.findViewById(R.id.newcarbs_eventdate); editTime = view.findViewById(R.id.newcarbs_time);
timeButton = view.findViewById(R.id.newcarb_eventtime); editTime.setParams(0d, -12 * 60d, 12 * 60d, 5d, new DecimalFormat("0"), false, textWatcher);
initialEventTime = new Date(); durationLayout = view.findViewById(R.id.newcarbs_duration_layout);
eventTime = new Date(initialEventTime.getTime()); durationLayout.setVisibility(MainApp.engineeringMode ? View.VISIBLE : View.GONE);
dateButton.setText(DateUtil.dateString(eventTime)); editDuration = view.findViewById(R.id.new_carbs_duration);
timeButton.setText(DateUtil.timeString(eventTime)); editDuration.setParams(0d, 0d, 10d, 1d, new DecimalFormat("0"), false, textWatcher);
dateButton.setOnClickListener(this);
timeButton.setOnClickListener(this);
fav1Button = view.findViewById(R.id.newcarbs_plus1); fav1Button = view.findViewById(R.id.newcarbs_plus1);
fav1Button.setOnClickListener(this); fav1Button.setOnClickListener(this);
@ -168,8 +173,6 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
@Override @Override
public synchronized void onClick(View view) { public synchronized void onClick(View view) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(eventTime);
switch (view.getId()) { switch (view.getId()) {
case R.id.ok: case R.id.ok:
submit(); submit();
@ -177,27 +180,16 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
case R.id.cancel: case R.id.cancel:
dismiss(); dismiss();
break; break;
case R.id.newcarbs_eventdate: case R.id.newcarbs_help:
DatePickerDialog dpd = DatePickerDialog.newInstance( AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
this, builder.setTitle("Help");
calendar.get(Calendar.YEAR), builder.setMessage(Html.fromHtml("<b>Time</b>: relative offset to now<br/>" +
calendar.get(Calendar.MONTH), "<b>Duration</b>: splits carb up over entered time, one every 15m<br/>" +
calendar.get(Calendar.DAY_OF_MONTH) "<br/>" +
); "Did I ever tell you the story about the old tree and the wooden house? So " +
dpd.setThemeDark(true); "anyway, there I was, in the middle of the forest with all my clothes gone.<br/>" +
dpd.dismissOnPause(true); "<br/>Also: blablabla"));
dpd.show(getActivity().getFragmentManager(), "Datepickerdialog"); builder.show();
break;
case R.id.newcarb_eventtime:
TimePickerDialog tpd = TimePickerDialog.newInstance(
this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(getActivity())
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
tpd.show(getActivity().getFragmentManager(), "Timepickerdialog");
break; break;
case R.id.newcarbs_plus1: case R.id.newcarbs_plus1:
editCarbs.setValue(Math.max(0, editCarbs.getValue() editCarbs.setValue(Math.max(0, editCarbs.getValue()
@ -352,6 +344,11 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to0Decimal(hypoTT) + " mg/dl (" + hypoTTDuration + " min)</font>"); actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to0Decimal(hypoTT) + " mg/dl (" + hypoTTDuration + " min)</font>");
} }
int duration = SafeParse.stringToInt(editDuration.getText());
if (duration > 0) {
actions.add("Duration: " + editDuration.getText() + "h");
}
final double finalActivityTT = activityTT; final double finalActivityTT = activityTT;
final int finalActivityTTDuration = activityTTDuration; final int finalActivityTTDuration = activityTTDuration;
final double finalEatigSoonTT = eatingSoonTT; final double finalEatigSoonTT = eatingSoonTT;
@ -359,83 +356,74 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
final double finalHypoTT = hypoTT; final double finalHypoTT = hypoTT;
final int finalHypoTTDuration = hypoTTDuration; final int finalHypoTTDuration = hypoTTDuration;
if (!initialEventTime.equals(eventTime)) { long timeOffset = editTime.getValue().longValue();
actions.add("Time: " + DateUtil.dateAndTimeString(eventTime)); final long time = DateUtil.now() + timeOffset * 1000 * 60;
if (timeOffset != 0) {
actions.add("Time: " + DateUtil.dateAndTimeString(time));
} }
final int finalCarbsAfterConstraints = carbsAfterConstraints; final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
final Context context = getContext();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.gs(R.string.confirmation)); builder.setTitle(MainApp.gs(R.string.confirmation));
builder.setMessage(actions.isEmpty() if (carbsAfterConstraints > 0 || startActivityTTCheckbox.isChecked()
? MainApp.gs(R.string.no_action_selected) || startEatingSoonTTCheckbox.isChecked() || startHypoTTCheckbox.isChecked()) {
: Html.fromHtml(Joiner.on("<br/>").join(actions))); builder.setMessage(Html.fromHtml(Joiner.on("<br/>").join(actions)));
builder.setPositiveButton(MainApp.gs(R.string.ok), actions.isEmpty() ? null : (dialog, id) -> { builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
synchronized (builder) { synchronized (builder) {
if (accepted) { if (accepted) {
log.debug("guarding: already accepted"); log.debug("guarding: already accepted");
return; return;
} }
accepted = true; accepted = true;
if (startActivityTTCheckbox.isChecked()) { if (startActivityTTCheckbox.isChecked()) {
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(System.currentTimeMillis()) .date(System.currentTimeMillis())
.duration(finalActivityTTDuration) .duration(finalActivityTTDuration)
.reason(MainApp.gs(R.string.activity)) .reason(MainApp.gs(R.string.activity))
.source(Source.USER) .source(Source.USER)
.low(Profile.toMgdl(finalActivityTT, currentProfile.getUnits())) .low(Profile.toMgdl(finalActivityTT, currentProfile.getUnits()))
.high(Profile.toMgdl(finalActivityTT, currentProfile.getUnits())); .high(Profile.toMgdl(finalActivityTT, currentProfile.getUnits()));
MainApp.getDbHelper().createOrUpdate(tempTarget); MainApp.getDbHelper().createOrUpdate(tempTarget);
} else if (startEatingSoonTTCheckbox.isChecked()) { } else if (startEatingSoonTTCheckbox.isChecked()) {
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(System.currentTimeMillis()) .date(System.currentTimeMillis())
.duration(finalEatingSoonTTDuration) .duration(finalEatingSoonTTDuration)
.reason(MainApp.gs(R.string.eatingsoon)) .reason(MainApp.gs(R.string.eatingsoon))
.source(Source.USER) .source(Source.USER)
.low(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits())) .low(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits()))
.high(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits())); .high(Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits()));
MainApp.getDbHelper().createOrUpdate(tempTarget); MainApp.getDbHelper().createOrUpdate(tempTarget);
} else if (startHypoTTCheckbox.isChecked()) { } else if (startHypoTTCheckbox.isChecked()) {
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(System.currentTimeMillis()) .date(System.currentTimeMillis())
.duration(finalHypoTTDuration) .duration(finalHypoTTDuration)
.reason(MainApp.gs(R.string.hypo)) .reason(MainApp.gs(R.string.hypo))
.source(Source.USER) .source(Source.USER)
.low(Profile.toMgdl(finalHypoTT, currentProfile.getUnits())) .low(Profile.toMgdl(finalHypoTT, currentProfile.getUnits()))
.high(Profile.toMgdl(finalHypoTT, currentProfile.getUnits())); .high(Profile.toMgdl(finalHypoTT, currentProfile.getUnits()));
MainApp.getDbHelper().createOrUpdate(tempTarget); MainApp.getDbHelper().createOrUpdate(tempTarget);
} }
if (finalCarbsAfterConstraints > 0) { if (carbsAfterConstraints > 0) {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); if (duration == 0) {
detailedBolusInfo.date = eventTime.getTime(); createCarb(carbsAfterConstraints, time);
detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION; } else {
detailedBolusInfo.carbs = finalCarbsAfterConstraints; double remainingCarbs = carbsAfterConstraints;
detailedBolusInfo.context = context; long carbTime = time;
detailedBolusInfo.source = Source.USER; long smallCarbAmount = Math.round(remainingCarbs / (editDuration.getValue() * 4));
if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) { if (smallCarbAmount == 0) smallCarbAmount = 1;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { while (remainingCarbs > 0) {
@Override createCarb(smallCarbAmount, carbTime);
public void run() { remainingCarbs -= smallCarbAmount;
if (!result.success) { carbTime += 15 * 60 * 1000;
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
} }
}); }
} else {
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo);
} }
} }
} });
}); } else {
builder.setMessage(MainApp.gs(R.string.no_action_selected));
}
builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
builder.show(); builder.show();
dismiss(); dismiss();
@ -444,19 +432,29 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
} }
} }
@Override private void createCarb(long carbs, long time) {
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) { DetailedBolusInfo carbInfo = new DetailedBolusInfo();
eventTime.setYear(year - 1900); carbInfo.date = time;
eventTime.setMonth(monthOfYear); carbInfo.eventType = CareportalEvent.CARBCORRECTION;
eventTime.setDate(dayOfMonth); carbInfo.carbs = carbs;
dateButton.setText(DateUtil.dateString(eventTime)); carbInfo.context = getContext();
} carbInfo.source = Source.USER;
if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) {
@Override ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() {
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) { @Override
eventTime.setHours(hourOfDay); public void run() {
eventTime.setMinutes(minute); if (!result.success) {
eventTime.setSeconds(second); Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
timeButton.setText(DateUtil.timeString(eventTime)); i.putExtra("soundid", R.raw.boluserror);
i.putExtra("status", result.comment);
i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
}
});
} else {
TreatmentsPlugin.getPlugin().addToHistoryTreatment(carbInfo);
}
} }
} }

View file

@ -89,6 +89,10 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
holder.iob.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive)); holder.iob.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
else else
holder.iob.setTextColor(holder.carbs.getCurrentTextColor()); holder.iob.setTextColor(holder.carbs.getCurrentTextColor());
if (t.date > DateUtil.now())
holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorScheduled));
else
holder.date.setTextColor(holder.carbs.getCurrentTextColor());
holder.remove.setTag(t); holder.remove.setTag(t);
} }

View file

@ -84,14 +84,10 @@ public class TreatmentsTempTargetFragment extends SubscriberFragment implements
holder.reasonLabel.setText(""); holder.reasonLabel.setText("");
holder.reasonColon.setText(""); holder.reasonColon.setText("");
} }
if (tempTarget.isInProgress()) { if (tempTarget.isInProgress() && tempTarget == currentlyActiveTarget) {
if (tempTarget == currentlyActiveTarget) { holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
// active as newest } else if (tempTarget.date > DateUtil.now()) {
holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorInProgress)); holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorScheduled));
} else {
// other's that might become active again after the latest (overlapping) is over
holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
}
} else { } else {
holder.date.setTextColor(holder.reasonColon.getCurrentTextColor()); holder.date.setTextColor(holder.reasonColon.getCurrentTextColor());
} }

View file

@ -11,6 +11,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
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="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -18,19 +19,38 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="10dp"> android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/carbs"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorCarbsButton" />
<ImageView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:padding="5dp" android:layout_gravity="center"
android:src="@drawable/icon_cp_bolus_carbs" /> android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_gravity="center"
android:src="@drawable/icon_cp_bolus_carbs" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/carbs"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorCarbsButton" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="5dp"
android:layout_gravity="center"
android:id="@+id/newcarbs_help"
android:src="@drawable/icon_cp_question" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -64,7 +84,8 @@
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_horizontal"
android:padding="5dp"> android:paddingTop="5dp"
android:visibility="gone">
<TextView <TextView
android:id="@+id/newcarbs_eventdate" android:id="@+id/newcarbs_eventdate"
@ -83,15 +104,110 @@
android:text="08:20pm" /> android:text="08:20pm" />
</LinearLayout> </LinearLayout>
<info.nightscout.utils.NumberPicker <EditText
android:id="@+id/newcarb_carbsamount" android:id="@+id/newcarb_food"
android:layout_width="130dp" android:layout_width="wrap_content"
android:layout_height="40dp" android:layout_height="wrap_content"
android:layout_gravity="end" android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp" android:width="180dp"
android:layout_marginLeft="30dp" android:visibility="gone"
android:layout_marginRight="30dp" android:inputType="text|textCapWords"/>
android:layout_marginTop="10dp" />
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Time" />
<info.nightscout.utils.NumberPicker
android:id="@+id/newcarbs_time"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="end"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="m" />
</LinearLayout>
<LinearLayout
android:id="@+id/newcarbs_duration_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Duration"/>
<info.nightscout.utils.NumberPicker
android:id="@+id/new_carbs_duration"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:layout_gravity="end" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="h"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Carbs" />
<info.nightscout.utils.NumberPicker
android:id="@+id/newcarb_carbsamount"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="end"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="g" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"