+ if (mBackMeansToAccountList && (mViewPager.getCurrentItem() == 1)) {
+ mainModel.getAccountFilter()
+ .setValue(null);
+ showAccountSummaryFragment();
+ mBackMeansToAccountList = false;
+ }
+ else {
+ Logger.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);
+
+ Logger.debug("transactions",
+ String.format(Locale.ENGLISH, "Last update = %d", last_update));
+ if (last_update == 0) {
+ mainModel.lastUpdateDate.postValue(null);
+ }
+ else {
+ mainModel.lastUpdateDate.postValue(new Date(last_update));
+ }
+ scheduleDataRetrievalIfStale(last_update);
+
+ }
+ public void onStopTransactionRefreshClick(View view) {
+ Logger.debug("interactive", "Cancelling transactions refresh");
+ mainModel.stopTransactionsRetrieval();
+ bTransactionListCancelDownload.setEnabled(false);
+ }
+ public void onRetrieveRunningChanged(Boolean running) {
+ final View progressLayout = findViewById(R.id.transaction_progress_layout);
+ if (running) {
+ 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);
+ }
+ progressLayout.setVisibility(View.VISIBLE);
+ }
+ else {
+ progressLayout.setVisibility(View.GONE);
+ }
+ }
+ public void onRetrieveProgress(RetrieveTransactionsTask.Progress progress) {
+ ProgressBar progressBar = findViewById(R.id.transaction_list_progress_bar);
+
+ if (progress.getState() == RetrieveTransactionsTask.ProgressState.FINISHED) {
+ Logger.debug("progress", "Done");
+ findViewById(R.id.transaction_progress_layout).setVisibility(View.GONE);
+
+ mainModel.transactionRetrievalDone();