private boolean monthShown;
private LedgerTransaction transaction;
private boolean odd;
- public TransactionListItem() {
- this.type = Type.TRAILER;
- }
public TransactionListItem(Date date, boolean monthShown) {
this.type = Type.DELIMITER;
this.date = date;
public boolean isOdd() {
return odd;
}
- public enum Type {TRANSACTION, DELIMITER, TRAILER}
+ public enum Type {TRANSACTION, DELIMITER}
}
case TRANSACTION:
holder.vTransaction.setVisibility(View.VISIBLE);
holder.vDelimiter.setVisibility(View.GONE);
- holder.vTrailer.setVisibility(View.GONE);
LedgerTransaction tr = item.getTransaction();
// debug("transactions", String.format("Filling position %d with %d accounts", position,
case DELIMITER:
Date date = item.getDate();
holder.vTransaction.setVisibility(View.GONE);
- holder.vTrailer.setVisibility(View.GONE);
holder.vDelimiter.setVisibility(View.VISIBLE);
holder.tvDelimiterDate.setText(DateFormat.getDateInstance().format(date));
if (item.isMonthShown()) {
holder.vDelimiterLine.setVisibility(View.VISIBLE);
holder.vDelimiterThick.setVisibility(View.GONE);
}
- break;
- case TRAILER:
- holder.vTransaction.setVisibility(View.GONE);
- holder.vTrailer.setVisibility(View.VISIBLE);
- holder.vDelimiter.setVisibility(View.GONE);
-
break;
}
}
public static TransactionListItem getTransactionListItem(int position) {
if (Data.transactions == null) return null;
try(LockHolder lh = Data.transactions.lockForReading()) {
- if (position >= Data.transactions.size() + 1) return null;
- if (position == Data.transactions.size()) return new TransactionListItem();
+ if (position >= Data.transactions.size()) return null;
return Data.transactions.get(position);
}
}
CardView vTransaction;
TextView tvDelimiterMonth, tvDelimiterDate;
View vDelimiterLine, vDelimiterThick;
- View vTrailer;
public TransactionRowHolder(@NonNull View itemView) {
super(itemView);
this.row = itemView.findViewById(R.id.transaction_row);
this.tvDelimiterMonth = itemView.findViewById(R.id.transaction_delimiter_month);
this.vDelimiterLine = itemView.findViewById(R.id.transaction_delimiter_line);
this.vDelimiterThick = itemView.findViewById(R.id.transaction_delimiter_thick);
- this.vTrailer = itemView.findViewById(R.id.transaction_list_trailer);
}
}
</androidx.constraintlayout.widget.ConstraintLayout>
- <view
- android:id="@+id/transaction_list_trailer"
- class="androidx.constraintlayout.widget.Placeholder"
- id="@+id/view"
- android:layout_width="match_parent"
- android:layout_height="80dp" />
</androidx.appcompat.widget.ContentFrameLayout>
\ No newline at end of file