本文整理汇总了Java中com.jakewharton.rxrelay2.PublishRelay类的典型用法代码示例。如果您正苦于以下问题:Java PublishRelay类的具体用法?Java PublishRelay怎么用?Java PublishRelay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PublishRelay类属于com.jakewharton.rxrelay2包,在下文中一共展示了PublishRelay类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DiffRequestManager
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
/**
* Constructs a new instance of {@link DiffRequestManager} with injected parameters.
*
* @param adapter {@link RecyclerView.Adapter} that will be automatically updated and notified about the data changes. Note: the given adapter must implement {@link Swappable} interface.
* @param tag A {@link String} that represents a unique identifier of the manager.
* @param relay {@link Relay}.
* @param compositeDisposable Inject {@link CompositeDisposable}.
* @throws NullPointerException If the tag, composite disposable or relay is null.
* @throws IllegalArgumentException If the tag is empty.
*/
public DiffRequestManager(@Nullable final A adapter,
@NonNull final String tag,
@NonNull final PublishRelay<RxDiffResult> relay,
@NonNull final CompositeDisposable compositeDisposable) {
checkNotNull(adapter, "adapter must not be null!");
checkNotNull(tag, "tag must not be null!");
checkArgument(!tag.isEmpty(), "tag string must not be empty!");
checkNotNull(relay, "relay must not be null!");
checkNotNull(compositeDisposable, "compositeDisposable must not be null!");
this.mAdapterWeakRef = new WeakReference<>(adapter);
this.mTag = tag;
this.mRelay = relay;
this.mCompositeDisposable = compositeDisposable;
}
示例2: setup
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
@Before
public void setup() {
mRxDiffResult = new RxDiffResult(TEST_TAG, mDiffResult);
mDiffRequest = new DiffRequest<>(true, TEST_TAG, mNewData, mCallback);
mDiffRequestManager = new DiffRequestManager<>(mTestAdapter, TEST_TAG, PublishRelay.<RxDiffResult>create(), mCompositeDisposable);
mDiffRequestManager.setDiffResultSubscriber(mDiffResultSubscriber);
}
示例3: receive_WhenNoObservers_CachesResult
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
@Test
public void receive_WhenNoObservers_CachesResult() {
// Given
final Relay mockRelay = mock(PublishRelay.class);
given(mockRelay.hasObservers()).willReturn(false);
// When
mDiffRequestManager.receive(mRxDiffResult);
// Then
assertThat(mDiffRequestManager.getCachedResultForSubscription(), notNullValue());
}
示例4: getStubbedDiffRequestManager
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
public static DiffRequestManager<TestModel, TestAdapter<TestModel>> getStubbedDiffRequestManager() {
return new DiffRequestManager<>(new TestAdapter<TestModel>(),
TEST_TAG,
PublishRelay.<RxDiffResult>create(),
new CompositeDisposable());
}
示例5: RxBus
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
/**
* Constructor.
*
* @since 2017/11/11
*/
public RxBus() {
// Subject that, once an Observer has subscribed,
// emits all subsequently observed items to the subscriber.
// PublishRelay is not thread-safe,
// PublishRelay need to be converted into SerializedSubject
this.mBus = PublishRelay.create().toSerialized();
}
示例6: RxBus
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
public RxBus() {
this.mBus = PublishRelay.create().toSerialized();
}
示例7: AbstractStore
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
public AbstractStore() {
mStateChangedRelay = PublishRelay.create();
mStateChangedObservable = mStateChangedRelay.serialize();
}
示例8: RxBus
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
private RxBus() {
//need private constructor
relayBus = PublishRelay.create().toSerialized();
flowableBus = PublishProcessor.create().toSerialized();
}
示例9: SyncCommentRxBus
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
private SyncCommentRxBus() {
relay = PublishRelay.create();
}
示例10: RxBus
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
private RxBus() {
bus = PublishRelay.create().toSerialized();
}
示例11: create
import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
/**
* Creates a new instance of {@link DiffRequestManager}.
*
* @param adapter {@link RecyclerView.Adapter}.
* @param tag A {@link String} identifying this manager.
* @param <D> Diff request data type.
* @param <A> The {@link RecyclerView.Adapter} type.
* @return {@link DiffRequestManager}.
*/
@SuppressWarnings("UnnecessaryLocalVariable")
@NonNull
public static <D, A extends RecyclerView.Adapter & Swappable<D>> DiffRequestManager<D, A> create(@NonNull final A adapter, @NonNull final String tag) {
final DiffRequestManager<D, A> diffRequestManager = new DiffRequestManager<>(adapter, tag, PublishRelay.<RxDiffResult>create(), new CompositeDisposable());
return diffRequestManager;
}