- Data.transactions.addObserver(new Observer() {
- @Override
- public void update(Observable o, Object arg) {
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- modelAdapter.notifyDataSetChanged();
- }
- });
+ Snackbar.make(this.root, err, Snackbar.LENGTH_LONG)
+ .show();
+ TransactionListViewModel.updateError.set(null);
+ });
+ Data.transactions.addObserver(
+ (o, arg) -> mActivity.runOnUiThread(() -> modelAdapter.notifyDataSetChanged()));
+
+ mActivity.findViewById(R.id.clearAccountNameFilter)
+ .setOnClickListener(v -> {
+ Data.accountFilter.setValue(null);
+ vAccountFilter.setVisibility(View.GONE);
+ menuTransactionListFilter.setVisible(true);
+ Globals.hideSoftKeyboard(mActivity);
+ });
+
+ Data.foundTransactionItemIndex.observe(getViewLifecycleOwner(), pos -> {
+ Logger.debug("go-to-date", String.format(Locale.US, "Found pos %d", pos));
+ if (pos != null) {
+ root.scrollToPosition(pos);
+ // reset the value to avoid re-notification upon reconfiguration or app restart
+ Data.foundTransactionItemIndex.setValue(null);