Skip to content

Latest commit

 

History

History

reactive2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Reactive2 Supplies

Release

Reactive2 Supplies utility library.

Usage

Collected Rx2 enclosed utilities.

provided 'io.reactivex:rxjava:2.1.+'

ObservableGlue

ObservableGlue provides a simple interface to glue an Android Data Binding Observable field to a Flowable emitting changes within a reactive stream.

ObservableGlue.with(observableLong)
              ....
              .subscribe(onNext);

This is particularly useful to observe user input.

RxOkCall

RxOkCall provides an Rx wrapper around OkHttp exposing an rx.Single<Response> emitting the okHttp3.Response or any error to the reactive stream.

RxOkCall.from(call)
        ....
        .subscribe(consumeResponse, onError);
provided 'com.squareup.okhttp3:okhttp:3.8.+'

In contrast to Rx1, null values are not supported with Rx2. Therefore only primitive values are supported directly. For an ObservableField it is necessary to implement a Null Object pattern or wrap the field value with an Optional or similar.

ObservableGlue.with(observableField, 0, null, o -> Optional.ofNullable(o.get()))
              ....
              .subscribe(onNext);

Installation

Add JitPack to your repositories and Reactive2 Supplies to your dependencies

dependencies {
    compile "berlin.volders.supplies:reactive2:$suppliesVersion"
}

License

Copyright (C) 2016 volders GmbH with <3 in Berlin

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.