K
K
kirawa2019-04-08 09:26:15
Android
kirawa, 2019-04-08 09:26:15

How to unsubscribe from progress?

Good afternoon. Is it possible to move progress to the container level, which is filled with fragments.
Is this normal practice?

public interface ProgressOwner {

    void setProgressState(boolean refreshing);

}

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout>
    <ProgressBar
        android:id="@+id/progress_horizontal" />
    <FrameLayout
        android:id="@+id/fragmentContainer" />
</LinearLayout>

how to hide progress or unsubscribe from a task so that everything is displayed correctly when fragments transition. or is it better to use your progress
for each fragment.
mCompositeDisposable.add(
                new WMSClient().send(Const.COMMAND)
                        .observeOn(AndroidSchedulers.mainThread())
                        .doOnSubscribe(disposable -> getViewState().showProgress())
                        .doFinally(getViewState()::hideProgress)
                        .doOnDispose(() -> getViewState().hideProgress())
                        .subscribe(response -> getViewState().openWorkListFragment(response),
                                throwable -> getViewState().showError(throwable.getMessage()))
        );

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question