Skip to content

Commit

Permalink
refactor: Use Observable.doOnTerminate() (from rxjava3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghusta committed Jan 3, 2024
1 parent 4b0ceb3 commit 513995f
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ public boolean onQueryTextSubmit(String query)
Disposable disposable = dockerRegistryClient.searchImagesAsync(query)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(data -> progressBar.show())
.doOnSubscribe(disp1 -> progressBar.show())
.doOnTerminate(() -> progressBar.hide())
.subscribe(data -> {
Log.d(TAG, "searchImagesAsync.onResponse: returned " + data.getResults().size() + " out of " + data.getNumResults());
data.getResults().sort(new DefaultImageSearchComparator());
Expand All @@ -291,10 +292,8 @@ public boolean onQueryTextSubmit(String query)
},
throwable -> {
Log.e(TAG, throwable.getMessage(), throwable);
progressBar.hide();
Toast.makeText(MainActivity.this, getString(R.string.msg_error, throwable.getMessage()), Toast.LENGTH_LONG).show();
},
() -> progressBar.hide());
});
disposables.add(disposable);

// fermer le clavier de saisie
Expand Down

0 comments on commit 513995f

Please sign in to comment.