All Projects → kittinunf → Reactiveandroid

kittinunf / Reactiveandroid

Licence: mit
Reactive events and properties with RxJava for Android

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Reactiveandroid

RxUploader
Uploader for Android using RxJava
Stars: ✭ 72 (-10%)
Mutual labels:  rxjava, frp
Swiftrex
Swift + Redux + (Combine|RxSwift|ReactiveSwift) -> SwiftRex
Stars: ✭ 267 (+233.75%)
Mutual labels:  reactive-programming, frp
purescript-pop
😃 A functional reactive programming (FRP) demo created with PureScript events and behaviors.
Stars: ✭ 33 (-58.75%)
Mutual labels:  reactive-programming, frp
Rxfiddle
Visualize your Observables
Stars: ✭ 157 (+96.25%)
Mutual labels:  rxjava, reactive-programming
Streamly
Beautiful Streaming, Concurrent and Reactive Composition (Haskell)
Stars: ✭ 553 (+591.25%)
Mutual labels:  reactive-programming, frp
Slick
A Reactive MVP Framework which is Slick to use
Stars: ✭ 201 (+151.25%)
Mutual labels:  rxjava, reactive-programming
RxJava-Codelab
Codelab project for demonstration of RxJava features
Stars: ✭ 44 (-45%)
Mutual labels:  rxjava, reactive-programming
rxify
Now: RxJava Playground, Previous: Demo for the talk at DroidconIN 2016, Droidcon Boston 2017 and Codelab for GDG January Meetup
Stars: ✭ 59 (-26.25%)
Mutual labels:  rxjava, reactive-programming
Viabus Architecture
让 Android 开发可以像流水线一样高效的,职责分离架构 ⚡ 不同于 MVP 的配置解耦,也不能和 似是而非 的 MVVM - Clean 同日而语。VIABUS 是世界范围内首个明确提出,通过职责分离,来真正实现 UI 和 业务并行开发的 Android 项目级开发架构和设计模式理念。
Stars: ✭ 485 (+506.25%)
Mutual labels:  rxjava, reactive-programming
Hivemq Mqtt Client
HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
Stars: ✭ 402 (+402.5%)
Mutual labels:  rxjava, reactive-programming
Combinerxswiftperformance
A test suite comparing the performance of Combine and RxSwift
Stars: ✭ 154 (+92.5%)
Mutual labels:  reactive-programming, frp
Rxcombine
Bi-directional type bridging between RxSwift and Apple's Combine framework
Stars: ✭ 741 (+826.25%)
Mutual labels:  reactive-programming, frp
Rerxswift
ReRxSwift: RxSwift bindings for ReSwift
Stars: ✭ 97 (+21.25%)
Mutual labels:  reactive-programming, frp
Rhub
Reactive Event Hub
Stars: ✭ 66 (-17.5%)
Mutual labels:  rxjava, reactive-programming
Rxjava2 Jdbc
RxJava2 integration with JDBC including Non-blocking Connection Pools
Stars: ✭ 360 (+350%)
Mutual labels:  rxjava, reactive-programming
Android Oss
Kickstarter for Android. Bring new ideas to life, anywhere.
Stars: ✭ 5,627 (+6933.75%)
Mutual labels:  rxjava, frp
Rxjava Android Samples
Learning RxJava for Android by example
Stars: ✭ 7,520 (+9300%)
Mutual labels:  rxjava, reactive-programming
Rxbluetoothkotlin
Bluetooth low energy reactive framework for Android written in Kotlin
Stars: ✭ 68 (-15%)
Mutual labels:  rxjava
Neutronium
🚀 Build .NET desktop applications using HTML, CSS and javascript.
Stars: ✭ 1,190 (+1387.5%)
Mutual labels:  reactive-programming
React Composition Api
🎨 Simple React state management. Made with @vue/reactivity and ❤️.
Stars: ✭ 67 (-16.25%)
Mutual labels:  reactive-programming

ReactiveAndroid

Kotlin jcenter Build Status

Reactive events and properties with RxJava for Android

Installation

Dependency

Gradle

repositories {
    jcenter()
}

dependencies {
    compile 'com.github.kittinunf.reactiveandroid:reactiveandroid-ui:<latest-version>' //for base UI
    compile 'com.github.kittinunf.reactiveandroid:reactiveandroid-appcompat-v7:<latest-version>' //for appcompat-v7 module
    compile 'com.github.kittinunf.reactiveandroid:reactiveandroid-support-v4:<latest-version>' //for support-v4 module
    compile 'com.github.kittinunf.reactiveandroid:reactiveandroid-design:<latest-version>' //for design support module
}

Why you might need this?

Have you ever wish Android SDK had supported RxJava by default? Well, you have that wish with ReactiveAndroid.

Let's say, you need to observe view being clicked. Yes, you definitely can do it with View.OnClickListener. However, with ReactiveAndroid, you can simply do this:

button.rx.click().subscribe {
    //do something when button is clicked
}

Or, let's assume that you have Observable<String> that wants to be outputted with TextView. You can just do this:

val o = Observable.just("Hello")
o.map { "$it Bob" }.subscribe(textView.rx.text)

From above example, whenever Observable emits next, it will bind with setText(value) of TextView.

In this way, you could construct your logic as Observable in Presenter or ViewModel, then bind it with your view to make it updated.

This makes ReactiveAndroid a powerful tool to perform data binding in your MV* architecture (MVP, MVVM).

Another example is registration form. You probably want to know whether input email & password are valid or not. So that, you could disable/enable button as user types.

val emails = emailEditText.rx.text().map { it.toString() } // becomes Observable<String> for email
val passwords = passwordEditText.rx.text().map { it.toString() } // becomes Observable<String> for password

val emailValids = emails.map { Pattern.matches(EMAIL_PATTERN, it) }
val passwordValids = passwords.map { it.length > PASSWORD_LENGTH }

val emailAndPasswordValids = Observables.combineLatest(emailValids, passwordValids) { user, pass -> user and pass } // becomes Observable<Boolean> for validity

emailAndPasswordValids.bindTo(signInButton.rx.enabled) // bind validity value with button

Sample

There are couple of sample code that take advantage power of ReactiveAndroid. You can checkout in sample folder.

Terminology

We want to be familiar as much as possible to the Android SDK. So that Event and Property from Android elements follow naming convention of Android SDK whenever it can.

Events

Think about listener from Android SDK of your choice, then remove the word "on" and also the word "listener". Then, append that "name" after rx_.

For example,

  • View.OnClickListener => view.rx.click()
  • RatingBar.OnRatingBarChangeListener => ratingBar.rx_ratingBarChange()
  • MenuItem.OnMenuItemClickListener => menuItem.menuItemClick() etc.

Properties

Think about name of property of UI element from Android SDK. Remove {set|get|is|has}. Then, append after rx_ in the similar fashion as Events.

For example,

  • View.setEnabled/isEnabled => view.rx.enabled
  • DatePicker.setMinDate/getMinDate => datePicker.rx_minDate
  • RecyclerView.setHasFixedSize/hasFixedSize => recyclerView.rx_hasFixedSize etc.

Credits

ReactiveAndroid is brought to you by contributors.

Licenses

ReactiveAndroid is released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].