SlideShare a Scribd company logo
Reactive Programming
RxJava + Android
Streams (data flow)
Reactive eXtensions ?
Rx Observer pattern
• Observable
• Observer/Subscriber
• Subscription
• Subject
onNext, onCompleted, and onError
new Observer<T>() {
@Override public void onNext(T element) {
// called when Observable «pushes» new event.
}
@Override public void onCompleted() {
// when stream is successfully completed(terminal state)
}
@Override public void onError(Throwable e) {
// bad news, stream is ends with exception (terminal state)
}
};
Rx Basics
http://reactivex.io/
- Emit 0 or N elements
- Fails with exception -> onError()
- Normally completes -> onCompleted()
Observable – Observer Contract
Stream creation
public static Observable<String> helloWorldStream() {
return Observable.create(new Observable.OnSubscribe<String>() {
@Override
public void call(Subscriber<? super String> subscriber) {
if (!subscriber.isUnsubscribed()) {
try {
subscriber.onNext("Hello");
subscriber.onNext("World");
subscriber.onCompleted();
} catch (Exception ex) {
subscriber.onError(ex);
}
}
}
});
}
Stream creation
public static Observable<String> helloWorldStream() {
return Observable.create(subscriber -> {
if (!subscriber.isUnsubscribed()) {
try {
subscriber.onNext("Hello");
subscriber.onNext("World");
subscriber.onCompleted();
} catch (Exception ex) {
subscriber.onError(ex);
}
}
});
}
Hello World
@Test public void helloWorldTest() {
Observable<String> stream = helloWorldStream();
stream.subscribe(result -> {
System.out.println(result);
}, err -> {
err.printStackTrace();
});
}
Hello World
@Test public void helloWorldTest() {
Observable<String> stream = helloWorldStream();
stream.subscribe(result -> {
System.out.println(result);
}, err -> {
err.printStackTrace();
});
}
Hello World
@Test public void helloWorldTest() {
Observable<String> stream = helloWorldStream();
stream.subscribe(result -> {
System.out.println(result);
}, err -> {
err.printStackTrace();
});
}
Hello World
@Test public void helloWorldTest() {
Observable<String> stream = helloWorldStream();
stream.subscribe(result -> {
System.out.println(result);
}, err -> {
err.printStackTrace();
});
}
Hello World
@Test public void helloWorldTest() {
Observable<String> stream = helloWorldStream();
stream.subscribe(result -> {
System.out.println(result);
}, err -> {
err.printStackTrace();
});
}
"D:JVMJava JDKbinjava"
Hello
World
Process finished with exit code 0
Hello World
@Test public void helloWorldTest() {
Observable<String> stream = helloWorldStream();
stream
.reduce((prev, newOne) -> prev + " " + newOne )
.subscribe(result -> {
System.out.println(result);
}, err -> {
err.printStackTrace();
});
}
"D:JVMJava JDKbinjava"
Hello World
Process finished with exit code 0
Operators
Creating – create, defer, from, interval, timer, start . . .
Transforming – flatMap, map, scan, groupBy, buffer . . .
Filtering – filter, debounce, distinct, take , first, egnoreElements . . .
Combining – combineLatest, merge, startWith, switch, zip . . .
Conditional & Boolean – contains, skipWhile, takeWhile, takeUntil, all . . .
Math & Agregation – reduce, sum, min, max, count . . .
And others . . .
http://reactivex.io/documentation/operators.html
Creating operators
Observable.just(1, 2, 3, 4);
Observable.from(Arrays.asList(“zero", "one", "two", "three"));
Observable.interval(200, TimeUnit.MILLISECONDS);
Observable.error(new Exception(" :`( "));
Transforming operators
Observable.just(2, 4, 6, 8, 10, 25, 43)
.map(num -> new Pair<Integer, Double>(num, Math.sqrt(num)))
.subscribe(pair -> println("new element is -> " + pair));
Observable.just(2, 4, 6, 8, 10, 25, 43)
.scan((x, y ) -> x + y)
.subscribe(sum -> println("Sum is: (" + sum + ")"));
Filtering operators
Observable.just(2, 30, 22, 5, 60, 1)
.filter(num -> num > 10)
.subscribe(num -> println("Filtered -> " + num));
Combining operators
Observable<Integer> ones = Observable.just(1, 1, 1);
Observable<Integer> twos = Observable.just(2, 2);
Observable
.concat(ones, twos)
.subscribe(res -> System.out.println(res));
Combining operators
Observable<Integer> ones = Observable.just(1, 1, 1);
Observable<Integer> twos = Observable.just(2, 2);
Observable
.combineLatest(ones, twos, (o, t) -> "1 stream ->" + o + "n 2 stream -> " + t)
.subscribe(res -> System.out.println(res));
Conditional & Boolean operators
Observable<Integer> zeros = Observable.just(0, 0, 0).delay(200, MILLISECONDS);
Observable<Integer> nums = Observable.just(1, 2, 3).delay(100, MILLISECONDS);
Observable<Integer> dozens = Observable.just(10, 20, 60).delay(300, MILLISECONDS);
Observable.amb(zeros, nums, dozens)
.subscribe(res -> System.out.println(res)); // prints 1 2 3
RxBus
public class RxBus {
private RxBus() { throw new RuntimeException("Not allowed to create instance ");};
private static final Subject<Object, Object> bus =
new SerializedSubject<>(PublishSubject.create());
public static void send(Object o) {
bus.onNext(o);
}
public static Observable<Object> toObserverable() {
return bus.asObservable();
}
public static boolean hasObservers() {
return bus.hasObservers();
}
public static <T>Observable<T> observeEvent(Class<T> clazz) {
return bus.ofType(clazz).asObservable();
}
}
RxBus
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RxBus.send(new ActivityCreatedEvent());
// . . . more logic here
}
}
RxBus
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RxBus.send(new ActivityCreatedEvent());
// . . . more logic here
}
class SuperBusyService extends Service {
private final CompositeSubscription compSub = new CompositeSubscription();
@Override public void onCreate() {
super.onCreate();
compSub.add(RxBus.observEvent(ActivityCreatedEvent.class)
.subscribe(event -> doSomeLongOperation(), err -> handleErr(err)));
}
@Override public void onDestroy() {
super.onDestroy();
compSub.clear();
}
. . .
Simple Timer
Simple Timer
public void launchTicker() {
final Long secondsDisabled = 60L; // user not allowed to send request for new sms
tickerSub = Observable.interval(1, TimeUnit.SECONDS)
.takeUntil(it -> it >= secondsDisabled -1 /* starts from 0 */ )
.map (sec -> (secondsDisabled - sec))
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe (() -> llSendAgain.isEnabled = false )
.doOnCompleted (() -> llSendAgain.isEnabled = true)
.subscribe(time -> tvTicker.setText(getString(R.string.sms_send_again_timer, time))
, err -> handleError(err));
}
«Do» operators in action
public class HomeScreenPresenter {
final HomeView view;
final HomeInteractor interactor = new HomeInteractorImpl();
public HomeScreenPresenter(HomeView view){ this.view = view; }
public void getClientData(String token) {
view.showProgress();
view.manageSubscription(interactor.loadClientData(token)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(result -> {
view.hideProgress();
view.onDataReady(result);
}, err -> {
view.hideProgress();
view.handleError(err);
})
);
}
}
«Do» operators in action
public class HomeScreenPresenter {
final HomeView view;
final HomeInteractor interactor = new HomeInteractorImpl();
public HomeScreenPresenter(HomeView view){ this.view = view; }
public void getClientData(String token) {
view.showProgress();
view.manageSubscription(interactor.loadClientData(token)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(result -> {
view.hideProgress();
view.onDataReady(result);
}, err -> {
view.hideProgress();
view.handleError(err);
})
);
}
}
«Do» operators in action
public class HomeScreenPresenter {
final HomeView view;
final HomeInteractor interactor = new HomeInteractorImpl();
public HomeScreenPresenter(HomeView view){ this.view = view; }
public void getClientData(String token) {
view.manageSubscription(interactor.loadClientData(token)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.doOnSubscribe(view::showProgress)
.doOnTerminate(view::hideProgress)
.subscribe(result -> { view.onDataReady(result); }, err -> { view.handleError(err);})
);
}
}
«Do» operators in action
public class HomeScreenPresenter {
final HomeView view;
final HomeInteractor interactor = new HomeInteractorImpl();
public HomeScreenPresenter(HomeView view){ this.view = view; }
public void getClientData(String token) {
view.manageSubscription(interactor.loadClientData(token)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.compose(RxUtils.progressBarVisibility(view))
.subscribe(result -> { view.onDataReady(result); }, err -> { view.handleError(err);})
);
}
}
«Do» operators in action
public class HomeScreenPresenter {
final HomeView view;
final HomeInteractor interactor = new HomeInteractorImpl();
public HomeScreenPresenter(HomeView view){ this.view = view; }
public void getClientData(String token) {
view.manageSubscription(interactor.loadClientData(token)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.compose(RxUtils.progressBarVisibility(view))
.subscribe(result -> { view.onDataReady(result); }, err -> { view.handleError(err);})
);
}
}
public static <T> Observable.Transformer<T, T> progressBarVisibility(HomeView view) {
return targetObservable ->
targetObservable.doOnSubscribe(view::showProgress)
.doOnTerminate(view::hideProgress);
}
Validation
final Observable<Boolean> nameObservable = RxTextView.textChanges(edtPassword)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Observable<Boolean> emailObservable = RxTextView.textChanges(edtEmail)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Observable<Boolean> passwordObservable = RxTextView.textChanges(edtPassword)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Subscription combinedSub =
Observable
.combineLatest(nameObservable, emailObservable, passwordObservable,
(name, mail, pass) -> name && mail && pass)
.distinctUntilChanged()
.subscribe(btnProceed::setEnabled);
compositeSubscription.add(combinedSub);
Validation
final Observable<Boolean> nameObservable = RxTextView.textChanges(edtPassword)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Observable<Boolean> emailObservable = RxTextView.textChanges(edtEmail)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Observable<Boolean> passwordObservable = RxTextView.textChanges(edtPassword)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Subscription combinedSub =
Observable
.combineLatest(nameObservable, emailObservable, passwordObservable,
(name, mail, pass) -> name && mail && pass)
.distinctUntilChanged()
.subscribe(btnProceed::setEnabled);
compositeSubscription.add(combinedSub);
Validation
final Observable<Boolean> nameObservable = RxTextView.textChanges(edtPassword)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Observable<Boolean> emailObservable = RxTextView.textChanges(edtEmail)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Observable<Boolean> passwordObservable = RxTextView.textChanges(edtPassword)
.skip(1)
.map(text -> /* validateInput with side effect */);
final Subscription combinedSub =
Observable
.combineLatest(nameObservable, emailObservable, passwordObservable,
(name, mail, pass) -> name && mail && pass)
.distinctUntilChanged()
.subscribe(btnProceed::setEnabled);
compositeSubscription.add(combinedSub);
«Live» search
RxTextView.textChanges(searchEditText)
.flatMap(ApiService::searchItems)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateList, t-> showError());
https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
«Live» search
RxTextView.textChanges(searchEditText)
.debounce(205, TimeUnit.MILLISECONDS)
.flatMap(ApiService::searchItems)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateList, t-> showError());
https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
«Live» search
RxTextView.textChanges(searchEditText)
.debounce(205, TimeUnit.MILLISECONDS)
.switchMap(ApiService::searchItems)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateList, t-> showError());
https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
«Live» search
RxTextView.textChanges(searchEditText)
.debounce(205, TimeUnit.MILLISECONDS)
.switchMap(ApiService::searchItems)
.onErrorResumeNext(err -> Observable.empty())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateList, t-> showError());
https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
«Live» search
RxTextView.textChanges(searchEditText)
.debounce(205, TimeUnit.MILLISECONDS)
.switchMap(ApiService::searchItems)
.retryWhen(new NetworkConnectivity())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateList, t-> showError());
https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
«Live» search
RxTextView.textChanges(searchEditText)
.debounce(205, TimeUnit.MILLISECONDS)
.switchMap(ApiService::searchItems)
.retryWhen(new NetworkConnectivityIncremental(context, 5, 15, SECONDS))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateList, t-> showError());
https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
Easy concurrency
NetApiService.loadDocument(docId)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.computation())
// want find matches or smth ASAP
.map(data -> MatchFinder.find(data, PATTERN))
// work done, can swith on low priority 'IO' pool
.observeOn(Schedulers.io())
.doOnNext(processedData -> DataProvider.saveProcessedDocument(docId, processedData))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(/* do something with result */);
https://twitter.com/mr_art_Core

