当前位置: 首页>>代码示例>>Java>>正文


Java PublishRelay类代码示例

本文整理汇总了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;
}
 
开发者ID:storix,项目名称:RxDiffUtil,代码行数:26,代码来源:DiffRequestManager.java

示例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);
}
 
开发者ID:storix,项目名称:RxDiffUtil,代码行数:8,代码来源:DiffRequestManagerRoboTest.java

示例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());
}
 
开发者ID:storix,项目名称:RxDiffUtil,代码行数:13,代码来源:DiffRequestManagerRoboTest.java

示例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());
    }
 
开发者ID:storix,项目名称:RxDiffUtil,代码行数:8,代码来源:MockitoUtils.java

示例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();
}
 
开发者ID:winzillion,项目名称:FluxJava,代码行数:13,代码来源:RxBus.java

示例6: RxBus

import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
public RxBus() {
    this.mBus = PublishRelay.create().toSerialized();
}
 
开发者ID:AnnyBaby,项目名称:Mvp-Retrofit-Rxjava-Rxbus,代码行数:4,代码来源:RxBus.java

示例7: AbstractStore

import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
public AbstractStore() {
    mStateChangedRelay = PublishRelay.create();
    mStateChangedObservable = mStateChangedRelay.serialize();
}
 
开发者ID:ReactiveMVP,项目名称:reduxj,代码行数:5,代码来源:AbstractStore.java

示例8: RxBus

import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
private RxBus() {
    //need private constructor
    relayBus = PublishRelay.create().toSerialized();
    flowableBus = PublishProcessor.create().toSerialized();
}
 
开发者ID:miguoer,项目名称:ApplicationCollention,代码行数:6,代码来源:RxBus.java

示例9: SyncCommentRxBus

import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
private SyncCommentRxBus() {
    relay = PublishRelay.create();
}
 
开发者ID:jshvarts,项目名称:OfflineSampleApp,代码行数:4,代码来源:SyncCommentRxBus.java

示例10: RxBus

import com.jakewharton.rxrelay2.PublishRelay; //导入依赖的package包/类
private RxBus() {
    bus = PublishRelay.create().toSerialized();
}
 
开发者ID:nowandfurure,项目名称:richeditor,代码行数:4,代码来源:RxBus.java

示例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;
}
 
开发者ID:storix,项目名称:RxDiffUtil,代码行数:16,代码来源:DiffRequestManager.java


注:本文中的com.jakewharton.rxrelay2.PublishRelay类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。