Android Open Source - rxloader Rx Loader Manager Compat






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;
/*from  ww  w . j  av  a2  s.  co  m*/
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

import static me.tatarka.rxloader.RxLoaderManager.FRAGMENT_TAG;

/**
 * Get an instance of {@link me.tatarka.rxloader.RxLoaderManager} that works with the support
 * library.
 *
 * @author Evan Tatarka
 */
public final class RxLoaderManagerCompat {
    private RxLoaderManagerCompat() {

    }

    /**
     * Get an instance of {@code RxLoaderManager} that is tied to the lifecycle of the given {@link
     * android.support.v4.app.FragmentActivity}.
     *
     * @param activity the activity
     * @return the {@code RxLoaderManager}
     */
    public static RxLoaderManager get(FragmentActivity activity) {
        RxLoaderBackendFragmentCompat manager = (RxLoaderBackendFragmentCompat) activity.getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
        if (manager == null) {
            manager = new RxLoaderBackendFragmentCompat();
            activity.getSupportFragmentManager().beginTransaction().add(manager, FRAGMENT_TAG).commit();
        }
        return new RxLoaderManager(manager);
    }

    /**
     * Get an instance of {@code RxLoaderManager} that is tied to the lifecycle of the given {@link
     * android.support.v4.app.Fragment}.
     *
     * @param fragment the fragment
     * @return the {@code RxLoaderManager}
     */
    public static RxLoaderManager get(Fragment fragment) {
        RxLoaderBackendNestedFragmentCompat manager = (RxLoaderBackendNestedFragmentCompat) fragment.getChildFragmentManager().findFragmentByTag(FRAGMENT_TAG);
        if (manager == null) {
            manager = new RxLoaderBackendNestedFragmentCompat();
            fragment.getChildFragmentManager().beginTransaction().add(manager, FRAGMENT_TAG).commit();
        }
        return new RxLoaderManager(manager);
    }

}




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