X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FTransactionListItem.java;h=0aaf763ab564e3e39a9fa0b17e8cb085c7d8058c;hp=084eaad8e8151d00af628dffcff82234fb684a2e;hb=5bba2c06a81c87327fdcf3f2a85c3206d932c2f9;hpb=d080698efeba76aab6ef6b5b9d182990749509a7 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 084eaad8..0aaf763a 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java @@ -19,6 +19,7 @@ package net.ktnx.mobileledger.model; import androidx.annotation.NonNull; +import net.ktnx.mobileledger.App; import net.ktnx.mobileledger.utils.SimpleDate; public class TransactionListItem { @@ -26,16 +27,14 @@ public class TransactionListItem { 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() { @@ -43,7 +42,10 @@ public class TransactionListItem { } @NonNull public SimpleDate getDate() { - return (date != null) ? date : transaction.getDate(); + if (date != null) + return date; + transaction.loadData(App.getDatabase()); + return transaction.getDate(); } public boolean isMonthShown() { return monthShown; @@ -51,8 +53,5 @@ public class TransactionListItem { public LedgerTransaction getTransaction() { return transaction; } - public boolean isOdd() { - return odd; - } public enum Type {TRANSACTION, DELIMITER} }