Android Open Source - rxloader Rx Loader2






From Project

Back to project page rxloader.

License

The source code is released under:

Apache License

If you think the Android project rxloader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package me.tatarka.rxloader;
//ww  w. j av a 2 s  .c o m
import rx.Observable;
import rx.functions.Func2;

/**
 * A version of {@link me.tatarka.rxloader.RxLoader} that accepts two arguments to construct the
 * observable.
 *
 * @param <A> the argument type
 * @param <T> the observable's value type
 * @see me.tatarka.rxloader.RxLoader
 */
public class RxLoader2<A, B, T> extends BaseRxLoader<T> {
    private Func2<A, B, Observable<T>> observableFunc;

    RxLoader2(RxLoaderBackend manager, String tag, Func2<A, B, Observable<T>> observableFunc, RxLoaderObserver<T> observer) {
        super(manager, tag, observer);
        this.observableFunc = observableFunc;
    }

    /**
     * Starts the {@link rx.Observable} with the given arguments.
     *
     * @param arg1 the first argument
     * @param arg2 the second argument
     * @return the {@code RxLoader2} for chaining
     * @see RxLoader#start()
     */
    public RxLoader2<A, B, T> start(A arg1, B arg2) {
        start(observableFunc.call(arg1, arg2));
        return this;
    }

    /**
     * Restarts the {@link rx.Observable} with the given arguments.
     *
     * @param arg1 the first argument
     * @param arg2 the second argument
     * @return the {@code RxLoader2} for chaining
     * @see RxLoader#restart()
     */
    public RxLoader2<A, B, T> restart(A arg1, B arg2) {
        restart(observableFunc.call(arg1, arg2));
        return this;
    }

    /**
     * Saves the last value that the {@link rx.Observable} returns in {@link
     * rx.Observer#onNext(Object)} in the Activities'ss ore Fragment's instanceState bundle. When
     * the {@code Activity} or {@code Fragment} is recreated, then the value will be redelivered.
     *
     * The value <b>must</b> implement {@link android.os.Parcelable}. If not, you should use {@link
     * me.tatarka.rxloader.RxLoader#save(SaveCallback)} to save and restore the value yourself.
     *
     * @return the {@code RxLoader2} for chaining
     */
    public RxLoader2<A, B, T> save() {
        super.save();
        return this;
    }

    /**
     * Saves the last value that the {@link rx.Observable} returns in {@link
     * rx.Observer#onNext(Object)} in the Activities'ss ore Fragment's instanceState bundle. When
     * the {@code Activity} or {@code Fragment} is recreated, then the value will be redelivered.
     *
     * The value <b>must</b> implement {@link android.os.Parcelable}. If not, you should use {@link
     * me.tatarka.rxloader.RxLoader#save(SaveCallback)} to save and restore the value yourself.
     *
     * @return the {@code RxLoader2} for chaining
     */
    public RxLoader2<A, B, T> save(SaveCallback<T> saveCallback) {
        super.save(saveCallback);
        return this;
    }
}




Java Source Code List

me.tatarka.rxloader.BaseRxLoader.java
me.tatarka.rxloader.CachingWeakRefSubscriber.java
me.tatarka.rxloader.ParcelableSaveCallback.java
me.tatarka.rxloader.RxLoader1.java
me.tatarka.rxloader.RxLoader2.java
me.tatarka.rxloader.RxLoaderBackendFragmentCompat.java
me.tatarka.rxloader.RxLoaderBackendFragmentHelper.java
me.tatarka.rxloader.RxLoaderBackendFragment.java
me.tatarka.rxloader.RxLoaderBackendNestedFragmentCompat.java
me.tatarka.rxloader.RxLoaderBackendNestedFragment.java
me.tatarka.rxloader.RxLoaderBackend.java
me.tatarka.rxloader.RxLoaderManagerCompat.java
me.tatarka.rxloader.RxLoaderManager.java
me.tatarka.rxloader.RxLoaderObserver.java
me.tatarka.rxloader.RxLoader.java
me.tatarka.rxloader.SaveCallback.java
me.tatarka.rxloader.sample.MainActivityWithFragment.java
me.tatarka.rxloader.sample.MainActivityWithViewPager.java
me.tatarka.rxloader.sample.MainActivity.java
me.tatarka.rxloader.sample.MainFragment.java
me.tatarka.rxloader.sample.SampleObservables.java