]> git.ktnx.net Git - mobile-ledger.git/commitdiff
extract the matching transactions limit constant
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 5 Jan 2019 12:13:11 +0000 (12:13 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 5 Jan 2019 12:13:11 +0000 (12:13 +0000)
app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java

index 601e7eca3c5740cedc1bd4e9100de9c83b326bdc..634bb61b60d9753ea9ee27c52ef53ef5ff78071a 100644 (file)
@@ -51,6 +51,7 @@ import java.util.regex.Pattern;
 
 public class RetrieveTransactionsTask extends
         AsyncTask<RetrieveTransactionsTask.Params, RetrieveTransactionsTask.Progress, Void> {
+    public static final int MATCHING_TRANSACTIONS_LIMIT = 100;
     private static final Pattern transactionStartPattern = Pattern.compile("<tr class=\"title\" " +
                                                                            "id=\"transaction-(\\d+)\"><td class=\"date\"[^\\\"]*>([\\d.-]+)</td>");
     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()});