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


Java CompositeSubscription类代码示例

本文整理汇总了Java中rx.subscriptions.CompositeSubscription的典型用法代码示例。如果您正苦于以下问题:Java CompositeSubscription类的具体用法?Java CompositeSubscription怎么用?Java CompositeSubscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompositeSubscription类属于rx.subscriptions包,在下文中一共展示了CompositeSubscription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例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: disconnect

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
private Subscription disconnect(final CompositeSubscription current) {
    return Subscriptions.create(new Action0() {
        public void call() {
            OnSubscribeRefCount.this.lock.lock();
            try {
                if (OnSubscribeRefCount.this.baseSubscription == current && OnSubscribeRefCount.this.subscriptionCount.decrementAndGet() == 0) {
                    OnSubscribeRefCount.this.baseSubscription.unsubscribe();
                    OnSubscribeRefCount.this.baseSubscription = new CompositeSubscription();
                }
                OnSubscribeRefCount.this.lock.unlock();
            } catch (Throwable th) {
                OnSubscribeRefCount.this.lock.unlock();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:OnSubscribeRefCount.java

示例5: onCreate

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Utils.logD(LOG_TAG, "onCreate");

    mSharedPreferences = new PreferencesManagerImp(getActivity().getApplicationContext());
    mLocation = mSharedPreferences.getLocation();
    if (savedInstanceState != null) {
        mRotation = true;
    }
    LoaderProvider loaderProvider = new LoaderProvider(getContext());
    LoaderManager loaderManager = getLoaderManager();
    Geocoder geocoder = new Geocoder(getActivity());
    // loaderManager.enableDebugLogging(true);
    mPresenter = new FindPresenter(mLocation, loaderManager, loaderProvider, geocoder);

    setHasOptionsMenu(true);
    mRecentSearchSuggestions = new SearchRecentSuggestions(getContext(),
            RecentSuggestionsProvider.AUTHORITY, RecentSuggestionsProvider.MODE);
    mCompositeSubscription = new CompositeSubscription();
    mActivityCoordinator = (CoordinatorLayout) getActivity().findViewById(R.id.coordinator);
    mSnackCoordinator = (CoordinatorLayout) getActivity().findViewById(R.id.coordinatorSnackContainer);
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:24,代码来源:FindFragment.java

示例6: ResolveInfosPresenter

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
public ResolveInfosPresenter(@NonNull V view,
                             @NonNull BaseSchedulerProvider schedulerProvider,
                             @NonNull ActionConfig actionConfig,
                             @NonNull ResolveInfosRepository resolveInfosRepository) {
    if (view == null) {
        throw new NullPointerException("view == null");
    }
    if (schedulerProvider == null) {
        throw new NullPointerException("schedulerProvider == null");
    }
    if (actionConfig == null) {
        throw new NullPointerException("actionConfig == null");
    }

    if (resolveInfosRepository == null) {
        throw new NullPointerException("resolveInfosRepository == null");
    }
    mView = view;
    mSubscriptions = new CompositeSubscription();
    mSchedulerProvider = schedulerProvider;
    mActionConfig = actionConfig;
    mResolveInfosRepository = resolveInfosRepository;

    mView.setPresenter(this);
}
 
开发者ID:JulianAndroid,项目名称:AppChooser,代码行数:26,代码来源:ResolveInfosPresenter.java

示例7: CachedWorkerPool

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
CachedWorkerPool(long keepAliveTime, TimeUnit unit) {
    this.keepAliveTime = unit != null ? unit.toNanos(keepAliveTime) : 0;
    this.expiringWorkerQueue = new ConcurrentLinkedQueue();
    this.allWorkers = new CompositeSubscription();
    ScheduledExecutorService evictor = null;
    Future<?> task = null;
    if (unit != null) {
        evictor = Executors.newScheduledThreadPool(1, CachedThreadScheduler.EVICTOR_THREAD_FACTORY);
        NewThreadWorker.tryEnableCancelPolicy(evictor);
        task = evictor.scheduleWithFixedDelay(new Runnable() {
            public void run() {
                CachedWorkerPool.this.evictExpiredWorkers();
            }
        }, this.keepAliveTime, this.keepAliveTime, TimeUnit.NANOSECONDS);
    }
    this.evictorService = evictor;
    this.evictorTask = task;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:CachedThreadScheduler.java

示例8: 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

示例9: doSubscribe

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
void doSubscribe(final Subscriber<? super T> subscriber, final CompositeSubscription currentBase) {
    subscriber.add(disconnect(currentBase));
    this.source.unsafeSubscribe(new Subscriber<T>(subscriber) {
        public void onError(Throwable e) {
            cleanup();
            subscriber.onError(e);
        }

        public void onNext(T t) {
            subscriber.onNext(t);
        }

        public void onCompleted() {
            cleanup();
            subscriber.onCompleted();
        }

        void cleanup() {
            OnSubscribeRefCount.this.lock.lock();
            try {
                if (OnSubscribeRefCount.this.baseSubscription == currentBase) {
                    OnSubscribeRefCount.this.baseSubscription.unsubscribe();
                    OnSubscribeRefCount.this.baseSubscription = new CompositeSubscription();
                    OnSubscribeRefCount.this.subscriptionCount.set(0);
                }
                OnSubscribeRefCount.this.lock.unlock();
            } catch (Throwable th) {
                OnSubscribeRefCount.this.lock.unlock();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:33,代码来源:OnSubscribeRefCount.java

示例10: onCreate

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSubscriptions = new CompositeSubscription();
    mStories = new ArrayList<>();
    mDataManager = HackerNewsApplication.get(getActivity()).getComponent().dataManager();
    Bundle bundle = getArguments();
    if (bundle != null) mUser = bundle.getString(ARG_USER, null);
    mPostAdapter = new PostAdapter(getActivity(), mUser != null);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:StoriesFragment.java

示例11: onCreate

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_comments);
    ButterKnife.bind(this);
    mPost = getIntent().getParcelableExtra(EXTRA_POST);
    if (mPost == null) throw new IllegalArgumentException("CommentsActivity requires a Post object!");
    mDataManager = HackerNewsApplication.get(this).getComponent().dataManager();
    mSubscriptions = new CompositeSubscription();
    mComments = new ArrayList<>();
    setupToolbar();
    setupRecyclerView();
    loadStoriesIfNetworkConnected();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:CommentsActivity.java

示例12: 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

示例13: CityManagerPresenter

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
@Inject
CityManagerPresenter(Context context, CityManagerContract.View view) {

    this.view = view;
    this.subscriptions = new CompositeSubscription();
    view.setPresenter(this);

    DaggerPresenterComponent.builder()
            .applicationModule(new ApplicationModule(context))
            .build().inject(this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:CityManagerPresenter.java

示例14: SelectCityPresenter

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
@Inject
SelectCityPresenter(Context context, SelectCityContract.View view) {

    this.cityListView = view;
    this.subscriptions = new CompositeSubscription();
    cityListView.setPresenter(this);

    DaggerPresenterComponent.builder()
            .applicationModule(new ApplicationModule(context))
            .build().inject(this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:SelectCityPresenter.java

示例15: HomePagePresenter

import rx.subscriptions.CompositeSubscription; //导入依赖的package包/类
@Inject
HomePagePresenter(Context context, HomePageContract.View view) {

    this.context = context;
    this.weatherView = view;
    this.subscriptions = new CompositeSubscription();
    weatherView.setPresenter(this);

    DaggerPresenterComponent.builder()
            .applicationModule(new ApplicationModule(context))
            .build().inject(this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:HomePagePresenter.java


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