本文整理汇总了Java中rx.subscriptions.CompositeSubscription.add方法的典型用法代码示例。如果您正苦于以下问题:Java CompositeSubscription.add方法的具体用法?Java CompositeSubscription.add怎么用?Java CompositeSubscription.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.subscriptions.CompositeSubscription
的用法示例。
在下文中一共展示了CompositeSubscription.add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLocationPermissionGranted
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
@Override
protected void onLocationPermissionGranted() {
compositeSubscription = new CompositeSubscription();
compositeSubscription.add(reactiveLocationProvider.getPlaceById(placeId)
.subscribe(new Action1<PlaceBuffer>() {
@Override
public void call(PlaceBuffer buffer) {
Place place = buffer.get(0);
if (place != null) {
placeNameView.setText(place.getName());
placeLocationView.setText(place.getLatLng().latitude + ", " + place.getLatLng().longitude);
placeAddressView.setText(place.getAddress());
}
buffer.release();
}
}));
}
示例2: startScroll
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
/**
* 图片开始轮播
*/
private void startScroll()
{
compositeSubscription = new CompositeSubscription();
isStopScroll = false;
Subscription subscription = Observable.timer(delayTime, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> {
if (isStopScroll)
return;
isStopScroll = true;
viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
});
compositeSubscription.add(subscription);
}
示例3: startScroll
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
/**
* 图片开始轮播
*/
private void startScroll() {
compositeSubscription = new CompositeSubscription();
isStopScroll = false;
Subscription subscription = Observable.timer(delayTime, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> {
if (isStopScroll) {
return;
}
isStopScroll = true;
viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
});
compositeSubscription.add(subscription);
}
示例4: call
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super Observable<T>> child) {
CompositeSubscription csub = new CompositeSubscription();
child.add(csub);
final SourceSubscriber sub = new SourceSubscriber(child, csub);
Subscriber<U> open = new Subscriber<U>() {
public void onStart() {
request(Long.MAX_VALUE);
}
public void onNext(U t) {
sub.beginWindow(t);
}
public void onError(Throwable e) {
sub.onError(e);
}
public void onCompleted() {
sub.onCompleted();
}
};
csub.add(sub);
csub.add(open);
this.windowOpenings.unsafeSubscribe(open);
return sub;
}
示例5: bind
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
private void bind(){
mSubscription = new CompositeSubscription();
mSubscription.add(mViewModel.verifyState()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(verified -> { // Token is provided
if(verified)
redirectToHome();
else
displayWarning(true);
})
);
}
示例6: addSubscription
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
/**
* 保存订阅后的subscription
* @param o
* @param subscription
*/
public void addSubscription(Object o, Subscription subscription) {
if (mSubscriptionMap == null) {
mSubscriptionMap = new HashMap<>();
}
String key = o.getClass().getName();
if (mSubscriptionMap.get(key) != null) {
mSubscriptionMap.get(key).add(subscription);
} else {
CompositeSubscription compositeSubscription = new CompositeSubscription();
compositeSubscription.add(subscription);
mSubscriptionMap.put(key, compositeSubscription);
}
}
示例7: addSubscription
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
public void addSubscription(Object object, Subscription subscription) {
String name = object.getClass().getName();
if (mSubscriptionMap.get(name) == null) {
CompositeSubscription compositeSubscription = new CompositeSubscription();
compositeSubscription.add(subscription);
mSubscriptionMap.put(name, compositeSubscription);
} else {
mSubscriptionMap.get(name).add(subscription);
}
}
示例8: findAnnotatedMethods
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
private static EventComposite findAnnotatedMethods(Object listenerClass, Set<EventSubscriber> subscriberMethods,
CompositeSubscription compositeSubscription) {
for (Method method : listenerClass.getClass().getDeclaredMethods()) {
if (method.isBridge()) {
continue;
}
if (method.isAnnotationPresent(EventSubscribe.class)) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length != 1) {
throw new IllegalArgumentException("Method " + method + " has @Subscribe annotation but requires " + parameterTypes
.length + " arguments. Methods must require a single argument.");
}
Class<?> parameterClazz = parameterTypes[0];
if ((method.getModifiers() & Modifier.PUBLIC) == 0) {
throw new IllegalArgumentException("Method " + method + " has @EventSubscribe annotation on " + parameterClazz + " " +
"but is not 'public'.");
}
EventSubscribe annotation = method.getAnnotation(EventSubscribe.class);
EventThread thread = annotation.thread();
EventSubscriber subscriberEvent = new EventSubscriber(listenerClass, method, thread);
if (!subscriberMethods.contains(subscriberEvent)) {
subscriberMethods.add(subscriberEvent);
compositeSubscription.add(subscriberEvent.getSubscription());
}
}
}
return new EventComposite(compositeSubscription, listenerClass, subscriberMethods);
}
示例9: onStart
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
subscriptions = new CompositeSubscription();
subscriptions.add(subscribeMyProfileUpdate());
subscriptions.add(subscribeFavEvents());
showQiitaItemsFragment();
}
示例10: setupMadge
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
private void setupMadge(final ViewHolder viewHolder, CompositeSubscription subscriptions) {
subscriptions.add(pixelGridEnabled.asObservable().subscribe(enabled -> {
viewHolder.madgeFrameLayout.setOverlayEnabled(enabled);
}));
subscriptions.add(pixelRatioEnabled.asObservable().subscribe(enabled -> {
viewHolder.madgeFrameLayout.setOverlayRatioEnabled(enabled);
}));
}
示例11: setupScalpel
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
private void setupScalpel(final ViewHolder viewHolder, CompositeSubscription subscriptions) {
subscriptions.add(scalpelEnabled.asObservable().subscribe(enabled -> {
viewHolder.content.setLayerInteractionEnabled(enabled);
}));
subscriptions.add(scalpelWireframeEnabled.asObservable().subscribe(enabled -> {
viewHolder.content.setDrawViews(!enabled);
}));
}
示例12: onStart
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
@Override protected void onStart() {
super.onStart();
adapter.setLogs(lumberYard.bufferedLogs());
subscriptions = new CompositeSubscription();
subscriptions.add(lumberYard.logs() //
.observeOn(AndroidSchedulers.mainThread()) //
.subscribe(adapter));
}
示例13: addSubscription
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
/**
* 保存订阅后的subscription
*
* @param o
* @param subscription
*/
public void addSubscription(Object o, Subscription subscription) {
if (mSubscriptionMap == null) {
mSubscriptionMap = new HashMap<>();
}
String key = o.getClass().getName();
if (mSubscriptionMap.get(key) != null) {
mSubscriptionMap.get(key).add(subscription);
} else {
CompositeSubscription compositeSubscription = new CompositeSubscription();
compositeSubscription.add(subscription);
mSubscriptionMap.put(key, compositeSubscription);
}
}
示例14: scheduleActual
import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
public ScheduledAction scheduleActual(Action0 action, long delayTime, TimeUnit unit, CompositeSubscription parent) {
Future f;
ScheduledAction run = new ScheduledAction(this.schedulersHook.onSchedule(action), parent);
parent.add(run);
if (delayTime <= 0) {
f = this.executor.submit(run);
} else {
f = this.executor.schedule(run, delayTime, unit);
}
run.add(f);
return run;
}