Upgrade to Pro — share decks privately, control downloads, hide ads and more …

メルカリアッテをRxjava2に 載せ換えて。。

メルカリアッテをRxjava2に 載せ換えて。。

Hiroshi Hashimoto

August 25, 2017
Tweet

More Decks by Hiroshi Hashimoto

Other Decks in Technology

Transcript

  1. Souzoh confidential and proprietary compile 'io.reactivex.rxjava2:rxjava:2.1.2' compile 'io.reactivex.rxjava2:rxandroid:2.0.1' compile "com.jakewharton.rxbinding2:rxbinding:${rx_binding}"

    compile "com.squareup.retrofit2:adapter-rxjava2:${retrofit_version}" とりあえずapp/build.gradle 10 Rxjavaさようなら。今までありがとう。
  2. Souzoh confidential and proprietary 対応箇所 import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; import

    rx.subjects.PublishSubject; import rx.subscriptions.CompositeSubscription; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.subjects.PublishSubject; import io.reactivex.schedulers.Schedulers; 14 とりあえず、rx.xxxをio.reactivex.xxxに置き換える
  3. Souzoh confidential and proprietary 対応箇所 private final CompositeSubscription compositeSubscription =

    new CompositeSubscription(); compositeSubscription.unsubscribe(); private final CompositeDisposable compositeDisposable = new CompositeDisposable(); compositeDisposable.dispose(); 15 CompositeSubscriptionをCompositeDisposable
  4. Souzoh confidential and proprietary 対応箇所 loadingRequest.onNext(true); ApiCient apiClient = new

    ApiClient(); apiClient.responseFrom(new Offer(id)) .doOnTerminate(() -> loadingRequest.onNext(false)) .subscribe(); loadingRequest.onNext(true); ApiCient apiClient = new ApiClient(); apiClient.responseFrom(new Offer(id)) .doAfterTerminate(() -> loadingRequest.onNext(false)) .subscribe(); 16 doOnTerminate()をdoAfterTerminate()