From 547bbc03e61978caa1efc6eea23306bd690d9429 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Wed, 17 Jun 2020 22:18:20 +0300 Subject: [PATCH] avoid scrolling to the last 'go to date' after reconfiguration a cleaner solution would be to have some sort of messaging mechanism to notify the fragment of the position of the 'go to' date --- .../ui/transaction_list/TransactionListFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java index 68e243a8..47794138 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java @@ -164,8 +164,11 @@ public class TransactionListFragment extends MobileLedgerListFragment Data.foundTransactionItemIndex.observe(getViewLifecycleOwner(), pos -> { Logger.debug("go-to-date", String.format(Locale.US, "Found pos %d", pos)); - if (pos != null) + if (pos != null) { root.scrollToPosition(pos); + // reset the value to avoid re-notification upon reconfiguration or app restart + Data.foundTransactionItemIndex.setValue(null); + } }); } private void onAccountNameFilterChanged(String accName) { -- 2.39.2