temptarget design

This commit is contained in:
Milos Kozak 2017-05-24 19:42:23 +02:00
parent bb9c68fd4d
commit 2ae30fe9b4
6 changed files with 29 additions and 31 deletions

View file

@ -1122,7 +1122,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
double lastLineBasal = 0; double lastLineBasal = 0;
double lastBaseBasal = 0; double lastBaseBasal = 0;
double lastTempBasal = 0; double lastTempBasal = 0;
for (long time = fromTime; time < now; time += 5 * 60 * 1000L) { for (long time = fromTime; time < now; time += 1 * 60 * 1000L) {
TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasal(time); TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasal(time);
double baseBasalValue = profile.getBasal(NSProfile.secondsFromMidnight(new Date(time))); double baseBasalValue = profile.getBasal(NSProfile.secondsFromMidnight(new Date(time)));
double baseLineValue = baseBasalValue; double baseLineValue = baseBasalValue;

View file

@ -63,7 +63,7 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
ExtendedBolus extendedBolus = extendedBolusList.getReversed(position); ExtendedBolus extendedBolus = extendedBolusList.getReversed(position);
if (extendedBolus.isEndingEvent()) { if (extendedBolus.isEndingEvent()) {
holder.date.setText(DateUtil.dateAndTimeString(extendedBolus.date)); holder.date.setText(DateUtil.dateAndTimeString(extendedBolus.date));
holder.duration.setText(MainApp.sResources.getString(R.string.stopevent)); holder.duration.setText(MainApp.sResources.getString(R.string.cancel));
holder.insulin.setText(""); holder.insulin.setText("");
holder.realDuration.setText(""); holder.realDuration.setText("");
holder.iob.setText(""); holder.iob.setText("");

View file

@ -64,8 +64,8 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
public void onBindViewHolder(TempTargetsViewHolder holder, int position) { public void onBindViewHolder(TempTargetsViewHolder holder, int position) {
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.getReversed(position);
if (tempTarget.durationInMinutes != 0) { if (!tempTarget.isEndingEvent()) {
holder.date.setText(DateUtil.dateAndTimeString(tempTarget.date) + " - " + DateUtil.timeString(tempTargetList.get(position).originalEnd())); holder.date.setText(DateUtil.dateAndTimeString(tempTarget.date) + " - " + DateUtil.timeString(tempTargetList.get(position).originalEnd()));
holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.durationInMinutes) + " min"); holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.durationInMinutes) + " min");
holder.low.setText(tempTarget.lowValueToUnitsToString(profile.getUnits())); holder.low.setText(tempTarget.lowValueToUnitsToString(profile.getUnits()));
@ -81,9 +81,9 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
holder.reasonColon.setText(""); holder.reasonColon.setText("");
} }
if (tempTarget.isInProgress()) if (tempTarget.isInProgress())
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.colorInProgress)); holder.date.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
else else
holder.dateLinearLayout.setBackgroundColor(ContextCompat.getColor(MainApp.instance(), R.color.cardColorBackground)); holder.date.setTextColor(holder.reasonColon.getCurrentTextColor());
holder.remove.setTag(tempTarget); holder.remove.setTag(tempTarget);
} }
@ -107,7 +107,6 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
TextView reasonLabel; TextView reasonLabel;
TextView reasonColon; TextView reasonColon;
TextView remove; TextView remove;
LinearLayout dateLinearLayout;
TempTargetsViewHolder(View itemView) { TempTargetsViewHolder(View itemView) {
super(itemView); super(itemView);
@ -122,7 +121,6 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
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);
dateLinearLayout = (LinearLayout) itemView.findViewById(R.id.temptargetrange_datelinearlayout);
} }
@Override @Override

View file

@ -65,7 +65,7 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
TemporaryBasal tempBasal = tempBasalList.getReversed(position); TemporaryBasal tempBasal = tempBasalList.getReversed(position);
if (tempBasal.isEndingEvent()) { if (tempBasal.isEndingEvent()) {
holder.date.setText(DateUtil.dateAndTimeString(tempBasal.date)); holder.date.setText(DateUtil.dateAndTimeString(tempBasal.date));
holder.duration.setText(MainApp.sResources.getString(R.string.stopevent)); holder.duration.setText(MainApp.sResources.getString(R.string.cancel));
holder.absolute.setText(""); holder.absolute.setText("");
holder.percent.setText(""); holder.percent.setText("");
holder.realDuration.setText(""); holder.realDuration.setText("");

View file

@ -5,10 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
card_view:cardBackgroundColor="@color/cardColorBackground" card_view:cardBackgroundColor="?android:colorBackground">
card_view:cardCornerRadius="6dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="6dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -16,7 +13,6 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/temptargetrange_datelinearlayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:baselineAligned="true" android:baselineAligned="true"
@ -28,10 +24,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:gravity="center_vertical|right" android:gravity="center_vertical|right"
android:paddingLeft="5dp" android:paddingLeft="10dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:text="{fa-clock-o}" android:text="{fa-clock-o}" />
android:textColor="@color/cardItemLabel" />
<TextView <TextView
android:id="@+id/temptargetrange_date" android:id="@+id/temptargetrange_date"
@ -39,8 +34,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:text="1.1.2000 18:00" android:text="1.1.2000 18:00"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" />
android:textColor="@color/cardItemLabel" />
<TextView <TextView
android:id="@+id/temptargetrange_low" android:id="@+id/temptargetrange_low"
@ -48,16 +42,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:text="80" android:text="80"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" />
android:textColor="@color/cardItemLabel" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:text="-" android:text="-"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" />
android:textColor="@color/cardItemLabel" />
<TextView <TextView
android:id="@+id/temptargetrange_high" android:id="@+id/temptargetrange_high"
@ -65,8 +57,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:text="100" android:text="100"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" />
android:textColor="@color/cardItemLabel" />
<TextView <TextView
android:id="@+id/temptargetrange_duration" android:id="@+id/temptargetrange_duration"
@ -74,8 +65,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:text="30 min" android:text="30 min"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall" />
android:textColor="@color/cardItemLabel" />
</LinearLayout> </LinearLayout>
@ -105,21 +95,32 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1"
android:paddingRight="10dp" android:paddingRight="10dp"
android:text="Activity" android:text="Activity"
android:layout_weight="1"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:text="@string/overview_quickwizard_item_remove_button" android:id="@+id/temptargetrange_remove"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/temptargetrange_remove" android:layout_marginRight="10dp"
android:text="@string/overview_quickwizard_item_remove_button"
android:textAlignment="viewEnd" android:textAlignment="viewEnd"
android:textColor="@android:color/holo_orange_light" /> android:textColor="@android:color/holo_orange_light" />
</LinearLayout> </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" />
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>

View file

@ -612,7 +612,6 @@
<string name="key_ns_noupload" translatable="false">ns_noupload</string> <string name="key_ns_noupload" translatable="false">ns_noupload</string>
<string name="basal_step">Basal Step</string> <string name="basal_step">Basal Step</string>
<string name="bolus_step">Bolus Step</string> <string name="bolus_step">Bolus Step</string>
<string name="stopevent">STOP</string>
<string name="extendedbolus">ExtendedBolus</string> <string name="extendedbolus">ExtendedBolus</string>
<string name="temptarget">TempTarget</string> <string name="temptarget">TempTarget</string>
</resources> </resources>