/StateRelativeLayout

StateRelativeLayout helps you to manage between various UI states, for example, loading state, data state, error state, finish state.

Primary LanguageKotlin

State Relative Layout

License

What is StateRelativeLayout?

StateRelativeLayout helps you to manage between various UI states, for example, loading state, data state, error state, finish state. In architectural patterns such as the MVI pattern in android, you can use the StateRelativeLayout to maintain the state of the model by simply selecting the current state. This works perfectly with RxJava implemented in MVI pattern.

Implementation

[1] In your app module gradle file

dependencies {
    implementation 'com.github.tizisdeepan:staterelativelayout:1.0.0'
}

[2] In your project level gradle file

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

[3] Use StateRelativeLayout in your layout.xml

<com.deepan.staterelativelayout.StateRelativeLayout
        android:id="@+id/stateManager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
</com.deepan.staterelativelayout.StateRelativeLayout>

[4] Set state for your StateRelativeLayout

stateManager.setState(R.id.redState)

Voila! You have implemented an awesome State Manager for your Android Project now!

Developed By

Follow me on Twitter Add me to Linkedin