More Related Content

What's hot

RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術
名辰 洪
 
Async Best Practices
Async Best PracticesAsync Best Practices
Async Best Practices
Lluis Franco
 
Async best practices DotNet Conference 2016
Async best practices DotNet Conference 2016 Async best practices DotNet Conference 2016
Async best practices DotNet Conference 2016
Lluis Franco
 
如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test
名辰 洪
 
Introduction to rx java for android
Introduction to rx java for androidIntroduction to rx java for android
Introduction to rx java for android
Esa Firman
 
Single server queue (Simulation Project)
Single server queue (Simulation Project)Single server queue (Simulation Project)
Single server queue (Simulation Project)
Md.zahedul Karim Tuhin
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017
名辰 洪
 
java assignment
java assignmentjava assignment
java assignment
Jack Eastwood
 
Orsiso
OrsisoOrsiso
Orsiso
e27
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
Jafar Nesargi
 
SOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean ArchitectureSOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean Architecture
Fabio Collini
 
Example of JAVA Program
Example of JAVA ProgramExample of JAVA Program
Example of JAVA Program
Trenton Asbury
 
Cascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the StreamsCascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the Streams
mattpodwysocki
 
Solid principles in practice the clean architecture - Droidcon Italy
Solid principles in practice the clean architecture - Droidcon ItalySolid principles in practice the clean architecture - Droidcon Italy
Solid principles in practice the clean architecture - Droidcon Italy
Fabio Collini
 
