Merge pull request #53 from AdrianLxM/TDD-History

Tdd history
This commit is contained in:
Milos Kozak 2016-11-08 07:17:33 +01:00 committed by GitHub
commit b0c4f0f655
2 changed files with 20 additions and 2 deletions

View file

@ -281,8 +281,6 @@ public class DanaRHistoryActivity extends Activity {
holder.stringvalue.setText(record.getStringRecordValue()); holder.stringvalue.setText(record.getStringRecordValue());
holder.bolustype.setText(record.getBolusType()); holder.bolustype.setText(record.getBolusType());
holder.duration.setText(DecimalFormatter.to0Decimal(record.getRecordDuration())); holder.duration.setText(DecimalFormatter.to0Decimal(record.getRecordDuration()));
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
holder.alarm.setText(record.getRecordAlarm()); holder.alarm.setText(record.getRecordAlarm());
switch (showingType) { switch (showingType) {
case RecordTypes.RECORD_TYPE_ALARM: case RecordTypes.RECORD_TYPE_ALARM:
@ -293,6 +291,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.VISIBLE); holder.alarm.setVisibility(View.VISIBLE);
break; break;
case RecordTypes.RECORD_TYPE_BOLUS: case RecordTypes.RECORD_TYPE_BOLUS:
@ -303,9 +302,15 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.VISIBLE); holder.duration.setVisibility(View.VISIBLE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
case RecordTypes.RECORD_TYPE_DAILY: case RecordTypes.RECORD_TYPE_DAILY:
df = DateFormat.getDateInstance(DateFormat.SHORT);
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()+ record.getRecordDailyBasal()) + "U");
holder.time.setText(df.format(new Date(record.getRecordDate())));
holder.time.setVisibility(View.VISIBLE); holder.time.setVisibility(View.VISIBLE);
holder.value.setVisibility(View.GONE); holder.value.setVisibility(View.GONE);
holder.stringvalue.setVisibility(View.GONE); holder.stringvalue.setVisibility(View.GONE);
@ -313,6 +318,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.VISIBLE); holder.dailybasal.setVisibility(View.VISIBLE);
holder.dailybolus.setVisibility(View.VISIBLE); holder.dailybolus.setVisibility(View.VISIBLE);
holder.dailytotal.setVisibility(View.VISIBLE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
case RecordTypes.RECORD_TYPE_GLUCOSE: case RecordTypes.RECORD_TYPE_GLUCOSE:
@ -331,6 +337,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
case RecordTypes.RECORD_TYPE_SUSPEND: case RecordTypes.RECORD_TYPE_SUSPEND:
@ -341,6 +348,7 @@ public class DanaRHistoryActivity extends Activity {
holder.duration.setVisibility(View.GONE); holder.duration.setVisibility(View.GONE);
holder.dailybasal.setVisibility(View.GONE); holder.dailybasal.setVisibility(View.GONE);
holder.dailybolus.setVisibility(View.GONE); holder.dailybolus.setVisibility(View.GONE);
holder.dailytotal.setVisibility(View.GONE);
holder.alarm.setVisibility(View.GONE); holder.alarm.setVisibility(View.GONE);
break; break;
} }
@ -365,6 +373,7 @@ public class DanaRHistoryActivity extends Activity {
TextView duration; TextView duration;
TextView dailybasal; TextView dailybasal;
TextView dailybolus; TextView dailybolus;
TextView dailytotal;
TextView alarm; TextView alarm;
HistoryViewHolder(View itemView) { HistoryViewHolder(View itemView) {
@ -377,6 +386,7 @@ public class DanaRHistoryActivity extends Activity {
duration = (TextView) itemView.findViewById(R.id.danar_history_duration); duration = (TextView) itemView.findViewById(R.id.danar_history_duration);
dailybasal = (TextView) itemView.findViewById(R.id.danar_history_dailybasal); dailybasal = (TextView) itemView.findViewById(R.id.danar_history_dailybasal);
dailybolus = (TextView) itemView.findViewById(R.id.danar_history_dailybolus); dailybolus = (TextView) itemView.findViewById(R.id.danar_history_dailybolus);
dailytotal = (TextView) itemView.findViewById(R.id.danar_history_dailytotal);
alarm = (TextView) itemView.findViewById(R.id.danar_history_alarm); alarm = (TextView) itemView.findViewById(R.id.danar_history_alarm);
} }
} }

View file

@ -72,6 +72,14 @@
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:gravity="right" /> android:gravity="right" />
<TextView
android:id="@+id/danar_history_dailytotal"
android:layout_width="56dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:gravity="right"
android:visibility="gone"/>
<TextView <TextView
android:id="@+id/danar_history_alarm" android:id="@+id/danar_history_alarm"
android:layout_width="100dp" android:layout_width="100dp"