• Stars
    star
    263
  • Rank 155,624 (Top 4 %)
  • Language
    Java
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementation of pure functional concept of talking to Android View layer in a Reactive way

RxUi: Observable <-> Observable

Minimal implementation of the concept of talking to Android View layer in a Reactive way described here.

RxUi solves 3 main problems of communication between Presenters/ViewModels/etc and View layer in Android applications:
  1. Main Thread should be part of View layer, Presenters/ViewModels/etc should not know about it.
  2. Action posted to Main Thread should be part of Disposable so you could dispose() it and prevent execution.
  3. Backpressure occurred on the View layer should be detected and handled on Presenter/ViewModel/etc layer above.

Sample Apps

Check Sample app written in Java and Sample app written in Kotlin.

RxUi is so tiny that you may not even see it in the code at the first sight!


Basically, RxUi is just two main functions:
  1. bind(Observable<T>): Disposable
  2. ui(Consumer<T>): Function<Observable<T>, Disposable>

And concept of Observable <-> Observable in the View layer when View only produces Observables and consumes Observables.

interface SignInView {
  // Produces.
  Observable<String> login();
  Observable<String> password();
  Observable<Object> signInClicks();
  
  // Consumes.
  Function<Observable<Boolean>,      Disposable> signInEnable();
  Function<Observable<SignInResult>, Disposable> signInResult();
}

Download

RxUi

Only two functions at the moment: RxUi.bind() (use it in Presenters/ViewModels) and RxUi.ui() use it in View layer.

compile 'com.artemzin.rxui2:rxui:2.0.0'

 

RxUi Test

Only one function at the moment: TestRxUi.testUi(), basically same as RxUi.ui() except that it's synchronous and does not know about Main Thread.

testCompile 'com.artemzin.rxui2:rxui-test:2.0.0'

 

RxUi Kotlin

Only one extension function at the moment: Observable.bind(), absolutely same as RxUi.bind() but easier to use in Kotlin.

compile 'com.artemzin.rxui2:rxui-kotlin:2.0.0'

 


Made with ❤️ by Artem Zinnatullin, discussed with Juno Android Team and @FE_Hudl.

More Repositories

1

qualitymatters

Android Development Culture
Java
1,755
star
2

RxJavaProGuardRules

ProGuard rules for RxJava shipped as AAR!
Shell
719
star
3

TheContext-Podcast

Podcast about Android Development with Hannes Dorfmann, Artem Zinnatullin, Artur Dryomov and wonderful guests!
625
star
4

AndroidStudio-VM-Options

JVM options for smoother Android Studio experience
140
star
5

android-wail-app

DEPRECATED Android Last.fm scrobbler. Recruiters: please don't look at this project.
Java
121
star
6

droidcon-nyc-2017-puzzlers

RxJava and Kotlin Puzzlers! Follow our Engineering Blog for article with explanation
Kotlin
101
star
7

AutoJackson

Small example of AutoValue/AutoParcel + Jackson
Java
73
star
8

AssertParcelable

Checks Parcelable implementation.
Java
48
star
9

dev-null-android

Dev null as Service comes to android!
Java
48
star
10

jet-image-loader

WP7+ fast and powerfull image loader with memory and storage caching for your projects!
C#
44
star
11

RxKoans

(Experimental) set of excersices in for of unit tests to improve your Rx (RxJava, Project Reactor, etc) skills
Kotlin
35
star
12

java-uncheck-exceptions

0-deps library for throwing checked exceptions as unchecked without wrapping!
Kotlin
19
star
13

Android-AsyncTask-Executor

DEPRECATED You want to execute your AsyncTask concurrently on any version of Android OS? You need AsyncTaskExecutor!
Java
18
star
14

error-prone-performance

Project to benchmark and profile Error-Prone performance to uncover bottlenecks.
Java
13
star
15

RxJavaV1V2Adapter

Adapter between RxJava v1 and v2
Java
13
star
16

android-lint-cli

Prebuilt jars of Android Lint CLI tool.
9
star
17

build-demo

Demo of building same code with different build systems.
Java
8
star
18

ScreenValley

NO MORE FRAGMENTS HELL
Java
6
star
19

yota-test-task

Test task for Yota company
Java
3
star
20

macos-input-sound-toggle

Tiny macOS executable to toggle input sound on and off preserving prev volume level.
Shell
2
star
21

Android-VK-Api

DEPRECATED! (Not supported + code base is not so good) Need to work with vk.com in your Android app? Just use Android-VK-Api library!
Java
2
star