From: Damyan Ivanov Date: Sat, 5 Jan 2019 12:13:11 +0000 (+0000) Subject: extract the matching transactions limit constant X-Git-Tag: v0.3~125 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=985b25d6284011d906db1399790832008c50b07d;p=mobile-ledger.git extract the matching transactions limit constant --- diff --git a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java index 601e7eca..634bb61b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java @@ -51,6 +51,7 @@ import java.util.regex.Pattern; public class RetrieveTransactionsTask extends AsyncTask { + public static final int MATCHING_TRANSACTIONS_LIMIT = 100; private static final Pattern transactionStartPattern = Pattern.compile("([\\d.-]+)"); private static final Pattern transactionDescriptionPattern = @@ -246,7 +247,9 @@ public class RetrieveTransactionsTask extends "=?", new Integer[]{transaction.getId()}); matchedTransactionsCount++; - if (matchedTransactionsCount == 100) { + if (matchedTransactionsCount == + MATCHING_TRANSACTIONS_LIMIT) + { db.execSQL("UPDATE transactions SET keep=1 WHERE " + "id < ?", new Integer[]{transaction.getId()});