當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。