]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java
fix many lint errors/warnings
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / model / TransactionListItem.java
index 084eaad8e8151d00af628dffcff82234fb684a2e..6f1ee9ebcb8eabfdeaa7844fd02f4c476ad41191 100644 (file)
@@ -19,23 +19,22 @@ 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() {
@@ -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}
 }