All Projects → groupon → Grox

groupon / Grox

Licence: apache-2.0
Grox helps to maintain the state of Java / Android apps.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Grox

Android Mvp Architecture
This repository contains a detailed sample app that implements MVP architecture using Dagger2, GreenDao, RxJava2, FastAndroidNetworking and PlaceholderView
Stars: ✭ 4,360 (+1197.62%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Android Kotlin Mvp Architecture
This repository contains a detailed sample app that implements MVP architecture in Kotlin using Dagger2, Room, RxJava2, FastAndroidNetworking and PlaceholderView
Stars: ✭ 615 (+83.04%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Roxie
Lightweight Android library for building reactive apps.
Stars: ✭ 441 (+31.25%)
Mutual labels:  rxjava, rxjava2, state-management
Freezer
A simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
Stars: ✭ 326 (-2.98%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Nybus
NYBus (RxBus) - A pub-sub library for Android and Java applications
Stars: ✭ 283 (-15.77%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Rxcache
简单一步,缓存搞定。这是一个专用于 RxJava,解决 Android 中对任何 Observable 发出的结果做缓存处理的框架
Stars: ✭ 377 (+12.2%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Traceur
Easier RxJava2 debugging with better stacktraces
Stars: ✭ 502 (+49.4%)
Mutual labels:  rxjava, rxjava2, rxjava-android
RxRetroAPICall
API call example using Retrofit and RxJava2
Stars: ✭ 16 (-95.24%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Mvpframes
整合大量主流开源项目并且可高度配置化的 Android MVP 快速集成框架,支持 AndroidX
Stars: ✭ 100 (-70.24%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Rx.observe
Transform any method to an Rx Observable ! (VIPER)
Stars: ✭ 34 (-89.88%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Rxjava2 Operators Magician
你用不惯 RxJava,只因缺了这把钥匙 🔑 You are not used to RxJava, just because of the lack of this key.
Stars: ✭ 868 (+158.33%)
Mutual labels:  rxjava, rxjava2, rxjava-android
android-online-course
Android Online Course
Stars: ✭ 22 (-93.45%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Rxjavapriorityscheduler
RxPS - RxJavaPriorityScheduler - A RxJava Priority Scheduler library for Android and Java applications
Stars: ✭ 138 (-58.93%)
Mutual labels:  rxjava, rxjava2, rxjava-android
Rxanime
Visualizer to understand RxJava operators
Stars: ✭ 261 (-22.32%)
Mutual labels:  rxjava, rxjava2, rxjava-android
RxRealm
Utilities for using RxJava with Realm
Stars: ✭ 23 (-93.15%)
Mutual labels:  rxjava, rxjava-android
mini-kotlin
Minimal Flux architecture written in Kotlin.
Stars: ✭ 20 (-94.05%)
Mutual labels:  flux, state-management
RxWebView
RxJava2 binding APIs for Android's WebView
Stars: ✭ 22 (-93.45%)
Mutual labels:  rxjava, rxjava2
litestate
An ambitiously tiny, gizp ~800b, flux-like library to manage your state
Stars: ✭ 31 (-90.77%)
Mutual labels:  flux, state-management
Rxgps
Finding current location cannot be easier on Android !
Stars: ✭ 307 (-8.63%)
Mutual labels:  rxjava, rxjava2
Reactive
Reactive: Examples of the most famous reactive libraries that you can find in the market.
Stars: ✭ 256 (-23.81%)
Mutual labels:  rxjava, flux

Grox

Grox helps to maintain the state of Java / Android apps.






Understanding Grox

Grox Overview

Video

Grox video

We have a nice video to explain how the Grox sample app works.

Wiki

Visit the Grox wiki

Grox in a nutshell

Grox provides developers with the basic bricks to:

  • create a state of a UI / Application
  • perform pure changes on this state,
  • be notified of state changes (i.e. to update the UI)
  • perform other "side-effects" operations (network calls, manipulating files, etc.)
  • log, persist, create an history of states and state changes

Basic Usage

Very simple example:

//create a store with an initial state
Store<String> store = new Store<>("Hello");
//when the store's state changes, update your UI
states(store).subscribe(System.out::println);
//start dispatching actions to your store...
store.dispatch(oldState -> oldState + " Grox");

A command example

public class RefreshResultCommand implements Command {
 @Override
  public Observable<Action> actions() {
    return getResultFromServer() //via retrofit
        .subscribeOn(io())
        .map(ChangeResultAction::new) //convert all your results into actions
        .cast(Action.class)
        .onErrorReturn(ErrorAction::new) //including errors
        .startWith(fromCallable(RefreshAction::new)); //and progress
  }
}

//then use your command via Rx + RxBinding
subscriptions.add(
        clicks(button)
            .map(click -> new RefreshResultCommand())
            .flatMap(Command::actions)
            .subscribe(store::dispatch));

Note that such a command should be unsubscribed from when the UI element (e.g. an activity) containing the button button will no longer be alive. Otherwise, the Rx chain would leak it.

However, if you preserve your store accross configuration changes (using ViewModels, Dependency Injection (Toothpick/Dagger), retained fragments, etc.), you can also execute commands independently of the lifecycle of the UI:

//then use your command via Rx + RxBinding
subscriptions.add(
        clicks(button)
            .subscribe(click -> new RefreshResultCommand()
                                .actions()
                                .subscribe(store::dispatch)));

In this case, only the outer chain needs to be unsubcribed from when the UI elements are not alive anymore, the inner chain will be preserved during rotation and udpate the store even during a configuration change (e.g. a rotation), and the UI will display the latest when connecting to the store when the rotation is complete. A fine grained management of resources would unsubscribe from the inner chain when the store is not alive anymore.

Browse Grox sample for more details.

Setup

    //note that Grox is also available without Rx dependencies
    implementation 'com.groupon.grox:grox-core-rx:x.y.z'
    //Grox commands artifacts do depend on Rx (1 or 2)
    implementation 'com.groupon.grox:grox-commands-rx:x.y.z'
    implementation 'com.groupon.grox:grox-commands-rx2:x.y.z'

Main features

The main features of Grox are:

  • unify state management. All parts of an app, all screens for instance, can use Grox to unify their handling of state.
  • allows time travel debugging, undo, redo, logging, etc. via middlewares.
  • simple API. Grox is inspired by Redux & Flux but offers a simpler approach.
  • easily integrated with Rx1 and 2. Note that it is also possible to use Grox without Rx.
  • Grox only relies on a few concepts: States, Actions, Stores, MiddleWare & Commands (detailed below).
  • facilitates using immutable states, but without enforcing it for more flexibility. You can use any solution for immutability (Auto-Value, Immutables, Kotlin, etc..) or not use immutability at all if you don't want to.
  • Grox can be used with the Android Arch components, or without them.

Links

Conferences, talks & articles

Credits

The following people have been active contributors to the first version of Grox:

  • Shaheen Ghiassy
  • Michael Ma
  • Matthijs Mullender
  • Turcu Alin
  • Samuel Guirado Navarro
  • Keith Smyth
  • Stephane Nicolas

Inspired by

Grox - Java library for state management, inspired by Flux, Redux, Cycle, and Rx Managed State.

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