Open ihrthk opened 8 years ago
subscription = fakeApi.getFakeToken("fake_auth_code") .flatMap(new Func1<FakeToken, Observable<FakeThing>>() { @Override public Observable<FakeThing> call(FakeToken fakeToken) { return fakeApi.getFakeData(fakeToken); } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<FakeThing>() { @Override public void call(FakeThing fakeData) { //1.在这里怎么获取request httpurl //List<Cookie> cookies = Cookie.parseAll(call.request().url(), response.headers()); //2.在这里怎么fakeToken数据,我要整合fakeToken和fakeData,一起返回 swipeRefreshLayout.setRefreshing(false); tokenTv.setText(getString(R.string.got_data, fakeData.id, fakeData.name)); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { swipeRefreshLayout.setRefreshing(false); Toast.makeText(getActivity(), R.string.loading_failed, Toast.LENGTH_SHORT).show(); } }); }