Share
Embed
Reactive programming in android
RxJava and RxAndroid for android app development. For viewing the session recording checkout yourtube channel DeveloperDru
https://www.youtube.com/channel/UC6Ql4x5QftDEMb8byAh_Q6g/videos
Kaushal Dhruw
November 26, 2017
Transcript
95 slides
-
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
Reactive programming in android Kaushal Dhruw @drulabs -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 2 Agenda • What is Reactive programming? And Why? • Reactive extensions • RxJava & RxAndroid • Components of reactive programming • Retrofit with RxJava • Operators • Testing -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 3 Reactive programming • Wikipedia – It is an asynchronous programming paradigm concerned with data flows and propagation of change. • In other words: – Reactive programming is programming with asynchronous data streams. -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 4 Why asynchronous? Because blocking UI is EVIL -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 5 Why asynchronous? MyApp isn’t responding Jesus peeps you need to update this. worst game ever Did you even test this ? Is there a way to give -20 star? My dog can create a better app -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 6 Reactive programming • Wikipedia – It is an asynchronous programming paradigm concerned with data flows and propagation of change. • In other words: – Reactive programming is programming with asynchronous data streams. -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 7 Why Reactive? Idea from Jake Wharton’s Devoxx 2017 talk -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 8 Reactive programming is… Observer pattern Iterator pattern Functional support And more… -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 9 Reactive programming is… Observer pattern Iterator pattern Functional support Concurrency Resilience And more… -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 10 Reactive programming Observer pattern Iterator pattern Functional support -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 11 Reactive programming Observer pattern Functional support Iterator pattern -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 12 Reactive programming Observer pattern Iterator pattern Functional support Create Combine Transform Chain Listen Filter Reduce Map -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 13 Reactive Extensions (Rx) • Reactive extensions (or Rx) is a library for composing asynchronous and event-based programs by using observable sequences -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 14 Reactive Extensions (Rx) • Reactive extensions (or Rx) is a library for composing and programs by using sequences simultaneous operations. perform some operation(s) when event is triggered or received. think of it as asynchronous immutable array. -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 15 Reactive Extensions (Rx) -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 16 RxJava & RxAndroid • RxJava is a Java VM implementation of ReactiveX. • RxAndroid provides android specific bindings and extensions so RxJava can be used in android applications -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 17 Who uses Rx -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
18 Reactive Programming Components -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 19 Components • Source (emits data) – Emits data streams that can be passed between threads and consumed • Subscriber (the observer or consumer) – Consumes data emitted from source • Scheduler (threads and concurrency) – Where to process and consume data -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 20 Components Source (observable) Data => 1, 2, 3 From Network Database File Doesn’t ma9er Data received. Update UI Or local DB Subscriber (observer) Scheduler (concurrency) I/O thread UI thread ComputaGon thread subscribe dispose Time onNext(1) onNext(2) Error / complete onNext(3) -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 21 Source Source (observable) Data => 1, 2, 3 From Network Database File Doesn’t ma9er Time onNext(1) onNext(2) Error / complete onNext(3) -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 22 Source & Subscriber Source (observable) Data => 1, 2, 3 From Network Database File Doesn’t ma9er Time onNext(1) onNext(2) Error / complete onNext(3) Data received. Update UI Or local DB Subscriber (observer) subscribe dispose -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 23 Schedulers Source (observable) Time Subscriber (observer) Scheduler (concurrency) I/O thread UI thread ComputaGon thread -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 24 Schedulers Source (observable) Time Subscriber (observer) Scheduler (concurrency) I/O thread UI thread ComputaGon thread Abstract away concerns like: • Low level threading • SynchronizaGon • Thread safety • Concurrent data structure -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 25 Schedulers Source (observable) Time Subscriber (observer) Scheduler (concurrency) I/O thread UI thread ComputaGon thread Decide where to execute what • io() • computa5on() • newThread() • from(Executer) -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 26 Source, Subscriber & Scheduler Source (observable) Data => 1, 2, 3 From Network Database File Doesn’t ma9er Time onNext(1) onNext(2) Error / complete onNext(3) Data received. Update UI Or local DB Subscriber (observer) subscribe dispose Scheduler (concurrency) I/O thread UI thread ComputaGon thread -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 27 Components Source (observable) Data => 1, 2, 3 From Network Database File Doesn’t ma9er Data received. Update UI Or local DB Subscriber (observer) Scheduler (concurrency) I/O thread UI thread ComputaGon thread subscribe dispose Time onNext(1) onNext(2) Error / complete onNext(3) -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
28 RxJava2 Core Types -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 29 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 30 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Methods: • onSubscribe(Disposable) • onNext(T) • onError(Throwable) • onCompleted() -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 31 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Multi-valued base reactive abstract class Use factory methods to create observables OnSubscribe is a param in create method -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 32 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Unsubscribe from the source. Methods: • dispose() • isDisposed() -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 33 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Functional interface that accepts a single value Methods: • accept(T) Used with various single value functions -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 34 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Interface for emitting signals Methods: • onNext(T) • onError(Throwable) • onComplete() -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 35 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Interface for composing source. Transforms source by applying a function Methods: • Observable<R> apply(Observable<T>) -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 36 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Parameterizes concurrency Methods: • io() • computation() • newThread() • from(Executer) -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 37 RxJava2 Core types o Observer<T> o XSource<T> § XOnSubscribe<T> o Disposable o Consumer<T> o XEmitter<T> o Transformer<T, R> o Schedulers o Subject<T> Advanced reactive concept. Acts as both source and subscriber Use with caution -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
38 RxJava2 source -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 39 Source • Observable<T> • Flowable<T> • Single<T> • Maybe<T> • Completable<T> • ObservableSource<T> • Publisher<T> • SingleSource<T> • MaybeSource<T> • CompletableSource<T> -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 40 Observable • Observable<T> • Flowable<T> • Single<T> • Maybe<T> • Completable<T> Emits 0 to N items terminates with success or exception -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 41 Flowable • Observable<T> • Flowable<T> • Single<T> • Maybe<T> • Completable<T> Emits 0 to N items terminates with success or exception. Supports backpressure -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 42 Single • Observable<T> • Flowable<T> • Single<T> • Maybe<T> • Completable<T> Emits single item or error. Has no completion indicator -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 43 Maybe • Observable<T> • Flowable<T> • Single<T> • Maybe<T> • Completable<T> Succeeds with 0 or 1 item, or fails. Has completion indicator. Reactive optional. -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 44 Completable • Observable<T> • Flowable<T> • Single<T> • Maybe<T> • Completable<T> Completes with success or fails. No emission. -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 45 That was a lot to take in • Source (Observable) and subscriber are just a slight extension of standard Observer Pattern ? • The real power comes with reactive extensions • operators that allows us to transform, combine, manipulate, and work with the sequences of emitted items One question: -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
46 Creating observables -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 47 Creational operators • Create • Defer • Empty/Never/Error • From • Interval • Just • Range • Repeat • Start • Timer -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 48 Creational operators • Create • Defer • Empty/Never/Error • From • Interval • Create an Observable from scratch by calling observer methods programmatically -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 49 Creational operators • Create • Defer • Empty/Never/Error • From • Interval • Create fresh observable for each observer and defer creation until observer subscribes -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 50 Creational operators • Create • Defer • Empty/Never/Error • From • Interval • Create observable that emits no items but terminates: – Normally – Never – With error -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 51 Creational operators • Create • Defer • Empty/Never/Error • From • Interval • Convert some other object or data structure into an Observable (like list, array, publisher etc.) -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 52 Creational operators • Create • Defer • Empty/Never/Error • From • Interval • Create an Observable that emits a sequence of integers spaced by a particular time interval -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 53 Creational operators • Create • Defer • Empty/Never/Error • From • Interval • Just • Range • Repeat • Start • Timer -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 54 Creational operators • Just • Range • Repeat • Start • Timer • Convert an object or a set of objects into an Observable that emits that or those objects -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 55 Creational operators • Just • Range • Repeat • Start • Timer • Create an Observable that emits a range of sequential integers -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 56 Creational operators • Just • Range • Repeat • Start • Timer • Create an Observable that emits a particular item or sequence of items repeatedly -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 57 Creational operators • Just • Range • Repeat • Start • Timer • Create an Observable that emits the return value of a function -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 58 Creational operators • Just • Range • Repeat • Start • Timer • Create an Observable that emits a single item after a given delay -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
59 Transforming observables -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 60 Transformational operators • Buffer • FlatMap • GroupBy • Map • Scan • Window -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 61 Transformational operators • Buffer • FlatMap • GroupBy • Map • Scan • Window -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 62 Transformational operators • Buffer • FlatMap • GroupBy • Map • Scan • Window -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 63 Transformational operators • Buffer • FlatMap • GroupBy • Map • Scan • Window -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 64 Transformational operators • Buffer • FlatMap • GroupBy • Map • Scan • Window -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 65 Transformational operators • Buffer • FlatMap • GroupBy • Map • Scan • Window -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 66 Transformational operators • Buffer • FlatMap • GroupBy • Map • Scan • Window -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
67 Filtering operators -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 68 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 69 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 70 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 71 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 72 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 73 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 74 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 75 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 76 Filtering operators • Distinct • ElementAt • Filter • First • Last • Skip • Take • TakeLast -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
77 Combining observables -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 78 CombineLatest -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 79 StartWith -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 80 Zip -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 81 Concat -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 82 Merge -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 83 Operator chaining Map Filter Merge -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 84 Operator chaining Filter Reduce -
Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved.
85 Retrofit and RxJava -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 86 Retrofit with RxJava Pure retrofit -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 87 Retrofit with RxJava Add RxJava2 Adapter Set RxJava2 call adapter factory -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 88 Retrofit with RxJava Use RxJava2 with retrofit -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 89 Make it Reactive… <code/> remote UI Idea from Jake Wharton’s Devoxx 2017 talk <code/> remote UI -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 90 Testing with RxJava • TestObserser • TestSubscriber • TestScheduler RxJava2 provides the following: -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 91 Demo Android app -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 92 Thank you -Kaushal Dhruw @drulabs – twi]er / github / stackoverflow / medium Demo app available at h]ps://github.com/drulabs/PicBlast -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 93 Next meetup suggestions • RxKotlin with RxJava (android app development) • RxSwift (iOS app development) • Effective MVP using Dagger, Retrofit and RxJava • Android architecture components -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 94 References • http://reactivex.io/documentation • http://reactivemanifesto.org/ • https://github.com/ReactiveX/RxJava/wiki • https://medium.com/@andrestaltz/2-minute-introduction-to-rx-24c8ca793877 • http://rxmarbles.com/ • https://christinalee.github.io/Slides/slides-master/rx-android/ • https://medium.com/@benlesh/hot-vs-cold-observables-f8094ed53339 • https://github.com/Froussios/Intro-To-RxJava • https://praveer09.github.io/ • https://www.slideshare.net/allegrotech/rxjava-introduction-context • https://gist.github.com/staltz/868e7e9bc2a7b8c1f754 • http://www.vogella.com/tutorials/RxJava/article.html • https://github.com/ReactiveX/RxJava • BackPressure: https://github.com/ReactiveX/RxJava/wiki/Backpressure -
Copyright © 2016 Talen5ca So8ware (I) Pvt Ltd. All rights
reserved. Copyright ©2016 Talen5ca So8ware (I) Pvt Ltd. All rights reserved. 95 Backup slides