X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FTransactionListItem.java;fp=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FTransactionListItem.java;h=550a84c5ed25d020ea0d488db89d3e634dd81582;hp=1e62ff1320cdded3cae4e50ab2c627a68ad51f61;hb=0b96f4968cd5c0b36474b94b94ec6dcf6699f60c;hpb=3c459e59ba3ac6082d65984359fcb6276965de4d 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 1e62ff13..550a84c5 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/TransactionListItem.java @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Damyan Ivanov. + * Copyright © 2021 Damyan Ivanov. * This file is part of MoLe. * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by @@ -18,6 +18,7 @@ package net.ktnx.mobileledger.model; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import net.ktnx.mobileledger.App; import net.ktnx.mobileledger.utils.SimpleDate; @@ -29,14 +30,17 @@ public class TransactionListItem { private SimpleDate date; private boolean monthShown; private LedgerTransaction transaction; + private String boldAccountName; public TransactionListItem(@NotNull SimpleDate date, boolean monthShown) { this.type = Type.DELIMITER; this.date = date; this.monthShown = monthShown; } - public TransactionListItem(@NotNull LedgerTransaction transaction) { + public TransactionListItem(@NotNull LedgerTransaction transaction, + @Nullable String boldAccountName) { this.type = Type.TRANSACTION; this.transaction = transaction; + this.boldAccountName = boldAccountName; } public TransactionListItem() { this.type = Type.HEADER; @@ -64,5 +68,21 @@ public class TransactionListItem { String.format("Item type is not %s, but %s", Type.TRANSACTION, type)); return transaction; } - public enum Type {TRANSACTION, DELIMITER, HEADER} + public @Nullable + String getBoldAccountName() { + return boldAccountName; + } + public enum Type { + TRANSACTION, DELIMITER, HEADER; + public static Type valueOf(int i) { + if (i == TRANSACTION.ordinal()) + return TRANSACTION; + else if (i == DELIMITER.ordinal()) + return DELIMITER; + else if (i == HEADER.ordinal()) + return HEADER; + else + throw new IllegalStateException("Unexpected value: " + i); + } + } }