Java 类io.reactivex.SingleObserver 实例源码

项目:GitHub    文件:FlowableExampleActivity.java   
private SingleObserver<Integer> getObserver() {

        return new SingleObserver<Integer>() {
            @Override
            public void onSubscribe(Disposable d) {
                Log.d(TAG, " onSubscribe : " + d.isDisposed());
            }

            @Override
            public void onSuccess(Integer value) {
                textView.append(" onSuccess : value : " + value);
                textView.append(AppConstant.LINE_SEPARATOR);
                Log.d(TAG, " onSuccess : value : " + value);
            }

            @Override
            public void onError(Throwable e) {
                textView.append(" onError : " + e.getMessage());
                textView.append(AppConstant.LINE_SEPARATOR);
                Log.d(TAG, " onError : " + e.getMessage());
            }
        };
    }
项目:GitHub    文件:SingleObserverExampleActivity.java   
private SingleObserver<String> getSingleObserver() {
    return new SingleObserver<String>() {
        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(String value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:GitHub    文件:LastOperatorExampleActivity.java   
private SingleObserver<String> getObserver() {
    return new SingleObserver<String>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(String value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext value : " + value);
        }


        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:RxFacebook    文件:RxFacebookGraphRequestSingle.java   
@Override
protected void subscribeActual(@NonNull SingleObserver<? super GraphResponse> observer) {
    mObserver = observer;

    GraphRequest request = GraphRequest.newMeRequest(mAccessToken, new GraphRequest.GraphJSONObjectCallback() {
        @Override
        public void onCompleted(JSONObject object, GraphResponse response) {

            if (response.getError() == null) {
                mObserver.onSuccess(response);
            } else {
                mObserver.onError(response.getError().getException());
            }
        }
    });

    Bundle parameters = new Bundle();
    parameters.putString("fields", mFields);
    request.setParameters(parameters);
    request.executeAsync();
}
项目:reactive.loanbroker.system    文件:RxJava2FutureUtils.java   
@Override
protected void subscribeActual(SingleObserver<? super T> observer) {
    ValueSourceDisposable disposable = new ValueSourceDisposable();
    valueSource.addCallbacks(
            result -> {
                try {
                    observer.onSuccess(result);
                } catch (Throwable e) {
                    observer.onError(e);
                }
            },
            ex -> {
                if (!disposable.isDisposed()) {
                    observer.onError(ex);
                }
            }
    );
    observer.onSubscribe(disposable);
}
项目:reactive-grpc    文件:SubscribeOnlyOnceSingleOperator.java   
@Override
public SingleObserver<? super T> apply(final SingleObserver<? super T> observer) {
    return new SingleObserver<T>() {
        @Override
        public void onSubscribe(Disposable d) {
            if (subscribedOnce.getAndSet(true)) {
                throw new NullPointerException("You cannot directly subscribe to a gRPC service multiple times " +
                        "concurrently. Use Flowable.share() instead.");
            } else {
                observer.onSubscribe(d);
            }
        }

        @Override
        public void onSuccess(T t) {
            observer.onSuccess(t);
        }

        @Override
        public void onError(Throwable e) {
            observer.onError(e);
        }
    };
}
项目:reactive-grpc    文件:SubscribeOnlyOnceTest.java   
@Test
public void subscribeOnlyOnceSingleOperatorErrorsWhenMultipleSubscribe() {
    SubscribeOnlyOnceSingleOperator<Object> op = new SubscribeOnlyOnceSingleOperator<Object>();
    SingleObserver<Object> innerSub = mock(SingleObserver.class);
    final Disposable disposable = mock(Disposable.class);

    final SingleObserver<Object> outerSub = op.apply(innerSub);

    outerSub.onSubscribe(disposable);
    assertThatThrownBy(new ThrowableAssert.ThrowingCallable() {
        @Override
        public void call() {
            outerSub.onSubscribe(disposable);
        }
    })
            .isInstanceOf(NullPointerException.class)
            .hasMessageContaining("cannot directly subscribe to a gRPC service multiple times");

    verify(innerSub, times(1)).onSubscribe(disposable);
}
项目:NovelReader    文件:BookDetailPresenter.java   
private void refreshBook(){
    RemoteRepository
            .getInstance()
            .getBookDetail(bookId)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new SingleObserver<BookDetailBean>() {
                @Override
                public void onSubscribe(Disposable d) {
                    addDisposable(d);
                }

                @Override
                public void onSuccess(BookDetailBean value){
                    mView.finishRefresh(value);
                    mView.complete();
                }

                @Override
                public void onError(Throwable e) {
                    mView.showError();
                }
            });
}
项目:CleanArchitecture    文件:BaseInteractor.java   
protected <E> SingleObserver<E> getSingleSubscriber(final RxSingleSubscriberEvents singleSubscriberEvents) {
    return new SingleObserver<E>() {

        @Override
        public void onSubscribe(@NonNull Disposable d) {
            queueSubscriptionForDisposal(d);
        }

        @Override
        public void onSuccess(E value) {
            singleSubscriberEvents.onSuccess(value);
        }

        @Override
        public void onError(Throwable error) {
            singleSubscriberEvents.onError(error);
        }
    };
}
项目:Android-AudioRecorder-App    文件:PlayListPresenterImpl.java   
@Override public void renameFile(int adapterPosition, String value) {
  rename(recordingItems.get(adapterPosition), adapterPosition, value).subscribe(
      new SingleObserver<Integer>() {
        @Override public void onSubscribe(Disposable d) {

        }

        @Override public void onSuccess(Integer position) {
          getAttachedView().notifyListItemChange(position);
        }

        @Override public void onError(Throwable e) {
          getAttachedView().showError(e.getMessage());
        }
      });
}
项目:DisposableAttach    文件:AttachDisposableSingle.java   
@Override
protected void subscribeActual(SingleObserver<? super T> s) {
    SingleObserver<? super T> observer;
    try {
        observer = ObjectHelper.requireNonNull(s, "Null Observer");
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        // can't call onError because no way to know if a Disposable has been set or not
        // can't call onSubscribe because the call might have set a Disposable already
        RxJavaPlugins.onError(e);

        NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
        npe.initCause(e);
        throw npe;
    }

    source.subscribe(new AttachSingleObserver<>(observer, this.compositeDisposable));
}
项目:EasyAndroid    文件:Network.java   
public static void getNews(SingleObserver<List<News.ContentBean>> observer)
{
    service.getNews()
           .subscribeOn(Schedulers.newThread())
           .flatMap(new Function<News, Observable<News.ContentBean>>()
           {
               @Override
               public Observable<News.ContentBean> apply(News news) throws Exception
               {
                   L.e();
                   return Observable.fromIterable(news.getT1348647853363());
               }
           })
           .toList()
           .observeOn(AndroidSchedulers.mainThread())
           .subscribe(observer);
}
项目:RxConditions    文件:SingleIfThen.java   
@Override
protected void subscribeActual(@NonNull SingleObserver<? super T> observer) {
    boolean b;

    try {
        b = condition.getAsBoolean();
    } catch (Throwable ex) {
        EmptyDisposable.error(ex, observer);
        return;
    }

    if (b) {
        then.subscribe(observer);
    } else {
        orElse.subscribe(observer);
    }
}
项目:RxJava2-Android-Sample    文件:SingleObserverExampleActivity.java   
private SingleObserver<String> getSingleObserver() {
    return new SingleObserver<String>() {
        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(String value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:RxJava2-Android-Sample    文件:FlowableExampleActivity.java   
private SingleObserver<Long> getObserver() {

        return new SingleObserver<Long>() {
            @Override
            public void onSubscribe(Disposable d) {
                Log.d(TAG, " onSubscribe : " + d.isDisposed());
            }

            @Override
            public void onSuccess(Long value) {
                textView.append(" onSuccess : value : " + value);
                textView.append(AppConstant.LINE_SEPARATOR);
                Log.d(TAG, " onSuccess : value : " + value);
            }

            @Override
            public void onError(Throwable e) {
                textView.append(" onError : " + e.getMessage());
                textView.append(AppConstant.LINE_SEPARATOR);
                Log.d(TAG, " onError : " + e.getMessage());
            }
        };
    }
项目:RxJava2-Android-Sample    文件:SimpleExampleActivity.java   
private void getData() {
    Observable.concat(memory, disk, network)
            .first("")
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new SingleObserver<String>() {
                @Override
                public void onSubscribe(Disposable d) {
                    // TODO: 2017/7/5
                }

                @Override
                public void onSuccess(String s) {
                    Log.d(TAG, "onSuccess: " + s);
                }

                @Override
                public void onError(Throwable e) {
                    // TODO: 2017/7/5  
                }
            });
}
项目:RxJava2-Android-Sample    文件:ContainsExampleActivity.java   
private SingleObserver<Boolean> getObserver() {
    return new SingleObserver<Boolean>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(Boolean value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext : value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:RxJava2-Android-Sample    文件:SequenceEqualExampleActivity.java   
private SingleObserver<Boolean> getObserver() {
    return new SingleObserver<Boolean>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(Boolean value) {
            textView.append(" onSuccess : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onSuccess : value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:RxJava2-Android-Sample    文件:AllExampleActivity.java   
private SingleObserver<Boolean> getObserver() {
    return new SingleObserver<Boolean>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(Boolean value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext : value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:RxJava2-Android-Sample    文件:CountExampleActivity.java   
private SingleObserver<Long> getObserver() {
    return new SingleObserver<Long>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(Long value) {
            textView.append(" onSuccess : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onSuccess : value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }

    };
}
项目:RxJava2-Android-Sample    文件:MaxExampleActivity.java   
private SingleObserver<Long> getObserver() {
    return new SingleObserver<Long>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(Long value) {
            textView.append(" onSuccess : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onSuccess : value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }

    };
}
项目:RxJava2-Android-Sample    文件:FirstExampleActivity.java   
private SingleObserver<Integer> getObserver() {
    return new SingleObserver<Integer>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(Integer value) {
            textView.append(" onNext : ");
            textView.append(AppConstant.LINE_SEPARATOR);
            textView.append(" value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext ");
            Log.d(TAG, " value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:RxJava2-Android-Sample    文件:LastExampleActivity.java   
private SingleObserver<String> getObserver() {
    return new SingleObserver<String>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(String value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext value : " + value);
        }


        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:vertx-jooq-async    文件:RXVertxDaoTestBase.java   
protected <T> SingleObserver<T> failOrCountDownSingleObserver(CountDownLatch latch) {
    return new SingleObserver<T>() {
        @Override
        public void onSubscribe(Disposable d) {

        }

        @Override
        public void onSuccess(T t) {
            latch.countDown();
        }

        @Override
        public void onError(Throwable e) {
            fail(e);
        }

    };
}
项目:rxjava2-jdbc    文件:MemberSingle.java   
@Override
protected void subscribeActual(SingleObserver<? super Member<T>> observer) {
    // the action of checking out a member from the pool is implemented as a
    // subscription to the singleton MemberSingle
    MemberSingleObserver<T> md = new MemberSingleObserver<T>(observer, this);
    observer.onSubscribe(md);
    if (pool.isClosed()) {
        observer.onError(new PoolClosedException());
        return;
    }
    add(md);
    if (md.isDisposed()) {
        remove(md);
    }
    requested.incrementAndGet();
    log.debug("subscribed");
    drain();
}
项目:RxDbflow    文件:DBFlowBaseSingle.java   
@Override
protected void subscribeActual(SingleObserver<? super Container> observer) {

    observer.onSubscribe(EmptyDisposable.INSTANCE);
    try {
        Container v =  run();
        if (v != null) {
            observer.onSuccess(v);
        } else {
            observer.onError(new NullPointerException("The callable returned a null value"));
        }
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        observer.onError(e);
    }
}
项目:AppOpsX    文件:PermPresenter.java   
void autoDisable() {
  Helper.autoDisable(context, appInfo.packageName)
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(new SingleObserver<SparseIntArray>() {

        @Override
        public void onSubscribe(Disposable d) {
        }

        @Override
        public void onSuccess(SparseIntArray value) {
          autoDisabled = true;
          load();
        }

        @Override
        public void onError(Throwable e) {
          autoDisabled = true;
          load();
        }
      });
}
项目:AppOpsX    文件:PermPresenter.java   
void reset(){
  Helper.resetMode(context, appInfo.packageName)
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(new SingleObserver<OpsResult>(){

        @Override
        public void onSubscribe(@NonNull Disposable d) {

        }

        @Override
        public void onSuccess(@NonNull OpsResult opsResult) {
          load();
        }

        @Override
        public void onError(@NonNull Throwable e) {

        }
      });
}
项目:AppOpsX    文件:AppPermissionActivity.java   
private void loadAppinfo(String pkgName){
  Helper.getAppInfo(getApplicationContext(),pkgName)
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(new SingleObserver<AppInfo>() {
        @Override
        public void onSubscribe(@NonNull Disposable d) {

        }

        @Override
        public void onSuccess(@NonNull AppInfo appInfo) {
          setTitle(appInfo.appName);
        }

        @Override
        public void onError(@NonNull Throwable e) {

        }
      });
}
项目:AppOpsX    文件:MainActivity.java   
private void loadUsers(){
  Helper.getUsers(getApplicationContext(),true).subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(new SingleObserver<List<UserInfo>>() {
        @Override
        public void onSubscribe(Disposable d) {

        }

        @Override
        public void onSuccess(List<UserInfo> userInfos) {

          Users.getInstance().updateUsers(userInfos);
          invalidateOptionsMenu();
        }

        @Override
        public void onError(Throwable e) {

        }
      });
}
项目:AppOpsX    文件:SettingsActivity.java   
private void closeServer() {
  Helper.closeBgServer(getActivity().getApplicationContext()).subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<Boolean>() {
    @Override
    public void onSubscribe(Disposable d) {

    }

    @Override
    public void onSuccess(Boolean value) {
      Activity activity = getActivity();
      if (activity != null) {
        Toast.makeText(activity, R.string.bg_closed, Toast.LENGTH_SHORT).show();
      }
    }

    @Override
    public void onError(Throwable e) {

    }
  });
}
项目:AppOpsX    文件:AppInstalledRevicer.java   
private void showDlg(final Context context, String pkg) {
  Helper.getAppInfo(context, pkg)
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(new SingleObserver<AppInfo>() {
        @Override
        public void onSubscribe(Disposable d) {

        }

        @Override
        public void onSuccess(AppInfo value) {
          Intent intent = new Intent(context, AlertInstalledPremActivity.class);
          intent.putExtra(AlertInstalledPremActivity.EXTRA_APP, value);
          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
          context.startActivity(intent);
        }

        @Override
        public void onError(Throwable e) {

        }
      });
}
项目:science-journal    文件:MaybeConsumers.java   
/**
 * Performs the opposite translation from
 * {@link MaybeConsumers#fromSingleObserver(SingleObserver)}
 */
public static <T> SingleObserver<T> toSingleObserver(final MaybeConsumer<T> c) {
    return new SingleObserver<T>() {
        @Override
        public void onSubscribe(@NonNull Disposable d) {
            // do nothing
        }

        @Override
        public void onSuccess(@NonNull T t) {
            c.success(t);
        }

        @Override
        public void onError(@NonNull Throwable e) {
            c.fail(new RuntimeException(e));
        }
    };
}
项目:RxJava2-Android-Samples    文件:FlowableExampleActivity.java   
private SingleObserver<Integer> getObserver() {

        return new SingleObserver<Integer>() {
            @Override
            public void onSubscribe(Disposable d) {
                Log.d(TAG, " onSubscribe : " + d.isDisposed());
            }

            @Override
            public void onSuccess(Integer value) {
                textView.append(" onSuccess : value : " + value);
                textView.append(AppConstant.LINE_SEPARATOR);
                Log.d(TAG, " onSuccess : value : " + value);
            }

            @Override
            public void onError(Throwable e) {
                textView.append(" onError : " + e.getMessage());
                textView.append(AppConstant.LINE_SEPARATOR);
                Log.d(TAG, " onError : " + e.getMessage());
            }
        };
    }
项目:RxJava2-Android-Samples    文件:SingleObserverExampleActivity.java   
private SingleObserver<String> getSingleObserver() {
    return new SingleObserver<String>() {
        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(String value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:RxJava2-Android-Samples    文件:LastOperatorExampleActivity.java   
private SingleObserver<String> getObserver() {
    return new SingleObserver<String>() {

        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(String value) {
            textView.append(" onNext : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onNext value : " + value);
        }


        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }
    };
}
项目:ReactiveFB    文件:SingleFriendActivity.java   
private void getProfile(String fields, String userId) {
    ReactiveRequest.getProfile(fields, userId)
            .map(this::parseProfile)
            .subscribe(new SingleObserver<Profile>() {
                @Override
                public void onSubscribe(Disposable d) {
                    Log.d(TAG, "onSubscribe");
                }

                @Override
                public void onSuccess(Profile value) {
                    Log.d(TAG, "onSuccess");
                    fillProfile(value);
                }

                @Override
                public void onError(Throwable e) {
                    Log.d(TAG, "onError " + e.getMessage());
                }
            });
}
项目:ReactiveFB    文件:FriendsActivity.java   
/**
 * get the user list of firends who also use the app
 */
public void getFriends() {
    final String bundleAsString = "picture.width(147).height(147),name,first_name";

    ReactiveRequest.getFriends(bundleAsString)
            .map(this::transform)
            .subscribe(new SingleObserver<List<Profile>>() {
                @Override
                public void onSubscribe(Disposable d) {
                    Log.d(TAG, "onSubscribe");
                }

                @Override
                public void onSuccess(List<Profile> profiles) {
                    Log.d(TAG, "onSuccess");
                    fillList(profiles);
                }

                @Override
                public void onError(Throwable e) {
                    Log.e(TAG, "onError :" + e.getMessage());
                }
            });
}
项目:ReactiveFB    文件:MyPhotosActivity.java   
public void getPhotos() {

        final String photoFields = "album,images,name"; // fields passed to GraphAPI like "?fields=x,x"

        ReactiveRequest
                .getMyPhotos(photoFields, 20) // get albums
                .map(this::transform) // parse json to list of Album
                .subscribe(new SingleObserver<List<Photo>>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                        Log.d(TAG, "onSubscribe");
                    }

                    @Override
                    public void onSuccess(List<Photo> value) {
                        Log.d(TAG, "onNext");
                        appendPhotos(value);
                    }

                    @Override
                    public void onError(Throwable e) {
                        Log.d(TAG, "onError " + e.getMessage());
                    }
                });
    }
项目:grpc-rx    文件:ServerCallsRx.java   
@Override
public ServerCall.Listener<ReqT> startCall(ServerCall<ReqT, RespT> call, Metadata headers) {
  final SingleObserver<RespT> responseObserver = new ResponseObserver<RespT>(call);

  return new SingleRequestListener<ReqT>(call) {
    @Override
    protected void invoke(ReqT request) {
      Single<RespT> response;
      try {
        response = method.unaryInvoke(request);
      } catch (Throwable t) {
        response = Single.error(t);
      }
      response.subscribe(responseObserver);
    }
  };
}