/StateLayout

Primary LanguageKotlinApache License 2.0Apache-2.0

StateLayout

A completely customizable StateLayout.

preview

Installation

Step 1. Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency

dependencies {
    implementation 'com.github.eprendre:StateLayout:v0.2'
}

Usage

  1. Extends StateLayout.
  2. Make sure each layout returned by getStateLayouts has an id.
  3. Change layout by assigning displayedChildId with previously defined id. R.id.state_content is reserved for content.
  4. Add features as you need. See example CustomStateLayout, SimpleStateLayout.

Animation

Since this is a subclass of ViewAnimator, you can set animation directly from layout.

    <xxxStateLayout
        ...
        android:inAnimation="@android:anim/fade_in"
        android:outAnimation="@android:anim/fade_out"
        >

Programmatically: setInAnimation(); setOutAnimation();