From f2381ed366479b8d7b3f6f60c6565dbd6df099e3 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 14 Jun 2020 09:19:52 +0300 Subject: [PATCH] include comments when comparing transaction accounts --- .../net/ktnx/mobileledger/model/LedgerTransaction.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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) { -- 2.39.5