- public void onRetrieveDone(boolean success) {
- progressLayout.setVisibility(View.GONE);
- swiper.setRefreshing(false);
- updateLastUpdateText();
- if (success) {
- Log.d("transactions", "calling notifyDataSetChanged()");
- modelAdapter.notifyDataSetChanged();
- }
- }
- private void updateLastUpdateText() {
- {
- long last_update =
- MLDB.get_option_value(mActivity, MLDB.OPT_TRANSACTION_LIST_STAMP, 0L);
- Log.d("transactions", String.format("Last update = %d", last_update));
- if (last_update == 0) {
- tvLastUpdate.setText(getString(R.string.transaction_last_update_never));
- }
- else {
- Date date = new Date(last_update);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- tvLastUpdate.setText(date.toInstant().atZone(ZoneId.systemDefault())
- .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
- }
- else {
- tvLastUpdate.setText(date.toLocaleString());
- }
- }
- }
- }
- public void onClearAccountNameClick(View view) {
- vAccountFilter.setVisibility(View.GONE);
- menuTransactionListFilter.setVisible(true);
- accNameFilter.setText(null);
- model.reloadTransactions(this);
- modelAdapter.resetBoldAccountName();
- modelAdapter.notifyDataSetChanged();
- Globals.hideSoftKeyboard(mActivity);
+ menu.findItem(R.id.menu_go_to_date)
+ .setOnMenuItemClickListener(item -> {
+ DatePickerFragment picker = new DatePickerFragment();
+ picker.setOnDatePickedListener(this);
+ picker.setDateRange(model.getFirstTransactionDate(),
+ model.getLastTransactionDate());
+ picker.show(requireActivity().getSupportFragmentManager(), null);
+ return true;
+ });