X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FTransactionListItem.java;h=7c3520919232c10c7fc44c42fe19957c649231e4;hb=HEAD;hp=550a84c5ed25d020ea0d488db89d3e634dd81582;hpb=0b96f4968cd5c0b36474b94b94ec6dcf6699f60c;p=mobile-ledger.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 550a84c5..7c352091 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java @@ -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() {