From: Damyan Ivanov Date: Wed, 17 Jun 2020 19:18:20 +0000 (+0300) Subject: avoid scrolling to the last 'go to date' after reconfiguration X-Git-Tag: v0.14.0~10 X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=commitdiff_plain;h=547bbc03e61978caa1efc6eea23306bd690d9429 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 --- 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) {