What does RotationPersist1WorkerFragment and RotationPersist2WorkerFragment do?
ZeeshanShabbir opened this issue · comments
First of all, Thank you so much for these samples. I am new into android and i am working my way around advance stuff on my own. I am trying to adopt the approach you are using in this sample in my new app. I have gone through the code and i found these two fragments RotationPersist1WorkerFragment and RotationPersist2WorkerFragment. I think these two fragments are for to keep the track of the fragments on back press(correct me if i am wrong). Since i am new to this. Would you please like to explain further about it?
Why are there two worker fragments? when only one could have done the same work.
Looking forward to hear back from you.
Thanks much.
Actually RotationPersist1WorkerFragment
and RotationPersist2WorkerFragment
are just two different ways of approaching the same problem. One uses a ConnectedObservable
, the other uses a Subject
.
Approach 1 was the first example i wrote. You might find this blog post i wrote interesting: i go through my thought process and why i eventually rewrote the first approach to use a ConnectedObservable
.
Approach 2 was an alternative way i wrote subsequently to demonstrate how you can actually just use Subjects for the same thing. I wrote another blog post here explaining the latter approach.
Hopefully that provides some context :)