本文整理汇总了Java中rx.subscriptions.Subscriptions.from方法的典型用法代码示例。如果您正苦于以下问题:Java Subscriptions.from方法的具体用法?Java Subscriptions.from怎么用?Java Subscriptions.from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.subscriptions.Subscriptions
的用法示例。
在下文中一共展示了Subscriptions.from方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindView
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
private void bindView(int position, @NonNull PlenCodeUnitView view) {
mSubscriptionMap.remove(view);
mSubscriptionMap.remove(position);
PlenCodeUnit unit = getItem(position);
if (isBlankRow(unit)) {
view.bindBlankRow();
return;
}
Subscription subscription = Subscriptions.from(
view.bind(mMotionMap.asObservable().map(m -> m.get(unit.getMotionId())),
Observable.just(unit.getLoopCount())),
view.programUnit().asObservable()
.skipWhile(u -> !Objects.equals(u, unit))
.subscribe(u -> setUnit(position, u)));
mSubscriptionMap.put(view, subscription);
mSubscriptionMap.put(position, subscription);
}
示例2: onResume
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
onPauseSubs = Subscriptions.from();
// refresh if needed
boolean needsRefreshing = !members.hasTotal();
long updatesFromTime;
if (needsRefreshing) {
refresh(true);
updatesFromTime = -1; // if refreshing anyway, no need to observe past events
} else {
updatesFromTime = Math.max(pausedElapsedRealtime, savedElapsedRealtime);
}
// start listening to event broadcasts.
onPauseSubs.add(memberUpdates.observable(updatesFromTime)
// debounce so we don't show snackbar for each update emitted in succession
.debounce(100, TimeUnit.MILLISECONDS)
.observeOn(uiScheduler)
.subscribe(update -> showRefreshBar()));
}
示例3: doEnable
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected void doEnable() {
hudTools.show(hud);
app.getInputManager().addRawInputListener(inputMapper.rawInputListener);
inputSub = Subscriptions.from(
controls.exit.value.subscribe((v) -> {
if (!v) pm.onNext(Pages.Welcome);
})
, inputMapper.last.subscribe((v) -> spawnEvent(v))
, controls.action1.value.subscribe((v) -> action1(v))
, controls.action2.value.subscribe((v) -> action2(v))
, controls.action3.value.subscribe((v) -> action3(v))
, controls.action4.value.subscribe((v) -> action4(v))
, controls.moveX.value.subscribe((v) -> {c4t.speedX = v * 0.5f;})
, controls.moveZ.value.subscribe((v) -> {c4t.speedZ = v * -0.5f;})
);
spawnScene();
}
示例4: onBind
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected Subscription onBind() {
viewModel = viewModelHolder.get();
commentListViewModel = CommentListViewModel.create(getContext());
commentListViewModel.setArticleId(getArticleId());
return Subscriptions.from(
commentListViewModel,
listAdapter.bind(commentListViewModel.items()),
emptyText.bind(commentListViewModel.isEmpty(), RxActions.setVisibility()),
progressBar.bind(commentListViewModel.isLoading(), RxActions.setVisibility()),
authorText.bind(viewModel.authorName(), RxActions.setText()),
authorImage.bind(viewModel.authorThumbnailUrl(), loadThumbnailAction()),
tagList.bind(viewModel.tags())
);
}
示例5: bind
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@NonNull
public Subscription bind(@NonNull Observable<PlenProgram> program) {
return Subscriptions.from(
mMotionMap.bind(program
.map(PlenProgram::getMotionMap)
.filter(map -> !mMotionMap.get().map(map::equals).orElse(false))),
mSequence.bind(program
.map(PlenProgram::getSequence)
.filter(seq -> !seq.equals(stageWithoutBlankRow()))));
}
示例6: bind
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@NonNull
public Subscription bind(@NonNull Observable<PlenMotion> motion, @NonNull Observable<Integer> loopCount) {
setVisibility(VISIBLE);
mLoopCountView.setText(String.valueOf(ReadOnlyProperty.create(loopCount).get()
.orElse(getContext().getResources().getInteger(R.integer.motion_loop_default))));
Subscription subscription = Subscriptions.from(
mPlenMotionView.bind(motion),
mLoopCount.bind(loopCount));
mSubscriptions.add(subscription);
return subscription;
}
示例7: bindBidirectional
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@NonNull
public static <T> Subscription bindBidirectional(@NonNull Property<T> p1, @NonNull Property<T> p2) {
if (p1 == p2) {
return Subscriptions.unsubscribed();
}
Subscription s1 = p1.bind(p2);
Subscription s2 = p2.bind(p1);
return Subscriptions.from(s1, s2);
}
示例8: onCreate
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
subs = Subscriptions.from();
savedElapsedRealtime = -1L;
if (savedInstanceState != null) {
savedElapsedRealtime = savedInstanceState.getLong(EXTRA_ELAPSED_REALTIME, -1L);
}
}
示例9: onConnect
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected Subscription onConnect() {
return Subscriptions.from(super.onConnect(),
channel(SINGLE_RESTARTABLE_ID, DeliveryMethod.SINGLE, new ExampleSingleObservableFactory())
.subscribe(RxNotification.split(
value -> {
log("SINGLE: onNext " + value);
onNext(value);
},
throwable -> log("SINGLE: onError " + throwable))));
}
示例10: onConnect
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected Subscription onConnect() {
return Subscriptions.from(super.onConnect(),
Observable.interval(500, 500, TimeUnit.MILLISECONDS, mainThread())
.subscribe(ignored -> {
StringBuilder builder = new StringBuilder();
builder.append("connections:\n");
for (String key : ReconnectableMap.INSTANCE.keys())
builder.append(key).append("\n");
TextView report = (TextView)findViewById(R.id.stationReport);
report.setText(builder.toString());
}));
}
示例11: onConnect
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected Subscription onConnect() {
return Subscriptions.from(super.onConnect(),
channel(REPLAY_RESTARTABLE_ID, DeliveryMethod.REPLAY, new ExampleReplayObservableFactory())
.subscribe(RxNotification.split(
value -> {
log("REPLAY: onNext " + value);
onNext(value);
},
throwable -> log("REPLAY: onError " + throwable))));
}
示例12: onConnect
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected Subscription onConnect() {
return Subscriptions.from(super.onConnect(),
channel(CHANNEL_ID, DeliveryMethod.LATEST, new ExampleCacheObservableFactory())
.subscribe(RxNotification.split(
value -> {
log("CACHE: onNext " + value);
onNext(value);
},
throwable -> log("CACHE: onError " + throwable))));
}
示例13: doEnable
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected void doEnable() {
prevCursorVisible = app.getInputManager().isCursorVisible();
app.getInputManager().setCursorVisible(true);
app.getInputManager().addRawInputListener(inputMapper.rawInputListener);
hudTools.show(hud);
FxPlatformExecutor.runOnFxApplication(() -> {
HudWelcome p = hud.controller;
p.play.onActionProperty().set((v) -> {
app.enqueue(()-> {
pm.onNext(Pages.InGame);
return true;
});
});
p.settings.onActionProperty().set((v) -> {
app.enqueue(()-> {
pm.onNext(Pages.Settings);
return true;
});
});
p.quit.onActionProperty().set((v) -> {
app.enqueue(()->{
app.stop();
return true;
});
});
});
inputSub = Subscriptions.from(
commands.exit.value.subscribe((v) -> {
if (!v) hud.controller.quit.fire();
})
);
}
示例14: onBind
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected Subscription onBind() {
return Subscriptions.from(
viewModel,
listAdapter.bind(viewModel.items()),
progressBar.bind(viewModel.isLoading(), RxActions.setVisibility())
);
}
示例15: onBind
import rx.subscriptions.Subscriptions; //导入方法依赖的package包/类
@Override
protected Subscription onBind() {
viewModel = viewModelHolder.get();
return Subscriptions.from(
viewModel,
webView.bind(viewModel.contentHtml(), RxActions.loadDataWithBaseURL()),
progressBar.bind(isLoading, RxActions.setVisibility())
);
}