treatments PumpHistory and NS mark
This commit is contained in:
parent
e5a326c377
commit
4d30ba9cdb
3 changed files with 42 additions and 8 deletions
|
@ -528,8 +528,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
if (historyChange) {
|
if (historyChange) {
|
||||||
updateEarliestDataChange(oldDate);
|
updateEarliestDataChange(oldDate);
|
||||||
updateEarliestDataChange(old.date);
|
updateEarliestDataChange(old.date);
|
||||||
scheduleTreatmentChange();
|
|
||||||
}
|
}
|
||||||
|
scheduleTreatmentChange();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -553,8 +553,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
if (historyChange) {
|
if (historyChange) {
|
||||||
updateEarliestDataChange(oldDate);
|
updateEarliestDataChange(oldDate);
|
||||||
updateEarliestDataChange(old.date);
|
updateEarliestDataChange(old.date);
|
||||||
scheduleTreatmentChange();
|
|
||||||
}
|
}
|
||||||
|
scheduleTreatmentChange();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.Services.Intents;
|
import info.nightscout.androidaps.Services.Intents;
|
||||||
import info.nightscout.androidaps.data.Iob;
|
import info.nightscout.androidaps.data.Iob;
|
||||||
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.Treatment;
|
import info.nightscout.androidaps.db.Treatment;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
|
@ -73,18 +74,21 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
|
||||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return;
|
return;
|
||||||
holder.date.setText(DateUtil.dateAndTimeString(treatments.get(position).date));
|
Treatment t = treatments.get(position);
|
||||||
holder.insulin.setText(DecimalFormatter.to2Decimal(treatments.get(position).insulin) + " U");
|
holder.date.setText(DateUtil.dateAndTimeString(t.date));
|
||||||
holder.carbs.setText(DecimalFormatter.to0Decimal(treatments.get(position).carbs) + " g");
|
holder.insulin.setText(DecimalFormatter.to2Decimal(t.insulin) + " U");
|
||||||
Iob iob = treatments.get(position).iobCalc(new Date().getTime(), profile.getDia());
|
holder.carbs.setText(DecimalFormatter.to0Decimal(t.carbs) + " g");
|
||||||
|
Iob iob = t.iobCalc(new Date().getTime(), profile.getDia());
|
||||||
holder.iob.setText(DecimalFormatter.to2Decimal(iob.iobContrib) + " U");
|
holder.iob.setText(DecimalFormatter.to2Decimal(iob.iobContrib) + " U");
|
||||||
holder.activity.setText(DecimalFormatter.to3Decimal(iob.activityContrib) + " U");
|
holder.activity.setText(DecimalFormatter.to3Decimal(iob.activityContrib) + " U");
|
||||||
holder.mealOrCorrection.setText(treatments.get(position).mealBolus ? MainApp.sResources.getString(R.string.mealbolus) : MainApp.sResources.getString(R.string.correctionbous));
|
holder.mealOrCorrection.setText(t.mealBolus ? MainApp.sResources.getString(R.string.mealbolus) : MainApp.sResources.getString(R.string.correctionbous));
|
||||||
|
holder.ph.setVisibility(t.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||||
|
holder.ns.setVisibility(t._id != null ? View.VISIBLE : View.GONE);
|
||||||
if (iob.iobContrib != 0)
|
if (iob.iobContrib != 0)
|
||||||
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());
|
||||||
holder.remove.setTag(treatments.get(position));
|
holder.remove.setTag(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -106,6 +110,8 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
|
||||||
TextView activity;
|
TextView activity;
|
||||||
TextView mealOrCorrection;
|
TextView mealOrCorrection;
|
||||||
TextView remove;
|
TextView remove;
|
||||||
|
TextView ph;
|
||||||
|
TextView ns;
|
||||||
|
|
||||||
TreatmentsViewHolder(View itemView) {
|
TreatmentsViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
@ -116,6 +122,8 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
|
||||||
iob = (TextView) itemView.findViewById(R.id.treatments_iob);
|
iob = (TextView) itemView.findViewById(R.id.treatments_iob);
|
||||||
activity = (TextView) itemView.findViewById(R.id.treatments_activity);
|
activity = (TextView) itemView.findViewById(R.id.treatments_activity);
|
||||||
mealOrCorrection = (TextView) itemView.findViewById(R.id.treatments_mealorcorrection);
|
mealOrCorrection = (TextView) itemView.findViewById(R.id.treatments_mealorcorrection);
|
||||||
|
ph = (TextView) itemView.findViewById(R.id.pump_sign);
|
||||||
|
ns = (TextView) itemView.findViewById(R.id.ns_sign);
|
||||||
remove = (TextView) itemView.findViewById(R.id.treatments_remove);
|
remove = (TextView) itemView.findViewById(R.id.treatments_remove);
|
||||||
remove.setOnClickListener(this);
|
remove.setOnClickListener(this);
|
||||||
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
|
|
@ -82,6 +82,32 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginRight="30dp"
|
android:layout_marginRight="30dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pump_sign"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:text="PH"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:textColor="@color/colorSetTempButton" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/ns_sign"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:text="NS"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:textColor="@color/colorSetTempButton" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
Loading…
Add table
Reference in a new issue