temp target display update

This commit is contained in:
Milos Kozak 2017-01-21 11:22:03 +01:00
parent ea37d9eaa8
commit 53f9b30b3e
2 changed files with 20 additions and 10 deletions

View file

@ -76,19 +76,23 @@ public class TempTargetRangeFragment extends Fragment implements View.OnClickLis
NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile(); NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
if (profile == null) return; if (profile == null) return;
TempTarget tempTarget = tempTargetList.get(position); TempTarget tempTarget = tempTargetList.get(position);
holder.date.setText(DateUtil.dateAndTimeString(tempTarget.timeStart) + " - " + DateUtil.timeString(tempTargetList.get(position).getPlannedTimeEnd())); if (tempTarget.duration != 0) {
holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.duration) + " min"); holder.date.setText(DateUtil.dateAndTimeString(tempTarget.timeStart) + " - " + DateUtil.timeString(tempTargetList.get(position).getPlannedTimeEnd()));
holder.low.setText(tempTarget.lowValueToUnitsToString(profile.getUnits())); holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.duration) + " min");
holder.high.setText(tempTarget.highValueToUnitsToString(profile.getUnits())); holder.low.setText(tempTarget.lowValueToUnitsToString(profile.getUnits()));
holder.reason.setText(tempTarget.reason); holder.high.setText(tempTarget.highValueToUnitsToString(profile.getUnits()));
if (tempTarget.isInProgress()) holder.reason.setText(tempTarget.reason);
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.colorInProgress)); } else {
else if (tempTarget.duration == 0){ holder.date.setText(DateUtil.dateAndTimeString(tempTarget.timeStart));
holder.duration.setText(R.string.cancel);
holder.low.setText(""); holder.low.setText("");
holder.high.setText(""); holder.high.setText("");
holder.duration.setText(R.string.cancel); holder.reason.setText("");
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.notificationUrgent)); holder.reasonLabel.setText("");
holder.reasonColon.setText("");
} }
if (tempTarget.isInProgress())
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.colorInProgress));
else else
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.cardColorBackground)); holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.cardColorBackground));
holder.remove.setTag(tempTarget); holder.remove.setTag(tempTarget);
@ -111,6 +115,8 @@ public class TempTargetRangeFragment extends Fragment implements View.OnClickLis
TextView low; TextView low;
TextView high; TextView high;
TextView reason; TextView reason;
TextView reasonLabel;
TextView reasonColon;
TextView remove; TextView remove;
LinearLayout dateLinearLayout; LinearLayout dateLinearLayout;
@ -122,6 +128,8 @@ public class TempTargetRangeFragment extends Fragment implements View.OnClickLis
low = (TextView) itemView.findViewById(R.id.temptargetrange_low); low = (TextView) itemView.findViewById(R.id.temptargetrange_low);
high = (TextView) itemView.findViewById(R.id.temptargetrange_high); high = (TextView) itemView.findViewById(R.id.temptargetrange_high);
reason = (TextView) itemView.findViewById(R.id.temptargetrange_reason); reason = (TextView) itemView.findViewById(R.id.temptargetrange_reason);
reasonLabel = (TextView) itemView.findViewById(R.id.temptargetrange_reason_label);
reasonColon = (TextView) itemView.findViewById(R.id.temptargetrange_reason_colon);
remove = (TextView) itemView.findViewById(R.id.temptargetrange_remove); remove = (TextView) itemView.findViewById(R.id.temptargetrange_remove);
remove.setOnClickListener(this); remove.setOnClickListener(this);
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

View file

@ -85,6 +85,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/temptargetrange_reason_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top" android:layout_gravity="top"
@ -93,6 +94,7 @@
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView <TextView
android:id="@+id/temptargetrange_reason_colon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingRight="5dp" android:paddingRight="5dp"