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


Java CompositeSubscription.add方法代码示例

本文整理汇总了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();
                }
            }));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:PlacesResultActivity.java

示例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);
}
 
开发者ID:WeDevelopTeam,项目名称:HeroVideo-master,代码行数:22,代码来源:BannerView.java

示例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);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:22,代码来源:BannerView.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:OperatorWindowWithStartEndObservable.java

示例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);
            })
    );
}
 
开发者ID:Bruno125,项目名称:Unofficial-Ups,代码行数:14,代码来源:LoginActivity.java

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

示例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);
        }
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:11,代码来源:RxBusManager.java

示例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);
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:32,代码来源:EventFind.java

示例9: onStart

import rx.subscriptions.CompositeSubscription; //导入方法依赖的package包/类
@Override
protected void onStart() {
    super.onStart();
    subscriptions = new CompositeSubscription();
    subscriptions.add(subscribeMyProfileUpdate());
    subscriptions.add(subscribeFavEvents());
    showQiitaItemsFragment();
}
 
开发者ID:sumio,项目名称:espresso-sample-for-droidkaigi2017,代码行数:9,代码来源:MainActivity.java

示例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);
  }));
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:9,代码来源:DebugViewContainer.java

示例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);
  }));
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:9,代码来源:DebugViewContainer.java

示例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));
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:11,代码来源:LogsDialog.java

示例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);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:20,代码来源:RxFingerPrinter.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:NewThreadWorker.java


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