com.pushtorefresh.storio.internal.ChangesBus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Modern API for SQLiteDatabase and ContentResolver
package com.pushtorefresh.storio.internal;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import rx.Observable;
/**
* FOR INTERNAL USAGE ONLY.
*
* Thread-safe changes bus.
*/
public final class ChangesBus {
@Nullable
private final RxChangesBus rxChangesBus;
public ChangesBus(boolean rxJavaIsInTheClassPath) {
rxChangesBus = rxJavaIsInTheClassPath
? new RxChangesBus()
: null;
}
public void onNext(@NonNull T next) {
if (rxChangesBus != null) {
rxChangesBus.onNext(next);
}
}
@Nullable
public Observable asObservable() {
return rxChangesBus != null
? rxChangesBus.asObservable()
: null;
}
}