]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java
major rework of parsed transaction/descriptions/accounts storage
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / TransactionListItem.java
index ab8bb7ac791314db553a4c47b645fb6b6f4e43eb..0aaf763ab564e3e39a9fa0b17e8cb085c7d8058c 100644 (file)
@@ -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,23 +27,25 @@ 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() {
         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}
 }