Android-MultiStateListView

Additional

Language
Java
Version
v1.0-Gradle (Sep 17, 2014)
Created
Nov 8, 2013
Updated
Sep 17, 2014 (Retired)
Owner
Jens Driller (jenzz)
Contributor
Jens Driller (jenzz)
1
Activity
Badge
Generate
Download
Source code

Advertisement

Android - MultiStateListView

A simple Android ListView that lets you define three states:

  • Loading
  • Empty
  • Error

Screenshots

     

Usage

  • Define the MultiStateListView via XML (use custom attributes to reference the state layouts):
<com.jensdriller.libs.multistatelistview.MultiStateListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        custom:emptyView="@layout/empty_view"
        custom:errorView="@layout/error_view"
        custom:loadingView="@layout/loading_view" />
  • Or build it via Java:
  MultiStateListView multiStateListView = new MultiStateListView.Builder(this)//
  .loadingView(R.layout.loading_view)//
  .emptyView(R.layout.empty_view)//
  .errorView(R.layout.error_view)//
  .build();
  • Show the desired state based on your logic:
  multiStateListView.showLoadingView();
  multiStateListView.showEmptyView();
  multiStateListView.showErrorView();

Example

Check out the sample project for an example implementation.

Download

Grab it via Gradle:

compile 'com.github.jenzz.multistatelistview:library:1.0'

or Maven:

<dependency>
  <groupId>com.github.jenzz.multistatelistview</groupId>
  <artifactId>library</artifactId>
  <version>1.0</version>
</dependency>

License

This project is licensed under the MIT License.