visualize SMB
This commit is contained in:
parent
204c39880f
commit
aad168c50f
|
@ -14,6 +14,7 @@ import java.util.Objects;
|
|||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Iob;
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
|
@ -160,7 +161,10 @@ public class Treatment implements DataPointWithLabelInterface {
|
|||
|
||||
@Override
|
||||
public PointsWithLabelGraphSeries.Shape getShape() {
|
||||
return PointsWithLabelGraphSeries.Shape.BOLUS;
|
||||
if (isSMB)
|
||||
return PointsWithLabelGraphSeries.Shape.SMB;
|
||||
else
|
||||
return PointsWithLabelGraphSeries.Shape.BOLUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -170,7 +174,10 @@ public class Treatment implements DataPointWithLabelInterface {
|
|||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.CYAN;
|
||||
if (isSMB)
|
||||
return MainApp.sResources.getColor(R.color.tempbasal);
|
||||
else
|
||||
return Color.CYAN;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1595,7 +1595,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
if (!t.isValid)
|
||||
continue;
|
||||
if (t.getX() < fromTime || t.getX() > endTime) continue;
|
||||
t.setY(getNearestBg((long) t.getX(), bgReadingsArray));
|
||||
if (t.isSMB)
|
||||
t.setY(lowLine);
|
||||
else
|
||||
t.setY(getNearestBg((long) t.getX(), bgReadingsArray));
|
||||
filteredTreatments.add(t);
|
||||
}
|
||||
|
||||
|
@ -1734,7 +1737,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
public void onBindViewHolder(NotificationsViewHolder holder, int position) {
|
||||
Notification notification = notificationsList.get(position);
|
||||
holder.dismiss.setTag(notification);
|
||||
if(notification.text == MainApp.sResources.getString(R.string.nsalarm_staledata))
|
||||
if (notification.text == MainApp.sResources.getString(R.string.nsalarm_staledata))
|
||||
holder.dismiss.setText("snooze");
|
||||
holder.text.setText(notification.text);
|
||||
holder.time.setText(DateUtil.timeString(notification.date));
|
||||
|
@ -1785,12 +1788,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
BroadcastAckAlarm.handleClearAlarm(notification.nsAlarm, MainApp.instance().getApplicationContext(), 60 * 60 * 1000L);
|
||||
}
|
||||
// Adding current time to snooze if we got staleData
|
||||
log.debug("Notification text is: "+notification.text);
|
||||
if(notification.text.equals(MainApp.sResources.getString(R.string.nsalarm_staledata))){
|
||||
log.debug("Notification text is: " + notification.text);
|
||||
if (notification.text.equals(MainApp.sResources.getString(R.string.nsalarm_staledata))) {
|
||||
NotificationStore nstore = getPlugin().notificationStore;
|
||||
long msToSnooze = SP.getInt("nsalarm_staledatavalue",15)*60*1000L;
|
||||
log.debug("snooze nsalarm_staledatavalue in minutes is "+SP.getInt("nsalarm_staledatavalue",15)+"\n in ms is: "+msToSnooze+" currentTimeMillis is: "+System.currentTimeMillis());
|
||||
nstore.snoozeTo(System.currentTimeMillis()+(SP.getInt("nsalarm_staledatavalue",15)*60*1000L));
|
||||
long msToSnooze = SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L;
|
||||
log.debug("snooze nsalarm_staledatavalue in minutes is " + SP.getInt("nsalarm_staledatavalue", 15) + "\n in ms is: " + msToSnooze + " currentTimeMillis is: " + System.currentTimeMillis());
|
||||
nstore.snoozeTo(System.currentTimeMillis() + (SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
TRIANGLE,
|
||||
RECTANGLE,
|
||||
BOLUS,
|
||||
SMB,
|
||||
EXTENDEDBOLUS,
|
||||
PROFILE,
|
||||
MBG,
|
||||
|
@ -218,6 +219,14 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
if (value.getLabel() != null) {
|
||||
drawLabel45(endX, endY, value, canvas);
|
||||
}
|
||||
} else if (value.getShape() == Shape.SMB) {
|
||||
mPaint.setStrokeWidth(2);
|
||||
Point[] points = new Point[3];
|
||||
points[0] = new Point((int)endX, (int)(endY-value.getSize()));
|
||||
points[1] = new Point((int)(endX+value.getSize()), (int)(endY+value.getSize()*0.67));
|
||||
points[2] = new Point((int)(endX-value.getSize()), (int)(endY+value.getSize()*0.67));
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
drawArrows(points, canvas, mPaint);
|
||||
} else if (value.getShape() == Shape.EXTENDEDBOLUS) {
|
||||
mPaint.setStrokeWidth(0);
|
||||
if (value.getLabel() != null) {
|
||||
|
|
Loading…
Reference in a new issue