드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅
드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅
드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅
재춘 노
 
RxJS Operators - Real World Use Cases - AngularMix
RxJS Operators - Real World Use Cases - AngularMixRxJS Operators - Real World Use Cases - AngularMix
RxJS Operators - Real World Use Cases - AngularMix
Tracy Lee
 
Pattern printing programs
Pattern printing programsPattern printing programs
Pattern printing programs
Mukesh Tekwani
 
apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...
apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...
apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...
apidays
 
Rxjava meetup presentation
Rxjava meetup presentationRxjava meetup presentation
Rxjava meetup presentation
Guillaume Valverde
 
Import java
Import javaImport java
Import java
heni2121
 

What's hot (20)

RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術
 
Async Best Practices
Async Best PracticesAsync Best Practices
Async Best Practices
 
Async best practices DotNet Conference 2016
Async best practices DotNet Conference 2016 Async best practices DotNet Conference 2016
Async best practices DotNet Conference 2016
 
如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test如何「畫圖」寫測試 - RxJS Marble Test
如何「畫圖」寫測試 - RxJS Marble Test
 
Introduction to rx java for android
Introduction to rx java for androidIntroduction to rx java for android
Introduction to rx java for android
 
Single server queue (Simulation Project)
Single server queue (Simulation Project)Single server queue (Simulation Project)
Single server queue (Simulation Project)
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017
 
