]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java
more pronounced day/month delimiters in the transaction list
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / TransactionListItem.java
index 550a84c5ed25d020ea0d488db89d3e634dd81582..7c3520919232c10c7fc44c42fe19957c649231e4 100644 (file)
@@ -20,7 +20,6 @@ package net.ktnx.mobileledger.model;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 
-import net.ktnx.mobileledger.App;
 import net.ktnx.mobileledger.utils.SimpleDate;
 
 import org.jetbrains.annotations.NotNull;
@@ -31,20 +30,25 @@ public class TransactionListItem {
     private boolean monthShown;
     private LedgerTransaction transaction;
     private String boldAccountName;
+    private String runningTotal;
     public TransactionListItem(@NotNull SimpleDate date, boolean monthShown) {
         this.type = Type.DELIMITER;
         this.date = date;
         this.monthShown = monthShown;
     }
     public TransactionListItem(@NotNull LedgerTransaction transaction,
-                               @Nullable String boldAccountName) {
+                               @Nullable String boldAccountName, @Nullable String runningTotal) {
         this.type = Type.TRANSACTION;
         this.transaction = transaction;
         this.boldAccountName = boldAccountName;
+        this.runningTotal = runningTotal;
     }
     public TransactionListItem() {
         this.type = Type.HEADER;
     }
+    public String getRunningTotal() {
+        return runningTotal;
+    }
     @NonNull
     public Type getType() {
         return type;
@@ -53,9 +57,8 @@ public class TransactionListItem {
     public SimpleDate getDate() {
         if (date != null)
             return date;
-        if (type == Type.HEADER)
-            throw new IllegalStateException("Header item has no date");
-        transaction.loadData(App.getDatabase());
+        if (type != Type.TRANSACTION)
+            throw new IllegalStateException("Only transaction items have a date");
         return transaction.getDate();
     }
     public boolean isMonthShown() {