- if (tr == null) return;
-
- Log.d("transactions", String.format("Filling position %d with %d accounts", position,
- tr.getAccounts().size()));
-
- TransactionLoader loader = new TransactionLoader();
- loader.execute(new TransactionLoaderParams(tr, holder, position, boldAccountName));
+ if (item == null) return;
+
+ if (item.getType() == TransactionListItem.Type.TRANSACTION) {
+ holder.vTransaction.setVisibility(View.VISIBLE);
+ holder.vDelimiter.setVisibility(View.GONE);
+ LedgerTransaction tr = item.getTransaction();
+
+// Log.d("transactions", String.format("Filling position %d with %d accounts", position,
+// tr.getAccounts().size()));
+
+ TransactionLoader loader = new TransactionLoader();
+ loader.execute(new TransactionLoaderParams(tr, holder, position, boldAccountName,
+ item.isOdd()));
+
+ // WORKAROUND what seems to be a bug in CardHolder somewhere
+ // when a view that was previously holding a delimiter is re-purposed
+ // occasionally it stays too short (not high enough)
+ holder.vTransaction.measure(View.MeasureSpec
+ .makeMeasureSpec(holder.itemView.getWidth(), View.MeasureSpec.EXACTLY),
+ View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
+ }
+ else {
+ Date date = item.getDate();
+ holder.vTransaction.setVisibility(View.GONE);
+ holder.vDelimiter.setVisibility(View.VISIBLE);
+ holder.tvDelimiterDate.setText(DateFormat.getDateInstance().format(date));
+ if (item.isMonthShown()) {
+ holder.tvDelimiterMonth.setText(Globals.monthNames[date.getMonth()]);
+ holder.tvDelimiterMonth.setVisibility(View.VISIBLE);
+ holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_8dp);
+ }
+ else {
+ holder.tvDelimiterMonth.setVisibility(View.GONE);
+ holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_1dp);
+ }
+ }