From 8c70bbbbe73f4246f4af217a0d8b81a859a4bba7 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 17 Sep 2020 07:54:08 +0000 Subject: [PATCH] transaction list always starts with the date of the first transaction this is a good idea because of the side effect it has when a new transaction from today comes after a refresh -- you see it pop in under the date row without the date row (which is at the top of the scroll view when pulling to refresh) the new appears outside of the visible scroll window and one has to to see it -- it appears as if the refresh didn't do anything later problem still stays when the first transaction is for a past(1) and the newly coming ones are from a later (than (1)) date a possible solution is to convert the "Last updated" header to a special kind of transaction list item (there are three now - date line, transaction box and bottom filler) that always sits on the top of the list and all incoming transactions are inserted below it -- always pop in nicely --- .../net/ktnx/mobileledger/async/TransactionAccumulator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/async/TransactionAccumulator.java b/app/src/main/java/net/ktnx/mobileledger/async/TransactionAccumulator.java index 8f57e769..1b964256 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/TransactionAccumulator.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/TransactionAccumulator.java @@ -36,8 +36,10 @@ public class TransactionAccumulator { public void put(LedgerTransaction transaction, SimpleDate date) { if (done) throw new IllegalStateException("Can't put new items after done()"); - if (null == latestDate) + if (null == latestDate) { latestDate = date; + list.add(new TransactionListItem(date, SimpleDate.today().month != date.month)); + } earliestDate = date; if (!date.equals(lastDate)) { -- 2.39.5