From: Damyan Ivanov Date: Thu, 4 Apr 2019 06:52:51 +0000 (+0300) Subject: better total management while parsing JSON transaction list X-Git-Tag: v0.9~14 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=d610d349cb7008f883198023ea873d2474d4a8a4;p=mobile-ledger.git better total management while parsing JSON transaction list --- 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 ea648c17..5d634d2f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java @@ -512,6 +512,7 @@ public class RetrieveTransactionsTask Log.d("rtt", String.format( "Detected native file order after %d transactions (factor %d)", processedTransactionCount, orderAccumulator)); + progress.setTotal(Data.transactions.size()); } else if (orderAccumulator < -30) { transactionOrder = DetectedTransactionOrder.REVERSE_CHRONOLOGICAL; @@ -542,8 +543,10 @@ public class RetrieveTransactionsTask progress.setTotal(maxTransactionId); } - if ((progress.getTotal() == Progress.INDETERMINATE) || - (progress.getTotal() < transaction.getId())) + + if ((transactionOrder != DetectedTransactionOrder.UNKNOWN) && + ((progress.getTotal() == Progress.INDETERMINATE) || + (progress.getTotal() < transaction.getId()))) progress.setTotal(transaction.getId()); progress.setProgress(++processedTransactionCount);