+ if (mBackMeansToAccountList && (mViewPager.getCurrentItem() == 1)) {
+ Data.accountFilter.setValue(null);
+ showAccountSummaryFragment();
+ mBackMeansToAccountList = false;
+ }
+ else {
+ debug("fragments", String.format(Locale.ENGLISH, "manager stack: %d",
+ getSupportFragmentManager().getBackStackEntryCount()));
+
+ super.onBackPressed();
+ }
+ }
+ }
+ public void updateLastUpdateTextFromDB() {
+ if (profile == null)
+ return;
+
+ long last_update = profile.getLongOption(MLDB.OPT_LAST_SCRAPE, 0L);
+
+ debug("transactions", String.format(Locale.ENGLISH, "Last update = %d", last_update));
+ if (last_update == 0) {
+ Data.lastUpdateDate.postValue(null);
+ }
+ else {
+ Data.lastUpdateDate.postValue(new Date(last_update));
+ }
+ }
+ public void onStopTransactionRefreshClick(View view) {
+ debug("interactive", "Cancelling transactions refresh");
+ Data.stopTransactionsRetrieval();
+ bTransactionListCancelDownload.setEnabled(false);
+ }
+ public void onRetrieveDone(String error) {
+ Data.transactionRetrievalDone();
+ findViewById(R.id.transaction_progress_layout).setVisibility(View.GONE);
+
+ if (error == null) {
+ updateLastUpdateTextFromDB();
+
+ new RefreshDescriptionsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+ TransactionListViewModel.scheduleTransactionListReload();
+ }
+ else
+ Snackbar.make(mViewPager, error, Snackbar.LENGTH_LONG)
+ .show();
+ }
+ public void onRetrieveStart() {
+ ProgressBar progressBar = findViewById(R.id.transaction_list_progress_bar);
+ bTransactionListCancelDownload.setEnabled(true);
+ ColorStateList csl = Colors.getColorStateList();
+ progressBar.setIndeterminateTintList(csl);
+ progressBar.setProgressTintList(csl);
+ progressBar.setIndeterminate(true);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
+ progressBar.setProgress(0, false);
+ else
+ progressBar.setProgress(0);
+ findViewById(R.id.transaction_progress_layout).setVisibility(View.VISIBLE);
+ }
+ public void onRetrieveProgress(RetrieveTransactionsTask.Progress progress) {
+ ProgressBar progressBar = findViewById(R.id.transaction_list_progress_bar);
+ if ((progress.getTotal() == RetrieveTransactionsTask.Progress.INDETERMINATE) ||
+ (progress.getTotal() == 0))
+ {
+ progressBar.setIndeterminate(true);
+ }
+ else {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ progressBar.setMin(0);
+ }
+ progressBar.setMax(progress.getTotal());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ progressBar.setProgress(progress.getProgress(), true);
+ }
+ else
+ progressBar.setProgress(progress.getProgress());
+ progressBar.setIndeterminate(false);
+ }
+ }
+ public void fabShouldShow() {
+ if ((profile != null) && profile.isPostingPermitted() && !drawer.isOpen())
+ fab.show();
+ }
+ public void fabHide() {
+ fab.hide();
+ }
+ public void onAccountSummaryRowViewClicked(View view) {
+ ViewGroup row;
+ if (view.getId() == R.id.account_expander)
+ row = (ViewGroup) view.getParent()
+ .getParent();
+ else
+ row = (ViewGroup) view.getParent();