use of com.morihacky.android.rxjava.retrofit.GithubApi in project RxJava-Android-Samples by kaushikgopal.
the class PseudoCacheMergeFragment method _getFreshData.
private Observable<Pair<Contributor, Long>> _getFreshData() {
String githubToken = getResources().getString(R.string.github_oauth_token);
GithubApi githubService = GithubService.createGithubService(githubToken);
return githubService.contributors("square", "retrofit").flatMap(Observable::fromIterable).map(contributor -> new Pair<>(contributor, System.currentTimeMillis()));
}
use of com.morihacky.android.rxjava.retrofit.GithubApi in project RxJava-Android-Samples by kaushikgopal.
the class PseudoCacheFragment method getFreshNetworkData.
private Observable<Contributor> getFreshNetworkData() {
String githubToken = getResources().getString(R.string.github_oauth_token);
GithubApi githubService = GithubService.createGithubService(githubToken);
return githubService.contributors("square", "retrofit").flatMap(Observable::fromIterable).doOnSubscribe((data) -> //
new Handler(Looper.getMainLooper()).post(//
() -> adapterSubscriptionInfo.add("(network) subscribed"))).doOnComplete(() -> //
new Handler(Looper.getMainLooper()).post(() -> adapterSubscriptionInfo.add("(network) completed")));
}
Aggregations