java assignment
java assignmentjava assignment
java assignment
 
Orsiso
OrsisoOrsiso
Orsiso
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
SOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean ArchitectureSOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean Architecture
 
Example of JAVA Program
Example of JAVA ProgramExample of JAVA Program
Example of JAVA Program
 
Cascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the StreamsCascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the Streams
 
Solid principles in practice the clean architecture - Droidcon Italy
Solid principles in practice the clean architecture - Droidcon ItalySolid principles in practice the clean architecture - Droidcon Italy
Solid principles in practice the clean architecture - Droidcon Italy
 
드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅
드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅
드로이드 나이츠 2018: RxJava 적용 팁 및 트러블 슈팅
 
RxJS Operators - Real World Use Cases - AngularMix
RxJS Operators - Real World Use Cases - AngularMixRxJS Operators - Real World Use Cases - AngularMix
RxJS Operators - Real World Use Cases - AngularMix
 
Pattern printing programs
Pattern printing programsPattern printing programs
Pattern printing programs
 
apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...
apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...
apidays LIVE Australia 2020 - Strangling the monolith with a reactive GraphQL...
 
Rxjava meetup presentation
Rxjava meetup presentationRxjava meetup presentation
Rxjava meetup presentation
 
Import java
Import javaImport java
Import java
 

Viewers also liked

Reactive Android: RxJava and beyond
Reactive Android: RxJava and beyondReactive Android: RxJava and beyond
Reactive Android: RxJava and beyond
Fabio Tiriticco
 
RxJava for Android - GDG and DataArt
RxJava for Android - GDG and DataArtRxJava for Android - GDG and DataArt
RxJava for Android - GDG and DataArt
Constantine Mars
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
Dustin Graham
 
The Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidThe Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on Android
Fernando Cejas
 
RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015
Constantine Mars
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
yo_waka
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJava
Kros Huang
 
Introduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaIntroduction to Retrofit and RxJava
Introduction to Retrofit and RxJava
Fabio Collini
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
Tomáš Kypta
 
Headless fragments in Android
Headless fragments in AndroidHeadless fragments in Android
Headless fragments in Android
Ali Muzaffar
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
Rick Warren
 
Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJava
Ali Muzaffar
 

Viewers also liked (12)

Reactive Android: RxJava and beyond
Reactive Android: RxJava and beyondReactive Android: RxJava and beyond
Reactive Android: RxJava and beyond
 
RxJava for Android - GDG and DataArt
RxJava for Android - GDG and DataArtRxJava for Android - GDG and DataArt
RxJava for Android - GDG and DataArt
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
 
The Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidThe Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on Android
 
RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJava
 
Introduction to Retrofit and RxJava
Introduction to Retrofit and RxJavaIntroduction to Retrofit and RxJava
Introduction to Retrofit and RxJava
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Headless fragments in Android
Headless fragments in AndroidHeadless fragments in Android
Headless fragments in Android
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJava
 

Similar to 2 презентация rx java+android

Saving lives with rx java
Saving lives with rx javaSaving lives with rx java
Saving lives with rx java
Shahar Barsheshet
 
Reactive Programming on Android
Reactive Programming on AndroidReactive Programming on Android
Reactive Programming on Android
Guilherme Branco
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Mario Fusco
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
Tomáš Kypta
 
Akka.NET streams and reactive streams
Akka.NET streams and reactive streamsAkka.NET streams and reactive streams
Akka.NET streams and reactive streams
Bartosz Sypytkowski
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
Michiel Borkent
 
Reactive Java (33rd Degree)
Reactive Java (33rd Degree)Reactive Java (33rd Degree)
Reactive Java (33rd Degree)
Tomasz Kowalczewski
 
Rx workshop
Rx workshopRx workshop
Rx workshop
Ryan Riley
 
オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)
Takayuki Goto
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
Vadym Khondar
 
Akka
AkkaAkka
The Reactive Landscape
The Reactive LandscapeThe Reactive Landscape
The Reactive Landscape
Red Hat Developers
 
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn TớiTech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Nexus FrontierTech
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
Alex Tumanoff
 
