Skip to content

Repository files navigation

RxLoader

LicenseAPIDownload

An Android Loader that wraps an RxJava Observable.

RxLoader caches the data emitted by your Observable across orientation changes by utilizing an Android Loader, while also providing the results from an Observable preserving the RxJava pattern.

Download

Gradle:

dependencies {
compile 'com.l4digital.rxloader:rxloader:2.1.0'
}

Maven:

<dependency>
<groupId>com.l4digital.rxloader</groupId>
<artifactId>rxloader</artifactId>
<version>2.1.0</version>
</dependency>

Usage

importcom.l4digital.rxloader.RxLoader;
importcom.l4digital.rxloader.RxLoaderCallbacks;
...
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
RxLoader<DataType> loader = newRxLoader<>(this, getObservable());
RxLoaderCallbacks<DataType> callbacks = newRxLoaderCallbacks<>(loader);
callbacks.getFlowable().subscribe(this);
getLoaderManager().initLoader(loaderId, Bundle.EMPTY, callbacks);
}

RxLoader can also be used with the Android Support Library:

importcom.l4digital.support.rxloader.RxLoader;
importcom.l4digital.support.rxloader.RxLoaderCallbacks;
...
getSupportLoaderManager().initLoader(loaderId, Bundle.EMPTY, callbacks);

License

Copyright 2016 L4 Digital LLC. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

An Android Loader that wraps an RxJava Observable.

Resources

Stars

33 stars

Watchers

12 watching

Forks

Releases

Packages

Contributors

Languages