The scope of this PR is limited to just to replace AsyncTaskLoader with RxLoader. Minimal changes are done to have a minimal diff, to better see where RxLoader logic replaces AsyncTaskLoader logic.
One change in particular is that previously, the ListFragment was creating a new AsyncTaskLoader instance every time a query was performed. The AsyncTaskLoader constructor had the query arguments. Now, the same RxLoader instance exists throughout the life of the ListFragment, but its main method is invoked with the query arguments.
What I like:
The RxLoader library is very similar to the support library's Loader API, which makes porting from a standard Loader relatively easy
The Rx code is split into multiple modular libraries for this to work:
RxJava: the core of Rx
RxAndroid: only used for the main thread scheduler
RxLoader: necessary to easily port the loader-based ListFragment to a ListFragment using Rx to load data. This library saves the day, in particular for managing the rotation of the device. The Observable which returns the data needs to be maintained outside of the life cycle of the fragment/activity. I tried initially without this library, but I realized the Observable had to be maintained outside of the fragment lifecycle. The RxLoaderManagerCompat in this library does all the magic.
Retrolambda: without this, some extra ugly lines of code would be present.
I can't wait to add RxJava to my app!
The scope of this PR is limited to just to replace AsyncTaskLoader with RxLoader. Minimal changes are done to have a minimal diff, to better see where RxLoader logic replaces AsyncTaskLoader logic.
One change in particular is that previously, the ListFragment was creating a new AsyncTaskLoader instance every time a query was performed. The AsyncTaskLoader constructor had the query arguments. Now, the same RxLoader instance exists throughout the life of the ListFragment, but its main method is invoked with the query arguments.
What I like:
RxLoaderManagerCompat
in this library does all the magic.