X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FLedgerTransaction.java;h=db5bbc7bf584286c2aac1de0e578e2c7e3771192;hb=69ced96a5bafb6cbc81245e6f10fca0ed8e5515c;hp=cdf2068aac46214df78d7fad234467f1b340a140;hpb=ee3c0ffdb714b35759198466f955e2333fdd8c8b;p=mobile-ledger-staging.git 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..db5bbc7b 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()); } }; @@ -128,6 +132,8 @@ public class LedgerTransaction { data.append('\0'); data.append(getDescription()); data.append('\0'); + data.append(getComment()); + data.append('\0'); data.append(Globals.formatLedgerDate(getDate())); data.append('\0'); for (LedgerTransactionAccount item : accounts) { @@ -140,7 +146,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) {