I have this AppCompatActivity
that host a ViewPager
containing 3 Fragments
now in the AppCompatActivity
toolbar
I have this ProgressBar
that each of the Fragment can turn on/off using the following calls:
@Subscribe(threadMode = ThreadMode.MAIN)
public void onShowProgressBar(OnRequestToShowProgressBarEvent onRequestToShowProgressBarEvent) {
progressIndicator.setVisibility(View.VISIBLE);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onHideProgressBar(OnRequestToHideProgressBarEvent onRequestToHideProgressBarEvent) {
progressIndicator.setVisibility(View.INVISIBLE);
}
The Fragment
are doing work independently and when doing the work they can turn on the ProgressBar
and turn it off when finished.
Now it occurred to me that this will fail since Frag_1 can turn on the ProgressBar
and Frag_2 can turn it off and still the Frag_1 has not finished working and should have the ProgressBar
on but now it´s off right.
How to solve this?