本文整理汇总了Java中com.trello.rxlifecycle2.LifecycleTransformer类的典型用法代码示例。如果您正苦于以下问题:Java LifecycleTransformer类的具体用法?Java LifecycleTransformer怎么用?Java LifecycleTransformer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LifecycleTransformer类属于com.trello.rxlifecycle2包,在下文中一共展示了LifecycleTransformer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindUntilEvent
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
/**
* 绑定 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");
}
}
示例2: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
/**
* 绑定 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");
}
}
示例3: bindUntilLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override public <T>LifecycleTransformer<T> bindUntilLifecycle(FragmentEvent event) {
ActivityEvent activityEvent;
switch (event.name()) {
case "DESTROY_VIEW":
case "DETACH":
activityEvent = ActivityEvent.DESTROY;
break;
default:
activityEvent = ActivityEvent.valueOf(event.name());
break;
}
return view.getUseActivity().bindUntilEvent(activityEvent);
}
示例4: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
public static <T> LifecycleTransformer<T> bindToLifecycle(IView view) {
if (view instanceof LifecycleProvider){
return ((LifecycleProvider)view).bindToLifecycle();
}else {
throw new IllegalArgumentException("view isn't activity or fragment");
}
}
示例5: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
public static <T> LifecycleTransformer<T> bindToLifecycle(IView view) {
if (view instanceof RxAppCompatActivity) {
return ((RxAppCompatActivity) view).bindToLifecycle();
} else if (view instanceof RxFragment) {
return ((RxFragment) view).bindToLifecycle();
} else {
throw new IllegalArgumentException("view isn't activity or fragment");
}
}
示例6: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
//return RxLifecycleAndroid.bindActivity(lifecycleSubject);
return bindUntilEvent(ActivityEvent.DESTROY);
}
示例7: bindUntilEvent
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull ActivityEvent event) {
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
}
示例8: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <T> LifecycleTransformer<T> bindToLifecycle() {
return RxLifecycleAndroid.bindActivity(lifecycleSubject);
}
示例9: RxSchedulers
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
public RxSchedulers(LifecycleTransformer lifecycle){
this.lifecycle=lifecycle;
}
示例10: getInstance
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
public static RxSchedulers getInstance(LifecycleTransformer lifecycle){
return new RxSchedulers(lifecycle);
}
示例11: bindUntilEvent
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <X> LifecycleTransformer<X> bindUntilEvent(@NonNull ControllerEvent event) {
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
}
示例12: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override
@NonNull
@CheckResult
public final <X> LifecycleTransformer<X> bindToLifecycle() {
return RxControllerLifecycle.bindController(lifecycleSubject);
}
示例13: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override public <T>LifecycleTransformer<T> bindToLifecycle() {
return view.getUseActivity().bindToLifecycle();
}
示例14: bindToLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override public <T> LifecycleTransformer<T> bindToLifecycle() {
return view.getUseFragment().bindToLifecycle();
}
示例15: bindUntilLifecycle
import com.trello.rxlifecycle2.LifecycleTransformer; //导入依赖的package包/类
@Override public <T> LifecycleTransformer<T> bindUntilLifecycle(FragmentEvent event) {
return view.getUseFragment().bindUntilEvent(event);
}