當前位置: 首頁>>代碼示例>>Java>>正文


Java Subscriptions.from方法代碼示例

本文整理匯總了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);
}
 
開發者ID:plenprojectcompany,項目名稱:plen-Scenography_Android,代碼行數:19,代碼來源:PlenProgramAdapter.java

示例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()));
}
 
開發者ID:meetup,項目名稱:DataSyncDemo,代碼行數:22,代碼來源:ViewMembers.java

示例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();
}
 
開發者ID:davidB,項目名稱:jme3_skel,代碼行數:20,代碼來源:PageInGame.java

示例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())
  );
}
 
開發者ID:ogaclejapan,項目名稱:Qiitanium,代碼行數:17,代碼來源:ArticleAboutFragment.java

示例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()))));
}
 
開發者ID:plenprojectcompany,項目名稱:plen-Scenography_Android,代碼行數:11,代碼來源:PlenProgramAdapter.java

示例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;
}
 
開發者ID:plenprojectcompany,項目名稱:plen-Scenography_Android,代碼行數:15,代碼來源:PlenCodeUnitView.java

示例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);
}
 
開發者ID:plenprojectcompany,項目名稱:plen-Scenography_Android,代碼行數:10,代碼來源:Property.java

示例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);
    }
}
 
開發者ID:meetup,項目名稱:DataSyncDemo,代碼行數:10,代碼來源:BaseActivity.java

示例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))));
}
 
開發者ID:konmik,項目名稱:satellite,代碼行數:13,代碼來源:SingleConnectionActivity.java

示例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());
            }));
}
 
開發者ID:konmik,項目名稱:satellite,代碼行數:15,代碼來源:BaseLaunchActivity.java

示例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))));
}
 
開發者ID:konmik,項目名稱:satellite,代碼行數:13,代碼來源:ReplayConnectionActivity.java

示例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))));
}
 
開發者ID:konmik,項目名稱:satellite,代碼行數:13,代碼來源:CacheConnectionActivity.java

示例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();
		})
	);
}
 
開發者ID:davidB,項目名稱:jme3_skel,代碼行數:36,代碼來源:PageWelcome.java

示例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())
  );
}
 
開發者ID:ogaclejapan,項目名稱:Qiitanium,代碼行數:9,代碼來源:TagListFragment.java

示例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())
  );
}
 
開發者ID:ogaclejapan,項目名稱:Qiitanium,代碼行數:11,代碼來源:ArticleFragment.java


注:本文中的rx.subscriptions.Subscriptions.from方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。