GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ArchitectAK/RxKotlin-RxJava2-Android-Samples: Learning RxKotlin2 for Android by Examples - Migration From RxKotlin1/RxJava1 to RxKotlin2/RxJava2 - How to use RxKotlin 2 in Android - RxLogin using RxBinding - Pagination using RxKotlin

BranchesTags
Open more actions menu

Latest commit

 

History

212 Commits
212 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
RxOperators
RxOperators
 
 
gradle/wrapper
gradle/wrapper
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
_config.yml
_config.yml
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

RxKotlinOperators

Learn RxKotlin with simple coding examples

GitHub stars | GitHub followers

Migration from RxKotlin 1.0 to RxKotlin 2.0

To allow having RxKotlin 1 and RxKotlin 2 side-by-side, RxKotlin 2 is under the maven coordinates io.reactivex.rxjava2:rxjava:2.x.y and classes are accessible below io.reactivex. Users switching from 1.x to 2.x have to re-organize their imports, but carefully.

Using RxKotlin 2.0 Library in your application

Add this in your build.gradle

compile 'io.reactivex.rxjava2:rxjava:2.1.1'

If you are using RxAndroid also, then add the following

compile 'io.reactivex.rxjava2:rxandroid:2.0.1'

Quick Look on few changes done in RxKotlin2 over RxKotlin1

RxJava1/RxKotlin1 -> RxJava2/RxKotlin2

  • onCompleted -> onComplete - without the trailing d
  • Func1 -> Function
  • Func2 -> BiFunction
  • CompositeSubscription -> CompositeDisposable
  • limit operator has been removed - Use take in RxKotlin2

....... and so on

RxOperators :

  • map() -> Transform the items emitted by an Observable by applying a function to each item

  • zip() -> Combine the emissions of multiple Observables together via a specified function and emit single items for each combination based on the results of this function

  • take() -> Emit only the first n items emitted by an Observable

  • timer() -> Create an Observable that emits a particular item after a given delay

  • flatMap() -> Transform the items emitted by an Observable into Observables, then flatten the emissions from those into a single Observable

  • interval() -> Create an Observable that emits a sequence of integers spaced by a given time interval

  • debounce() -> Only emit an item from an Observable if a particular time span has passed without it emitting another item

  • Single Observer -> A Single is something like an Observable, but instead of emitting a series of values — anywhere from none at all to an infinite number — it always either emits one value or an error notification.

  • reduce() -> Apply a function to each item emitted by an Observable, sequentially, and emit the final value

  • buffer() -> Periodically gather items emitted by an Observable into bundles and emit these bundles rather than emitting the items one at a time

  • filter() -> Emit only those items from an Observable that pass a predicate test

  • skip() -> Suppress the first n items emitted by an Observable

  • scan() -> Apply a function to each item emitted by an Observable, sequentially, and emit each successive value

  • replay() -> Ensure that all observers see the same sequence of emitted items, even if they subscribe after the Observable has begun emitting items

  • concat() -> Emit the emissions from two or more Observables without interleaving them

  • merge() -> Combine multiple Observables into one by merging their emissions

  • defer() -> The Defer operator waits until an observer subscribes to it, and then it generates an Observable, typically with an Observable factory function. It does this afresh for each subscriber, so although each subscriber may think it is subscribing to the same Observable, in fact each subscriber gets its own individual sequence.

  • distinct() -> Suppress duplicate items emitted by an Observable

  • Replay Subject -> Replays events (in a configurable bounded or unbounded manner) to current and late Observers.

  • Publish Subject -> Subject that, once an Observer has subscribed, emits all subsequently observed items to the subscriber

  • Behaviour Subject -> Subject that emits the most recent item it has observed and all subsequent observed items to each subscribed Observer.

  • Aync Subject -> A Subject that emits the very last value followed by a completion event or the received error to Observers.

  • Throttle First -> Emit the first items emitted by an Observable within periodic time intervals

  • amb() -> Given two or more source Observables, emits all of the items from the first of these Observables to emit an item

  • Catch -> Recover from an onError notification by continuing the sequence without error

  • Retry -> If a source Observable emits an error, resubscribe to it in the hopes that it will complete without error

  • Coming More

TODO

Adding more operator examples

Highlights :

  • SimpleOperatorActivity - Using Simple operator
  • MapOperatorActivity - Using Map operator
  • ZipOperatorActivity - Using Zip observer
  • DisposableOperatorActivity - Using Disposable operator
  • FlatMapOperatorActivity - Using FlatMap Operator
  • IntervalOperatorActivity - Using Interval Operator
  • TakeOperatorActivity - Using Take Operator
  • TimerOperatorActivity - Using Timer Operator
  • DebounceOperatorActivity - Using Debounce Operator
  • SingleObserverOperatorActivity - Using Single Observer Operator
  • FlowableOperatorActivity - Using Flowable
  • ReduceOperatorActivity -Using Reduce Operator
  • BufferOperatorActivity -Using Buffer Operator
  • FilterOperatorActivity -Using Filter Operator
  • SkipOperatorActivity -Using Skip Operator
  • ScanOperatorActivity -Using Scan Operator
  • ReplayOperatorActivity -Using Replay Operator
  • ConcatOperatorActivity -Using Concat Operator
  • MergeOperatorActivity -Using Merge Operator
  • DeferOperatorActivity -Using Defer Operator
  • DistinctOperatorActivity -Using Distinct Operator
  • ReplaySubjectOperatorActivity -Using Replay Subject Operator
  • PublishSubjectOperatorActivity -Using Publish Subject Operator
  • BehaviorSubjectActivity -Using Behavior Subject Operator
  • AsyncSubjectOperatorActivity -Using Aync Subject Operator
  • ThrottleFirstOperatorActivity -Using Throttle First Operator
  • ThrottleLastOperatorActivity -Using Throttle Last Operator
  • WindowOperatorActivity -Using Window Operator
  • AmbOperatorActivity -Using Amb Operator
  • DelayOperatorActivity -Using Delay Operator
  • CombineLatestOperatorActivity
  • CompletableObserverOperatorActivity
  • RepeatWhenOperatorActivity
  • Coming More

RxBinding

Rx is powerful because we can compose transformations. What that means is that we can have reusable, safe and more functional code that simply plugs into your code.

As an example let’s say we’re making a login screen with an email and a password…

Consider the following rules that we want for our email addresses

  • Length should be greater than 6
  • Should have a correct email pattern
  • Let the user know if any of the above fails
  • On each key stroke, verify

Highlights :

  • RxLoginScreenActivity - Login Screen using RxBinding

Pagination And Lazy loading using RxKotlin

Highlights :

  • PaginationActivity - Activity containing recyclerview and data.
  • PaginationAdapter - Adapter containing layout item

Contact - Let's connect to learn together

  • Twitter
  • Github
  • LinkedIn
  • Facebook
  • Slack
  • Stackoverflow
  • Android App

License

Copyright 2017 Ankit Kumar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Learning RxKotlin2 for Android by Examples - Migration From RxKotlin1/RxJava1 to RxKotlin2/RxJava2 - How to use RxKotlin 2 in Android - RxLogin using RxBinding - Pagination using RxKotlin

Topics

emitskotlinrx-java2rx-kotlin2rxandroid2rxandroid2-samplerxbindingrxjavarxkotlinrxkotlin-androidrxkotlinfxrxloginrxtextviewtutorial

Resources

Readme
Activity

Stars

68 stars

Watchers

5 watching

Forks

25 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.