com.trello.rxlifecycle2.LifecycleTransformer Java Examples

The following examples show how to use com.trello.rxlifecycle2.LifecycleTransformer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RxLifecycleUtils.java    From MVPArms with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定 Activity 的指定生命周期
 *
 * @param view
 * @param event
 * @param <T>
 * @return
 */
public static <T> LifecycleTransformer<T> bindUntilEvent(@NonNull final IView view,
                                                         final ActivityEvent event) {
    Preconditions.checkNotNull(view, "view == null");
    if (view instanceof ActivityLifecycleable) {
        return bindUntilEvent((ActivityLifecycleable) view, event);
    } else {
        throw new IllegalArgumentException("view isn't ActivityLifecycleable");
    }
}
 
Example #2
Source File: RxLifecycleUtils.java    From MVPArms with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定 Fragment 的指定生命周期
 *
 * @param view
 * @param event
 * @param <T>
 * @return
 */
public static <T> LifecycleTransformer<T> bindUntilEvent(@NonNull final IView view,
                                                         final FragmentEvent event) {
    Preconditions.checkNotNull(view, "view == null");
    if (view instanceof FragmentLifecycleable) {
        return bindUntilEvent((FragmentLifecycleable) view, event);
    } else {
        throw new IllegalArgumentException("view isn't FragmentLifecycleable");
    }
}
 
Example #3
Source File: RxLifecycleUtils.java    From Aurora with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定 Activity 的指定生命周期
 *
 * @param view
 * @param event
 * @param <T>
 * @return
 */
public static <T> LifecycleTransformer<T> bindUntilEvent(@NonNull final IView view,
                                                         final ActivityEvent event) {
    Preconditions.checkNotNull(view, "view == null");
    if (view instanceof ActivityLifecycleable) {
        return bindUntilEvent((ActivityLifecycleable) view, event);
    } else {
        throw new IllegalArgumentException("view isn't ActivityLifecycleable");
    }
}
 
Example #4
Source File: RxLifecycleUtils.java    From Aurora with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定 Fragment 的指定生命周期
 *
 * @param view
 * @param event
 * @param <T>
 * @return
 */
public static <T> LifecycleTransformer<T> bindUntilEvent(@NonNull final IView view,
                                                         final FragmentEvent event) {
    Preconditions.checkNotNull(view, "view == null");
    if (view instanceof FragmentLifecycleable) {
        return bindUntilEvent((FragmentLifecycleable) view, event);
    } else {
        throw new IllegalArgumentException("view isn't FragmentLifecycleable");
    }
}
 
Example #5
Source File: RxLifecycleActivity.java    From JianshuApp with GNU General Public License v3.0 5 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
    //return RxLifecycleAndroid.bindActivity(lifecycleSubject);
    return bindUntilEvent(ActivityEvent.DESTROY);
}
 
Example #6
Source File: RxLifecycleUtils.java    From Aurora with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定 Activity/Fragment 的生命周期
 *
 * @param view
 * @param <T>
 * @return
 */
public static <T> LifecycleTransformer<T> bindToLifecycle(@NonNull IView view) {
    Preconditions.checkNotNull(view, "view == null");
    if (view instanceof Lifecycleable) {
        return bindToLifecycle((Lifecycleable) view);
    } else {
        throw new IllegalArgumentException("view isn't Lifecycleable");
    }
}
 
Example #7
Source File: RxLifecycleUtils.java    From Aurora with Apache License 2.0 5 votes vote down vote up
public static <T> LifecycleTransformer<T> bindToLifecycle(@NonNull Lifecycleable lifecycleable) {
    Preconditions.checkNotNull(lifecycleable, "lifecycleable == null");
    if (lifecycleable instanceof ActivityLifecycleable) {
        return RxLifecycleAndroid.bindActivity(((ActivityLifecycleable) lifecycleable).provideLifecycleSubject());
    } else if (lifecycleable instanceof FragmentLifecycleable) {
        return RxLifecycleAndroid.bindFragment(((FragmentLifecycleable) lifecycleable).provideLifecycleSubject());
    } else {
        throw new IllegalArgumentException("Lifecycleable not match");
    }
}
 
Example #8
Source File: RxLifecycleUtils.java    From MVPArms with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定 Activity/Fragment 的生命周期
 *
 * @param view
 * @param <T>
 * @return
 */
public static <T> LifecycleTransformer<T> bindToLifecycle(@NonNull IView view) {
    Preconditions.checkNotNull(view, "view == null");
    if (view instanceof Lifecycleable) {
        return bindToLifecycle((Lifecycleable) view);
    } else {
        throw new IllegalArgumentException("view isn't Lifecycleable");
    }
}
 
Example #9
Source File: RxLifecycleUtils.java    From MVPArms with Apache License 2.0 5 votes vote down vote up
public static <T> LifecycleTransformer<T> bindToLifecycle(@NonNull Lifecycleable lifecycleable) {
    Preconditions.checkNotNull(lifecycleable, "lifecycleable == null");
    if (lifecycleable instanceof ActivityLifecycleable) {
        return RxLifecycleAndroid.bindActivity(((ActivityLifecycleable) lifecycleable).provideLifecycleSubject());
    } else if (lifecycleable instanceof FragmentLifecycleable) {
        return RxLifecycleAndroid.bindFragment(((FragmentLifecycleable) lifecycleable).provideLifecycleSubject());
    } else {
        throw new IllegalArgumentException("Lifecycleable not match");
    }
}
 
