Android Open Source - rxloader Sample Observables






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.sample;
//  ww  w .  j a  va  2s.c o m
import android.util.Log;

import java.util.concurrent.TimeUnit;

import rx.Notification;
import rx.Observable;
import rx.functions.Action1;
import rx.functions.Func1;

/**
 * Created by evan on 8/22/14.
 */
public class SampleObservables {
    private static final String TAG = "RxLoader Sample";
    
    public static Observable<String> delay() {
        return Observable.timer(2, TimeUnit.SECONDS).map(new Func1<Long, String>() {
            @Override
            public String call(Long aLong) {
                Log.d(TAG, "2 second delay!");
                return "Async Complete!";
            }
        });
    }
    
    public static Func1<String, Observable<String>> inputDelay() {
        return new Func1<String, Observable<String>>() {
            @Override
            public Observable<String> call(final String input) {
                return Observable.timer(2, TimeUnit.SECONDS).map(new Func1<Long, String>() {
                    @Override
                    public String call(Long aLong) {
                        Log.d(TAG, "2 second delay! [" + input + "]");
                        return "Async Complete! [" + input + "]";
                    }
                });
            }
        };
    }

    public static Observable<Long> count() {
        return Observable.interval(100, TimeUnit.MILLISECONDS).doOnEach(new Action1<Notification<? super Long>>() {
            @Override
            public void call(Notification<? super Long> notification) {
                Log.d(TAG, "tick!");
            }
        }).take(100);
    }
}




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