From d610d349cb7008f883198023ea873d2474d4a8a4 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 4 Apr 2019 09:52:51 +0300 Subject: [PATCH] better total management while parsing JSON transaction list --- .../ktnx/mobileledger/async/RetrieveTransactionsTask.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.39.5