- Data.profile.addObserver((o, arg) -> mActivity.runOnUiThread(() -> {
- Log.d("transactions", "requesting list reload");
- TransactionListViewModel.scheduleTransactionListReload();
- }));
-
- TransactionListViewModel.scheduleTransactionListReload();
- TransactionListViewModel.updating.addObserver(
- (o, arg) -> swiper.setRefreshing(TransactionListViewModel.updating.get()));
-
- Data.transactions.addObserver(
- (o, arg) -> mActivity.runOnUiThread(() -> modelAdapter.notifyDataSetChanged()));
-
- mActivity.findViewById(R.id.clearAccountNameFilter).setOnClickListener(v -> {
- vAccountFilter.setVisibility(View.GONE);
- if (menuTransactionListFilter != null) menuTransactionListFilter.setVisible(true);
- accountFilter.set(null);
- accNameFilter.setText(null);
- TransactionListViewModel.scheduleTransactionListReload();
- Globals.hideSoftKeyboard(mActivity);
- });
+ b.transactionFilterAccountName.setAdapter(
+ new AccountAutocompleteAdapter(getContext(), profile));
+ }
+ private void onAccountNameFilterChanged(String accName) {
+ b.transactionFilterAccountName.setText(accName, false);
+
+ boolean filterActive = (accName != null) && !accName.isEmpty();
+ b.transactionListAccountNameFilter.setVisibility(filterActive ? View.VISIBLE : View.GONE);
+ if (menuTransactionListFilter != null)
+ menuTransactionListFilter.setVisible(!filterActive);