import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import net.ktnx.mobileledger.App;
import net.ktnx.mobileledger.utils.SimpleDate;
import org.jetbrains.annotations.NotNull;
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;
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() {