/**
* NOTE: This throws a NoSuchElementException if the item is filtered out since a Single can't be empty, so the
* onError is called after onDestroy() when using Single().
*
* @param upstream
* @return
*/
@Override
public SingleSource<T> apply(Single<T> upstream) {
Single<T> transformedStream = upstream
.cache() // Cache to replay emitted values to late subscriber
.filter(filterIfDestroyedPredicate) // Filter to stop emitting items once LifecycleOwner is destroyed
.toSingle();
setReactiveType((R)transformedStream);
return transformedStream;
}
LifecycleTransformer.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:LifecycleAwareRx
作者:
评论列表
文章目录