All Projects → skedgo → RxProperty

skedgo / RxProperty

Licence: MIT license
RxJava binding APIs for observable fields and observable collections from the Data Binding Library

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to RxProperty

AndroidMVPArchitecture
Android MVP architecture sample project with or without RxJava and Dagger2 and Kotlin
Stars: ✭ 78 (+358.82%)
Mutual labels:  rxjava, data-binding
rx-property-android
Bindable and observable property for Android Data Binding
Stars: ✭ 76 (+347.06%)
Mutual labels:  rxjava, data-binding
Alfonz
Mr. Alfonz is here to help you build your Android app, make the development process easier and avoid boilerplate code.
Stars: ✭ 90 (+429.41%)
Mutual labels:  rxjava, data-binding
NewsReader
Android News Reader app. Kotlin Coroutines, Retrofit and Realm
Stars: ✭ 21 (+23.53%)
Mutual labels:  rxjava
databind-js
A powerful and flexible MVC data binding library
Stars: ✭ 16 (-5.88%)
Mutual labels:  data-binding
ReadnBuyAndroidApp
Android app developed at the Vanhackathon for Shopify's challenge. Coded with Kotlin, RxJava and MVP.
Stars: ✭ 13 (-23.53%)
Mutual labels:  rxjava
RxLocation
Use with rxjava,No memory leak,Simple
Stars: ✭ 52 (+205.88%)
Mutual labels:  rxjava
RxHttp
基于RxJava2+Retrofit+OkHttp4.x封装的网络请求类库,亮点多多,完美兼容MVVM(ViewModel,LiveData),天生支持网络请求和生命周期绑定,天生支持多BaseUrl,支持文件上传下载进度监听,支持断点下载,支持Glide和网络请求公用一个OkHttpClient⭐⭐⭐
Stars: ✭ 25 (+47.06%)
Mutual labels:  rxjava
rxjava2-http
Transmit RxJava2 Flowable over http with non-blocking backpressure
Stars: ✭ 19 (+11.76%)
Mutual labels:  rxjava
jshodan
Powerful Shodan API client using RxJava and Retrofit
Stars: ✭ 56 (+229.41%)
Mutual labels:  rxjava
android-recyclerview-binding
RecyclerView + Data Binding + LiveData Sample
Stars: ✭ 45 (+164.71%)
Mutual labels:  data-binding
Pokehub
This is a sample project that uses Graphql API's with Rx implementation.
Stars: ✭ 40 (+135.29%)
Mutual labels:  data-binding
ReactiveConnectivity
ReactiveConnectivity - a library for Listen Connectivity Change on Android
Stars: ✭ 22 (+29.41%)
Mutual labels:  rxjava
flickr-android
A small sample app to showcase architecting app using Clean Architecture and MVVM
Stars: ✭ 25 (+47.06%)
Mutual labels:  data-binding
AndroidTutorials
Ejemplos Android [Dagger2,RxJava,MVP,Retrofit2,SQLite]
Stars: ✭ 22 (+29.41%)
Mutual labels:  rxjava
neurosky-android-sdk
Android SDK for the NeuroSky MindWave Mobile Brainwave Sensing Headset
Stars: ✭ 39 (+129.41%)
Mutual labels:  rxjava
rxactivitylauncher
Provide a way to receive the results of the Activity by RxJava.
Stars: ✭ 19 (+11.76%)
Mutual labels:  rxjava
UseCases
This a library that offers a generic implementation of the data layers from the clean architecture by Uncle bob.
Stars: ✭ 23 (+35.29%)
Mutual labels:  rxjava
RxLoading
RxJava library for showing a loading (i.e. progress bar) state while waiting for async data with minimal effort and advanced options.
Stars: ✭ 49 (+188.24%)
Mutual labels:  rxjava
RxAnimator
An RxJava2 binding for android Animator
Stars: ✭ 80 (+370.59%)
Mutual labels:  rxjava

RxProperty

Build Status

RxJava binding APIs for observable fields and observable collections from the Data Binding Library

Usage

A main feature of this library is to provide some extension functions asObservable() to model the changes of observable fields and observable collections via RxJava's Observable. The library is specially helpful for the cases of implementing dependent properties. For example, assume that we have a PersonViewModel that specifies firstName and lastName. Both are represented by ObservableField<String>. There is another fullName that is computed based on firstName and lastName. Whenever one of the 2 properties is updated, fullName should be updated accordingly. By utilizing asObservable() functions, an implementation can be:

class PersonViewModel {
  val firstName = ObservableField<String>()
  val lastName = ObservableField<String>()
  val fullName = ObservableField<String>()

  init {
    Observable.combineLatest(
      firstName.asObservable(),
      lastName.asObservable(), {
      firstName, lastName ->
      if (firstName.isNullOrEmpty() && lastName.isNullOrEmpty()) {
        return firstName
      } else if (firstName.isNullOrEmpty()) {
        return lastName
      } else if (lastName.isNullOrEmpty()) {
        return firstName
      } else {
        return "${firstName}, ${lastName}"
      }
    }).subscribe { fullName.set(it) }
  }
}

That is achieved because when we subscribe to an Observable created by asObservable(), the Observable will emit the current value of ObservableField<String> and also emit any future changes. But what if we are only interested in observing future changes without the current value? Easy, just skip(1), for instance:

val onFullNameChanged = fullName.asObservable().skip(1)

As of now, the library only supports ObservableBoolean, ObservableField, and ObservableList due to our current need. In the future, we may add more asObservable() functions for other kinds. That said, we welcome any external contribution. Pull requests are very highly appreciated.

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].