Luis Atencio on RxJS
Luis Atencio on RxJSLuis Atencio on RxJS
Luis Atencio on RxJS
Luis Atencio
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
Adam L Barrett
 
Rxjs swetugg
Rxjs swetuggRxjs swetugg
Rxjs swetugg
Christoffer Noring
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
Christoffer Noring
 
От Java Threads к лямбдам, Андрей Родионов
От Java Threads к лямбдам, Андрей РодионовОт Java Threads к лямбдам, Андрей Родионов
От Java Threads к лямбдам, Андрей Родионов
Yandex
 
Rxjs marble-testing
Rxjs marble-testingRxjs marble-testing
Rxjs marble-testing
Christoffer Noring
 

Similar to 2 презентация rx java+android (20)

Saving lives with rx java
Saving lives with rx javaSaving lives with rx java
Saving lives with rx java
 
Reactive Programming on Android
Reactive Programming on AndroidReactive Programming on Android
Reactive Programming on Android
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Akka.NET streams and reactive streams
Akka.NET streams and reactive streamsAkka.NET streams and reactive streams
Akka.NET streams and reactive streams
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Reactive Java (33rd Degree)
Reactive Java (33rd Degree)Reactive Java (33rd Degree)
Reactive Java (33rd Degree)
 
Rx workshop
Rx workshopRx workshop
Rx workshop
 
オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
Akka
AkkaAkka
Akka
 
The Reactive Landscape
The Reactive LandscapeThe Reactive Landscape
The Reactive Landscape
 
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn TớiTech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
Luis Atencio on RxJS
Luis Atencio on RxJSLuis Atencio on RxJS
Luis Atencio on RxJS
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
 
Rxjs swetugg
Rxjs swetuggRxjs swetugg
Rxjs swetugg
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
 
От Java Threads к лямбдам, Андрей Родионов
От Java Threads к лямбдам, Андрей РодионовОт Java Threads к лямбдам, Андрей Родионов
От Java Threads к лямбдам, Андрей Родионов
 
Rxjs marble-testing
Rxjs marble-testingRxjs marble-testing
Rxjs marble-testing
 

More from STEP Computer Academy (Zaporozhye)

X-Lab презентация
X-Lab презентацияX-Lab презентация
X-Lab презентация
STEP Computer Academy (Zaporozhye)
 
Service workers
Service workersService workers
PWA: Progressive Web Application
PWA: Progressive Web ApplicationPWA: Progressive Web Application
PWA: Progressive Web Application
STEP Computer Academy (Zaporozhye)
 
Node .js microservices
Node .js microservices Node .js microservices
Node .js microservices
STEP Computer Academy (Zaporozhye)
 
Framework Battle: Django vs Flask vs Chalice
Framework Battle: Django vs Flask vs ChaliceFramework Battle: Django vs Flask vs Chalice
Framework Battle: Django vs Flask vs Chalice
STEP Computer Academy (Zaporozhye)
 
Парсер: что? зачем? как?
Парсер: что? зачем? как?Парсер: что? зачем? как?
Парсер: что? зачем? как?
STEP Computer Academy (Zaporozhye)
 
3 Презентация Kotlin - why not?
3 Презентация Kotlin - why not?3 Презентация Kotlin - why not?
3 Презентация Kotlin - why not?
STEP Computer Academy (Zaporozhye)
 
1 Презентация функциональное программирование
1 Презентация функциональное программирование1 Презентация функциональное программирование
1 Презентация функциональное программирование
STEP Computer Academy (Zaporozhye)
 
Путь UI developer. От «Белого» пояса к «черному»
Путь UI developer. От «Белого» пояса к «черному»Путь UI developer. От «Белого» пояса к «черному»
Путь UI developer. От «Белого» пояса к «черному»
STEP Computer Academy (Zaporozhye)
 
Html5 canvas и электронный документооборот
Html5 canvas и электронный документооборотHtml5 canvas и электронный документооборот
Html5 canvas и электронный документооборот
STEP Computer Academy (Zaporozhye)
 
Golden Byte 2016
Golden Byte 2016Golden Byte 2016
Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В.
Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В. Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В.
Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В.
STEP Computer Academy (Zaporozhye)
 
Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.
Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.
Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.
STEP Computer Academy (Zaporozhye)
 
Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.
Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.
Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.
STEP Computer Academy (Zaporozhye)
 
Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.
Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.
Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.
STEP Computer Academy (Zaporozhye)
 
Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А.
Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А. Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А.
Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А.
STEP Computer Academy (Zaporozhye)
 
Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю.
Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю. Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю.
Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю.
STEP Computer Academy (Zaporozhye)
 
Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"
Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"
Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"
STEP Computer Academy (Zaporozhye)
 

More from STEP Computer Academy (Zaporozhye) (18)

X-Lab презентация
X-Lab презентацияX-Lab презентация
X-Lab презентация
 
Service workers
Service workersService workers
Service workers
 
PWA: Progressive Web Application
PWA: Progressive Web ApplicationPWA: Progressive Web Application
PWA: Progressive Web Application
 
