Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 1.58 KB

README.md

File metadata and controls

64 lines (50 loc) · 1.58 KB

StateLayout

API Android CI

ScreenShot

Adding to your project

  1. Add the JitPack repository to your build.gradle at the end of repositories:
repositories {
  ...
  maven { url 'https://jitpack.io' }
}
  1. Add the dependency
implementation 'com.github.ctrlbytes:StateLayout:LATEST_VERSION_HERE'

Usage

<com.ctrlbytes.statelayout.StateLayout
    android:id="@+id/state_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:buttonText="@string/try_again"
    app:emptyImage="@drawable/ic_inbox"
    app:errorImage="@drawable/ic_cactus">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Inbox Content" />

</com.ctrlbytes.statelayout.StateLayout>
showContent()
showLoading()
showError(message)
showEmpty(message)

onButtonClick {
    // handle button click
}

Attributes

Attribute Usage
buttonText Retry Button Text
emptyImage Empty State Icon
errorImage Error State Icon
loadingView Custom Loading View
retryButtonStyle Retry Button Style