X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FTransactionListItem.java;h=6f1ee9ebcb8eabfdeaa7844fd02f4c476ad41191;hb=20c03b7a5eb152d42fbbe9ecbaae27530563b398;hp=ab8bb7ac791314db553a4c47b645fb6b6f4e43eb;hpb=217da55a224e2ae899d0b50604e2e54f882ec04f;p=mobile-ledger-staging.git diff --git a/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java b/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java index ab8bb7ac..6f1ee9eb 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java @@ -19,30 +19,33 @@ package net.ktnx.mobileledger.model; import androidx.annotation.NonNull; +import net.ktnx.mobileledger.App; import net.ktnx.mobileledger.utils.SimpleDate; public class TransactionListItem { - private Type type; + private final Type type; private SimpleDate date; private boolean monthShown; private LedgerTransaction transaction; - private boolean odd; public TransactionListItem(SimpleDate date, boolean monthShown) { this.type = Type.DELIMITER; this.date = date; this.monthShown = monthShown; } - public TransactionListItem(LedgerTransaction transaction, boolean isOdd) { + public TransactionListItem(LedgerTransaction transaction) { this.type = Type.TRANSACTION; this.transaction = transaction; - this.odd = isOdd; } @NonNull public Type getType() { return type; } + @NonNull public SimpleDate getDate() { - return date; + if (date != null) + return date; + transaction.loadData(App.getDatabase()); + return transaction.getDate(); } public boolean isMonthShown() { return monthShown; @@ -50,8 +53,5 @@ public class TransactionListItem { public LedgerTransaction getTransaction() { return transaction; } - public boolean isOdd() { - return odd; - } public enum Type {TRANSACTION, DELIMITER} }