Node .js microservices
Node .js microservices Node .js microservices
Node .js microservices
 
Framework Battle: Django vs Flask vs Chalice
Framework Battle: Django vs Flask vs ChaliceFramework Battle: Django vs Flask vs Chalice
Framework Battle: Django vs Flask vs Chalice
 
Парсер: что? зачем? как?
Парсер: что? зачем? как?Парсер: что? зачем? как?
Парсер: что? зачем? как?
 
3 Презентация Kotlin - why not?
3 Презентация Kotlin - why not?3 Презентация Kotlin - why not?
3 Презентация Kotlin - why not?
 
1 Презентация функциональное программирование
1 Презентация функциональное программирование1 Презентация функциональное программирование
1 Презентация функциональное программирование
 
Путь UI developer. От «Белого» пояса к «черному»
Путь UI developer. От «Белого» пояса к «черному»Путь UI developer. От «Белого» пояса к «черному»
Путь UI developer. От «Белого» пояса к «черному»
 
Html5 canvas и электронный документооборот
Html5 canvas и электронный документооборотHtml5 canvas и электронный документооборот
Html5 canvas и электронный документооборот
 
Golden Byte 2016
Golden Byte 2016Golden Byte 2016
Golden Byte 2016
 
Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В.
Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В. Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В.
Дипломная работа ЗФКА "ШАГ" (2015) - Хетагуров М. В.
 
Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.
Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.
Дипломная работа ЗФКА "ШАГ" (2015) - Торба А.С.
 
Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.
Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.
Дипломная работа ЗФКА "ШАГ" 2015) - Пантилимонова Е.И.
 
Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.
Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.
Дипломный проект ЗФКА "ШАГ" (2015) - Ищенко А.С.
 
Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А.
Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А. Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А.
Дипломная работа ЗФКА "ШАГ" (2015) - Жучков С.А.
 
Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю.
Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю. Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю.
Дипломная работа "ЗФКА "ШАГ" (2015) - Есина Ю.Ю.
 
Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"
Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"
Урок 3Ds Max - полустационар "Компьютерная графика и дизайн" в КА "ШАГ"
 

Recently uploaded

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 

Recently uploaded (20)

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 

