- public void onRetrieveProgress(RetrieveTransactionsTask.Progress progress) {
- ProgressBar progressBar = findViewById(R.id.transaction_list_progress_bar);
-
- if (progress.getState() == RetrieveTransactionsTask.ProgressState.FINISHED) {
- findViewById(R.id.transaction_progress_layout).setVisibility(View.GONE);
-
- Data.transactionRetrievalDone();
-
- if (progress.getError() != null) {
- Snackbar.make(mViewPager, progress.getError(), Snackbar.LENGTH_LONG)
- .show();
+ public void onRetrieveRunningChanged(Boolean running) {
+ if (running) {
+ b.transactionListCancelDownload.setEnabled(true);
+ ColorStateList csl = Colors.getColorStateList();
+ b.transactionListProgressBar.setIndeterminateTintList(csl);
+ b.transactionListProgressBar.setProgressTintList(csl);
+ b.transactionListProgressBar.setIndeterminate(true);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ b.transactionListProgressBar.setProgress(0, false);
+ }
+ else {
+ b.transactionListProgressBar.setProgress(0);
+ }
+ b.transactionProgressLayout.setVisibility(View.VISIBLE);
+ }
+ else {
+ b.transactionProgressLayout.setVisibility(View.GONE);
+ }
+ }
+ public void onRetrieveProgress(@Nullable RetrieveTransactionsTask.Progress progress) {
+ if (progress == null ||
+ progress.getState() == RetrieveTransactionsTask.ProgressState.FINISHED)
+ {
+ Logger.debug(TAG, "progress: Done");
+ b.transactionProgressLayout.setVisibility(View.GONE);
+
+ mainModel.transactionRetrievalDone();
+
+ String error = (progress == null) ? null : progress.getError();
+ if (error != null) {
+ if (error.equals(RetrieveTransactionsTask.Result.ERR_JSON_PARSER_ERROR))
+ error = getResources().getString(R.string.err_json_parser_error);
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setMessage(error);
+ builder.setPositiveButton(R.string.btn_profile_options, (dialog, which) -> {
+ Logger.debug(TAG, "will start profile editor");
+ ProfileDetailActivity.start(this, profile);
+ });
+ builder.create()
+ .show();