Java Code Examples for rx.subscriptions.Subscriptions#from()

The following examples show how to use rx.subscriptions.Subscriptions#from() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArticleAboutFragment.java    From Qiitanium with MIT License 6 votes vote down vote up
@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())
  );
}
 
Example 2
Source File: SingleConnectionActivity.java    From satellite with MIT License 5 votes vote down vote up
@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))));
}
 
Example 3
Source File: BaseLaunchActivity.java    From satellite with MIT License 5 votes vote down vote up
@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());
            }));
}
 
Example 4
Source File: ReplayConnectionActivity.java    From satellite with MIT License 5 votes vote down vote up
@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))));
}
 
Example 5
Source File: CacheConnectionActivity.java    From satellite with MIT License 5 votes vote down vote up
@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))));
}
 
Example 6
Source File: TagListFragment.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected Subscription onBind() {
  return Subscriptions.from(
      viewModel,
      listAdapter.bind(viewModel.items()),
      progressBar.bind(viewModel.isLoading(), RxActions.setVisibility())
  );
}
 
Example 7
Source File: ArticleListFragment.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected Subscription onBind() {
  return Subscriptions.from(
      viewModel,
      listAdapter.bind(viewModel.items()),
      progressBar.bind(viewModel.isLoading(), RxActions.setVisibility())
  );
}
 
Example 8
Source File: ArticleFragment.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected Subscription onBind() {
  viewModel = viewModelHolder.get();

  return Subscriptions.from(
      viewModel,
      webView.bind(viewModel.contentHtml(), RxActions.loadDataWithBaseURL()),
      progressBar.bind(isLoading, RxActions.setVisibility())
  );
}
 
Example 9
Source File: ArticleListItemView.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected Subscription onBind(final ArticleViewModel item) {
  return Subscriptions.from(
      titleText.bind(item.title(), RxActions.setText()),
      bodyText.bind(item.excerpt(), RxActions.setText()),
      createdAtText.bind(item.createdAt(), RxActions.setText()),
      authorNameText.bind(item.authorName(), RxActions.setText()),
      authorThumbnailImage.bind(item.authorThumbnailUrl(), loadThumbnailAction()),
      bookmarkIcon.bind(item.isBookmark(), RxActions.setVisibility()),
      tagText.bind(item.tag(), RxActions.setText())
  );
}
 
Example 10
Source File: CommentListItemView.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected Subscription onBind(final CommentViewModel item) {
  return Subscriptions.from(
      commentText.bind(item.text(), RxActions.setText()),
      commentedAtText.bind(item.createdAt(), RxActions.setText()),
      authorThumbImage.bind(item.authorThumbnailUrl(), loadThumbnailAction())
  );
}
 
Example 11
Source File: ArticleActivity.java    From Qiitanium with MIT License 5 votes vote down vote up
@Override
protected Subscription onBind() {
  return Subscriptions.from(
      timeAgo.bind(viewModel.createdAt(), RxActions.setText()),
      title.bind(viewModel.title(), RxActions.setText())
  );
}
 
Example 12
Source File: LicenseDialogFragment.java    From Qiitanium with MIT License 4 votes vote down vote up
@Override
protected Subscription onBind() {
  return Subscriptions.from(
      licenseText.bind(loadLicenseHtml(), RxActions.setText())
  );
}
 
Example 13
Source File: TagListItemView.java    From Qiitanium with MIT License 4 votes vote down vote up
@Override
protected Subscription onBind(final TagViewModel item) {
  return Subscriptions.from(
      nameText.bind(item.name(), RxActions.setText())
  );
}