From: Damyan Ivanov Date: Sun, 14 Jun 2020 06:19:52 +0000 (+0300) Subject: include comments when comparing transaction accounts X-Git-Tag: v0.14.0~33 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=f2381ed366479b8d7b3f6f60c6565dbd6df099e3;p=mobile-ledger.git include comments when comparing transaction accounts --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java index cdf2068a..4e7ce33e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java @@ -23,7 +23,7 @@ import android.database.sqlite.SQLiteDatabase; import net.ktnx.mobileledger.utils.Digest; import net.ktnx.mobileledger.utils.Globals; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.security.NoSuchAlgorithmException; import java.text.ParseException; import java.util.ArrayList; @@ -44,6 +44,10 @@ public class LedgerTransaction { .compareTo(o2.getCurrency()); if (res != 0) return res; + res = o1.getComment() + .compareTo(o2.getComment()); + if (res != 0) + return res; return Float.compare(o1.getAmount(), o2.getAmount()); } }; @@ -140,7 +144,7 @@ public class LedgerTransaction { data.append(item.getComment()); } sha.update(data.toString() - .getBytes(Charset.forName("UTF-8"))); + .getBytes(StandardCharsets.UTF_8)); dataHash = sha.digestToHexString(); } catch (NoSuchAlgorithmException e) {