From: Damyan Ivanov Date: Sat, 21 Dec 2019 21:29:25 +0000 (+0200) Subject: whitespace X-Git-Tag: v0.12.0~138 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=b04c98250e8e2abcf1d652e2a20cff0f9b98784b;p=mobile-ledger.git whitespace --- 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 69680367..2f23eff0 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java @@ -36,10 +36,14 @@ public class LedgerTransaction { new Comparator() { @Override public int compare(LedgerTransactionAccount o1, LedgerTransactionAccount o2) { - int res = o1.getAccountName().compareTo(o2.getAccountName()); - if (res != 0) return res; - res = o1.getCurrency().compareTo(o2.getCurrency()); - if (res != 0) return res; + int res = o1.getAccountName() + .compareTo(o2.getAccountName()); + if (res != 0) + return res; + res = o1.getCurrency() + .compareTo(o2.getCurrency()); + if (res != 0) + return res; return Float.compare(o1.getAmount(), o2.getAmount()); } }; @@ -54,7 +58,8 @@ public class LedgerTransaction { throws ParseException { this(id, Globals.parseLedgerDate(dateString), description); } - public LedgerTransaction(Integer id, Date date, String description, MobileLedgerProfile profile) { + public LedgerTransaction(Integer id, Date date, String description, + MobileLedgerProfile profile) { this.profile = profile.getUuid(); this.id = id; this.date = date; @@ -106,7 +111,8 @@ public class LedgerTransaction { return id; } protected void fillDataHash() { - if (dataHash != null) return; + if (dataHash != null) + return; try { Digest sha = new Digest(DIGEST_TYPE); StringBuilder data = new StringBuilder(); @@ -124,7 +130,8 @@ public class LedgerTransaction { data.append('\0'); data.append(item.getAmount()); } - sha.update(data.toString().getBytes(Charset.forName("UTF-8"))); + sha.update(data.toString() + .getBytes(Charset.forName("UTF-8"))); dataHash = sha.digestToHexString(); } catch (NoSuchAlgorithmException e) { @@ -134,8 +141,8 @@ public class LedgerTransaction { } public boolean existsInDb(SQLiteDatabase db) { fillDataHash(); - try (Cursor c = db - .rawQuery("SELECT 1 from transactions where data_hash = ?", new String[]{dataHash})) + try (Cursor c = db.rawQuery("SELECT 1 from transactions where data_hash = ?", + new String[]{dataHash})) { boolean result = c.moveToFirst(); // debug("db", String.format("Transaction %d (%s) %s", id, dataHash, @@ -144,11 +151,12 @@ public class LedgerTransaction { } } public void loadData(SQLiteDatabase db) { - if (dataLoaded) return; + if (dataLoaded) + return; - try (Cursor cTr = db - .rawQuery("SELECT date, description from transactions WHERE profile=? AND id=?", - new String[]{profile, String.valueOf(id)})) + try (Cursor cTr = db.rawQuery( + "SELECT date, description from transactions WHERE profile=? AND id=?", + new String[]{profile, String.valueOf(id)})) { if (cTr.moveToFirst()) { String dateString = cTr.getString(0);