Example #10
Source File: RxUtils.java    From AndroidBase with Apache License 2.0 5 votes vote down vote up
public static <T> LifecycleTransformer<T> bindToLifecycle(IView view) {
    if (view instanceof BaseActivity) {
        return ((BaseActivity) view).<T>bindToLifecycle();
    } else if (view instanceof BaseFragment) {
        return ((BaseFragment) view).<T>bindToLifecycle();
    } else {
        throw new IllegalArgumentException("view isn't activity or fragment");
    }

}
 
Example #11
Source File: SuperActivity.java    From AndroidBase with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
    return RxLifecycleAndroid.bindActivity(mLifecycleSubject);
}
 
Example #12
Source File: RxLifecycleUtils.java    From MVPArms with Apache License 2.0 4 votes vote down vote up
public static <T, R> LifecycleTransformer<T> bindUntilEvent(@NonNull final Lifecycleable<R> lifecycleable,
                                                            final R event) {
    Preconditions.checkNotNull(lifecycleable, "lifecycleable == null");
    return RxLifecycle.bindUntilEvent(lifecycleable.provideLifecycleSubject(), event);
}
 
Example #13
Source File: SuperFragment.java    From AndroidBase with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull FragmentEvent event) {
    return RxLifecycle.bindUntilEvent(mLifecycleSubject, event);
}
 
Example #14
Source File: SuperFragment.java    From AndroidBase with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
    return RxLifecycleAndroid.bindFragment(mLifecycleSubject);
}
 
Example #15
Source File: SuperActivity.java    From AndroidBase with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull ActivityEvent event) {
    return RxLifecycle.bindUntilEvent(mLifecycleSubject, event);
}
 
Example #16
Source File: BaseFragment.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull FragmentEvent event) {
    return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
}
 
Example #17
Source File: RxLifecycleActivity.java    From JianshuApp with GNU General Public License v3.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull ActivityEvent event) {
    return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
}
 
Example #18
Source File: RxLifecycleProvider.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 4 votes vote down vote up
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull FragmentEvent event) {
    return RxLifecycle.bindUntilEvent(mLifecycleSubject, event);
}
 
Example #19
Source File: RxLifecycleProvider.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 4 votes vote down vote up
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
    return RxLifecycleAndroid.bindFragment(mLifecycleSubject);
}
 
Example #20
Source File: BaseFragment.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
    return RxLifecycleAndroid.bindFragment(lifecycleSubject);
}
 
Example #21
Source File: BaseDialogFragment.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
    return RxLifecycleAndroid.bindFragment(lifecycleSubject);
}
 
Example #22
Source File: BaseDialogFragment.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull FragmentEvent event) {
    return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
}
 
Example #23
Source File: BaseActivity.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
    return RxLifecycleAndroid.bindActivity(lifecycleSubject);
}
 
Example #24
Source File: BaseActivity.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
/**
 * notify subscriber once {@link #finish()} has been called
 */
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilFinish() {
    return RxLifecycle.bindUntilEvent(finishSubject, finishSignal);
}
 
Example #25
Source File: BaseActivity.java    From QuickDevFramework with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull ActivityEvent event) {
    return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
}
 
Example #26
Source File: SimpleRequestTransformer.java    From My-MVP with Apache License 2.0 4 votes vote down vote up
public SimpleRequestTransformer(LifecycleTransformer<T> lifecycleTransformer) {
    mLifecycleTransformer = lifecycleTransformer;
}
 
Example #27
Source File: SimpleRequestResponseTransformer.java    From My-MVP with Apache License 2.0 4 votes vote down vote up
public SimpleRequestResponseTransformer(LifecycleTransformer<Response<T>> lifecycleTransformer) {
    mLifecycleTransformer = lifecycleTransformer;
}
 
Example #28
Source File: RxLifecycleUtils.java    From Aurora with Apache License 2.0 4 votes vote down vote up
public static <T, R> LifecycleTransformer<T> bindUntilEvent(@NonNull final Lifecycleable<R> lifecycleable,
                                                            final R event) {
    Preconditions.checkNotNull(lifecycleable, "lifecycleable == null");
    return RxLifecycle.bindUntilEvent(lifecycleable.provideLifecycleSubject(), event);
}
 
Example #29
Source File: BaseLazyFragment.java    From Readhub with Apache License 2.0 4 votes vote down vote up
@Override
public <T> LifecycleTransformer<T> bindToLife() {
    return this.<T>bindToLifecycle();
}
 
Example #30
Source File: RxUtils.java    From MVPArms with Apache License 2.0 2 votes vote down vote up
/**
 * 此方法已废弃
 *
 * @param view
 * @param <T>
 * @return
 * @see RxLifecycleUtils 此类可以实现 {@link RxLifecycle} 的所有功能, 使用方法和之前一致
 * @deprecated Use {@link RxLifecycleUtils#bindToLifecycle(IView)} instead
 */
@Deprecated
public static <T> LifecycleTransformer<T> bindToLifecycle(IView view) {
    return RxLifecycleUtils.bindToLifecycle(view);
}