2 презентация rx java+android

  • 2.
  • 5. Rx Observer pattern • Observable • Observer/Subscriber • Subscription • Subject
  • 6. onNext, onCompleted, and onError new Observer<T>() { @Override public void onNext(T element) { // called when Observable «pushes» new event. } @Override public void onCompleted() { // when stream is successfully completed(terminal state) } @Override public void onError(Throwable e) { // bad news, stream is ends with exception (terminal state) } };
  • 8. - Emit 0 or N elements - Fails with exception -> onError() - Normally completes -> onCompleted() Observable – Observer Contract
  • 9. Stream creation public static Observable<String> helloWorldStream() { return Observable.create(new Observable.OnSubscribe<String>() { @Override public void call(Subscriber<? super String> subscriber) { if (!subscriber.isUnsubscribed()) { try { subscriber.onNext("Hello"); subscriber.onNext("World"); subscriber.onCompleted(); } catch (Exception ex) { subscriber.onError(ex); } } } }); }
  • 10. Stream creation public static Observable<String> helloWorldStream() { return Observable.create(subscriber -> { if (!subscriber.isUnsubscribed()) { try { subscriber.onNext("Hello"); subscriber.onNext("World"); subscriber.onCompleted(); } catch (Exception ex) { subscriber.onError(ex); } } }); }
  • 11. Hello World @Test public void helloWorldTest() { Observable<String> stream = helloWorldStream(); stream.subscribe(result -> { System.out.println(result); }, err -> { err.printStackTrace(); }); }
  • 12. Hello World @Test public void helloWorldTest() { Observable<String> stream = helloWorldStream(); stream.subscribe(result -> { System.out.println(result); }, err -> { err.printStackTrace(); }); }
  • 13. Hello World @Test public void helloWorldTest() { Observable<String> stream = helloWorldStream(); stream.subscribe(result -> { System.out.println(result); }, err -> { err.printStackTrace(); }); }
  • 14. Hello World @Test public void helloWorldTest() { Observable<String> stream = helloWorldStream(); stream.subscribe(result -> { System.out.println(result); }, err -> { err.printStackTrace(); }); }
  • 15. Hello World @Test public void helloWorldTest() { Observable<String> stream = helloWorldStream(); stream.subscribe(result -> { System.out.println(result); }, err -> { err.printStackTrace(); }); } "D:JVMJava JDKbinjava" Hello World Process finished with exit code 0
  • 16. Hello World @Test public void helloWorldTest() { Observable<String> stream = helloWorldStream(); stream .reduce((prev, newOne) -> prev + " " + newOne ) .subscribe(result -> { System.out.println(result); }, err -> { err.printStackTrace(); }); } "D:JVMJava JDKbinjava" Hello World Process finished with exit code 0
  • 17. Operators Creating – create, defer, from, interval, timer, start . . . Transforming – flatMap, map, scan, groupBy, buffer . . . Filtering – filter, debounce, distinct, take , first, egnoreElements . . . Combining – combineLatest, merge, startWith, switch, zip . . . Conditional & Boolean – contains, skipWhile, takeWhile, takeUntil, all . . . Math & Agregation – reduce, sum, min, max, count . . . And others . . . http://reactivex.io/documentation/operators.html
  • 18. Creating operators Observable.just(1, 2, 3, 4); Observable.from(Arrays.asList(“zero", "one", "two", "three")); Observable.interval(200, TimeUnit.MILLISECONDS); Observable.error(new Exception(" :`( "));
  • 19. Transforming operators Observable.just(2, 4, 6, 8, 10, 25, 43) .map(num -> new Pair<Integer, Double>(num, Math.sqrt(num))) .subscribe(pair -> println("new element is -> " + pair)); Observable.just(2, 4, 6, 8, 10, 25, 43) .scan((x, y ) -> x + y) .subscribe(sum -> println("Sum is: (" + sum + ")"));
  • 20. Filtering operators Observable.just(2, 30, 22, 5, 60, 1) .filter(num -> num > 10) .subscribe(num -> println("Filtered -> " + num));
  • 21. Combining operators Observable<Integer> ones = Observable.just(1, 1, 1); Observable<Integer> twos = Observable.just(2, 2); Observable .concat(ones, twos) .subscribe(res -> System.out.println(res));
  • 22. Combining operators Observable<Integer> ones = Observable.just(1, 1, 1); Observable<Integer> twos = Observable.just(2, 2); Observable .combineLatest(ones, twos, (o, t) -> "1 stream ->" + o + "n 2 stream -> " + t) .subscribe(res -> System.out.println(res));
  • 23. Conditional & Boolean operators Observable<Integer> zeros = Observable.just(0, 0, 0).delay(200, MILLISECONDS); Observable<Integer> nums = Observable.just(1, 2, 3).delay(100, MILLISECONDS); Observable<Integer> dozens = Observable.just(10, 20, 60).delay(300, MILLISECONDS); Observable.amb(zeros, nums, dozens) .subscribe(res -> System.out.println(res)); // prints 1 2 3
  • 24.
  • 25. RxBus public class RxBus { private RxBus() { throw new RuntimeException("Not allowed to create instance ");}; private static final Subject<Object, Object> bus = new SerializedSubject<>(PublishSubject.create()); public static void send(Object o) { bus.onNext(o); } public static Observable<Object> toObserverable() { return bus.asObservable(); } public static boolean hasObservers() { return bus.hasObservers(); } public static <T>Observable<T> observeEvent(Class<T> clazz) { return bus.ofType(clazz).asObservable(); } }
  • 26. RxBus public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RxBus.send(new ActivityCreatedEvent()); // . . . more logic here } }
  • 27. RxBus public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RxBus.send(new ActivityCreatedEvent()); // . . . more logic here } class SuperBusyService extends Service { private final CompositeSubscription compSub = new CompositeSubscription(); @Override public void onCreate() { super.onCreate(); compSub.add(RxBus.observEvent(ActivityCreatedEvent.class) .subscribe(event -> doSomeLongOperation(), err -> handleErr(err))); } @Override public void onDestroy() { super.onDestroy(); compSub.clear(); } . . .
  • 29. Simple Timer public void launchTicker() { final Long secondsDisabled = 60L; // user not allowed to send request for new sms tickerSub = Observable.interval(1, TimeUnit.SECONDS) .takeUntil(it -> it >= secondsDisabled -1 /* starts from 0 */ ) .map (sec -> (secondsDisabled - sec)) .observeOn(AndroidSchedulers.mainThread()) .doOnSubscribe (() -> llSendAgain.isEnabled = false ) .doOnCompleted (() -> llSendAgain.isEnabled = true) .subscribe(time -> tvTicker.setText(getString(R.string.sms_send_again_timer, time)) , err -> handleError(err)); }
  • 30. «Do» operators in action public class HomeScreenPresenter { final HomeView view; final HomeInteractor interactor = new HomeInteractorImpl(); public HomeScreenPresenter(HomeView view){ this.view = view; } public void getClientData(String token) { view.showProgress(); view.manageSubscription(interactor.loadClientData(token) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(result -> { view.hideProgress(); view.onDataReady(result); }, err -> { view.hideProgress(); view.handleError(err); }) ); } }
  • 31. «Do» operators in action public class HomeScreenPresenter { final HomeView view; final HomeInteractor interactor = new HomeInteractorImpl(); public HomeScreenPresenter(HomeView view){ this.view = view; } public void getClientData(String token) { view.showProgress(); view.manageSubscription(interactor.loadClientData(token) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(result -> { view.hideProgress(); view.onDataReady(result); }, err -> { view.hideProgress(); view.handleError(err); }) ); } }
  • 32. «Do» operators in action public class HomeScreenPresenter { final HomeView view; final HomeInteractor interactor = new HomeInteractorImpl(); public HomeScreenPresenter(HomeView view){ this.view = view; } public void getClientData(String token) { view.manageSubscription(interactor.loadClientData(token) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .doOnSubscribe(view::showProgress) .doOnTerminate(view::hideProgress) .subscribe(result -> { view.onDataReady(result); }, err -> { view.handleError(err);}) ); } }
  • 33. «Do» operators in action public class HomeScreenPresenter { final HomeView view; final HomeInteractor interactor = new HomeInteractorImpl(); public HomeScreenPresenter(HomeView view){ this.view = view; } public void getClientData(String token) { view.manageSubscription(interactor.loadClientData(token) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .compose(RxUtils.progressBarVisibility(view)) .subscribe(result -> { view.onDataReady(result); }, err -> { view.handleError(err);}) ); } }
  • 34. «Do» operators in action public class HomeScreenPresenter { final HomeView view; final HomeInteractor interactor = new HomeInteractorImpl(); public HomeScreenPresenter(HomeView view){ this.view = view; } public void getClientData(String token) { view.manageSubscription(interactor.loadClientData(token) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .compose(RxUtils.progressBarVisibility(view)) .subscribe(result -> { view.onDataReady(result); }, err -> { view.handleError(err);}) ); } } public static <T> Observable.Transformer<T, T> progressBarVisibility(HomeView view) { return targetObservable -> targetObservable.doOnSubscribe(view::showProgress) .doOnTerminate(view::hideProgress); }
  • 35. Validation final Observable<Boolean> nameObservable = RxTextView.textChanges(edtPassword) .skip(1) .map(text -> /* validateInput with side effect */); final Observable<Boolean> emailObservable = RxTextView.textChanges(edtEmail) .skip(1) .map(text -> /* validateInput with side effect */); final Observable<Boolean> passwordObservable = RxTextView.textChanges(edtPassword) .skip(1) .map(text -> /* validateInput with side effect */); final Subscription combinedSub = Observable .combineLatest(nameObservable, emailObservable, passwordObservable, (name, mail, pass) -> name && mail && pass) .distinctUntilChanged() .subscribe(btnProceed::setEnabled); compositeSubscription.add(combinedSub);
  • 36. Validation final Observable<Boolean> nameObservable = RxTextView.textChanges(edtPassword) .skip(1) .map(text -> /* validateInput with side effect */); final Observable<Boolean> emailObservable = RxTextView.textChanges(edtEmail) .skip(1) .map(text -> /* validateInput with side effect */); final Observable<Boolean> passwordObservable = RxTextView.textChanges(edtPassword) .skip(1) .map(text -> /* validateInput with side effect */); final Subscription combinedSub = Observable .combineLatest(nameObservable, emailObservable, passwordObservable, (name, mail, pass) -> name && mail && pass) .distinctUntilChanged() .subscribe(btnProceed::setEnabled); compositeSubscription.add(combinedSub);
  • 37. Validation final Observable<Boolean> nameObservable = RxTextView.textChanges(edtPassword) .skip(1) .map(text -> /* validateInput with side effect */); final Observable<Boolean> emailObservable = RxTextView.textChanges(edtEmail) .skip(1) .map(text -> /* validateInput with side effect */); final Observable<Boolean> passwordObservable = RxTextView.textChanges(edtPassword) .skip(1) .map(text -> /* validateInput with side effect */); final Subscription combinedSub = Observable .combineLatest(nameObservable, emailObservable, passwordObservable, (name, mail, pass) -> name && mail && pass) .distinctUntilChanged() .subscribe(btnProceed::setEnabled); compositeSubscription.add(combinedSub);
  • 41. «Live» search RxTextView.textChanges(searchEditText) .debounce(205, TimeUnit.MILLISECONDS) .switchMap(ApiService::searchItems) .onErrorResumeNext(err -> Observable.empty()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::updateList, t-> showError()); https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
  • 42. «Live» search RxTextView.textChanges(searchEditText) .debounce(205, TimeUnit.MILLISECONDS) .switchMap(ApiService::searchItems) .retryWhen(new NetworkConnectivity()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::updateList, t-> showError()); https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
  • 43. «Live» search RxTextView.textChanges(searchEditText) .debounce(205, TimeUnit.MILLISECONDS) .switchMap(ApiService::searchItems) .retryWhen(new NetworkConnectivityIncremental(context, 5, 15, SECONDS)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::updateList, t-> showError()); https://lorentzos.com/improving-ux-with-rxjava-4440a13b157f#.19yawyfss
  • 44. Easy concurrency NetApiService.loadDocument(docId) .subscribeOn(Schedulers.io()) .observeOn(Schedulers.computation()) // want find matches or smth ASAP .map(data -> MatchFinder.find(data, PATTERN)) // work done, can swith on low priority 'IO' pool .observeOn(Schedulers.io()) .doOnNext(processedData -> DataProvider.saveProcessedDocument(docId, processedData)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(/* do something with result */);