Create & Show progress, data or error views, the easy way!

Overview

State Views for Android (BETA version)

Create & Show progress, data or error views, the easy way!

Android States Page Cover

StateViews is based on ViewSwitcher mechanism and allows to handle the different app states, from loading... to displaying data and error views, the library is tiny and fully customizable.

<sakout.mehdi.StateViews.StateView
        android:id="@+id/status_page"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="Hello World!" />

 </sakout.mehdi.StateViews.StateView>

Then Call the appropriate state:

mStatusPage.displayLoadingState();
mStatusPage.displayState("TAG_NAME");
mStatusPage.hideStates();

Setup

Snapshot

implementation 'com.github.medyo:state-views:0.2'

Usage

medyo/StateViews/app/

1. Available attributes for PageStatus Builder

Function Description
addState(params) Create a new state
setIconColor(Int) Set Icon color
setIconSize(Int) Set Icon Size
setTextColor(Int) set Title and description colors
setFontFace(String) Set Custom font
setButtonBackgroundColor(Int) Set Button Background color
setButtonTextColor(String) Set Button Text color

2. Available attributes for PageStatesView

Function Description
displayState(String) Display a state by his tag name
hideStates() Hide all states and display data
displayLoadingState() Display the loading state
addCustomState(Intent) Create a new state only available for the current activity, fragment...
setOnStateButtonClicked(View.OnClickListener) Click listener for the state button
applyGravity(Int) Set View Gravity

3. Samples

Display an Error View

No Connection

addState(
    "TAG_ERROR",
    "No Connection",
    "Error retrieving information from server.",
    AppCompatResources.getDrawable(this, R.drawable.ic_server_error),
    "Retry"
    );

mStatusPage.displayState("TAG_ERROR");

Display a "no Data" View

No Data

addState(
    "TAG_NO_RESULTS",
    "No Results Found",
    "Unfortunately I could not find any results matching your search",
    AppCompatResources.getDrawable(this, R.drawable.search), null
)

mStatusPage.displayState("TAG_NO_RESULTS");

Contribute

Contributions are welcome!

ProGuard

Nothing to include

License

The MIT License (MIT)
Copyright (c) 2018 Mehdi Sakout

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You might also like...
[Android] Round Corner Progress Bar Library for Android
[Android] Round Corner Progress Bar Library for Android

RoundCornerProgressBar Round corner is cool. Let's make your progress bar to round corner Colorful progress bar with round corner on progress which yo

Material progress circle around any FloatingActionButton. 100% Guidelines.
Material progress circle around any FloatingActionButton. 100% Guidelines.

FABProgressCircle Android library to provide a material progress circle around your FloatingActionButton. This component is compatible with any existe

Android AlertDialog with moving dots progress indicator

Spots progress dialog Android AlertDialog with moving spots progress indicator packed as android library. =========== Usage The library available in m

This is beautiful color arc progress bar.
This is beautiful color arc progress bar.

ColorArcProgressBar 中文版 This is a customizable circular progressbar.It can achieve the effect of the QQ health's arc progress with XML. What's more, w

Present your progress bars in arc mode with information and total control.
Present your progress bars in arc mode with information and total control.

ArcProgressStackView Present your progress bars in arc mode with information and total control. You can check the sample app here. Warn This library i

A customizable, animated progress bar that features rounded corners. This Android library is designed to look great and be simple to use 🎉
A customizable, animated progress bar that features rounded corners. This Android library is designed to look great and be simple to use 🎉

RoundedProgressBar Easy, Beautiful, Customizeable The RoundedProgressBar library gives you a wide range of customizable options for making progress ba

A material style progress wheel compatible with 2.3
A material style progress wheel compatible with 2.3

![](https://img.shields.io/badge/Methods and size-106 | 12 KB-e91e63.svg) Material-ish Progress A material style progress wheel compatible with 2.3 Tr

Some beautiful android loading drawable, can be combined with any view as the LoadingView or the ProgressBar. Besides, some Drawable can customize the loading progress too.
Some beautiful android loading drawable, can be combined with any view as the LoadingView or the ProgressBar. Besides, some Drawable can customize the loading progress too.

LoadingDrawable: Android cool animation collection 前言 CircleRotate源码解析 Fish源码解析 LoadingDrawable is some android animations implement of drawable: a li

[Android] Round Corner Progress Bar Library for Android
[Android] Round Corner Progress Bar Library for Android

RoundCornerProgressBar Round corner is cool. Let's make your progress bar to round corner Colorful progress bar with round corner on progress which yo

Comments
  • Error on Gradle

    Error on Gradle

    Hi @medyo ,

    Thanks for the lib! I added your lib into my project but when I compile the project, AS cannot manage to find your lib and getting;

    Error:(50, 13) error: cannot find symbol class StateView

    Why?

    Thanks!

    bug 
    opened by nuhkoca 6
  • Cause: couldn't make a guess for sakout.mehdi.StateViews.library.StateView

    Cause: couldn't make a guess for sakout.mehdi.StateViews.library.StateView

    hey @medyo i want to use your lib with data binding first i declare it in xml like that <sakout.mehdi.StateViews.StateView but it give me this issue error: cannot find symbol class StateViews when i see issues lib i try to edit it like that <sakout.mehdi.StateViews.libbrary.StateView it give me this issue Cause: couldn't make a guess for sakout.mehdi.StateViews.library.StateView i want to use your lib so can you help me please !

    opened by Isma3ilMohamed 4
  • When update android studio 3.2 and gradle 3.2.0 error package does not exist when use databinding.

    When update android studio 3.2 and gradle 3.2.0 error package does not exist when use databinding.

    Hi @medyo

    I  update android studio 3.2 and Gradle 3.2.0 but error package does not exist. But i  can use StateViews in Gradle 3.1.4.  Can you update support Gradle 3.2.0? 
    
    opened by felasia 1
Owner
Mehdi Sakout
Software Engineer with an entrepreneurial spirit!
Mehdi Sakout
Android library with collection of cool progress views.

CoolProgressViews Android library with collection of cool progress views. DEMO LINK Also Mention in: Android Library Hunt MaterialUp DEMO DOWNLOAD Add

Amanjeet Singh 83 Nov 29, 2022
Progress Views Library

ProProgressViews Android library with collection of amazing progress views. DEMO Mentions MaterialUp Android Library Hunt DOWNLOAD Add this to your ro

Damanpreet Singh 83 Nov 29, 2022
A progress wheel for android, intended for use instead of the standard progress bar.

Deprecation warning This project is no-longer maintained, and has not been maintained for a few years now. If you're looking for an alternative librar

Todd Davies 2.7k Dec 29, 2022
:barber: [Android Library] Stacked dual progress indicator progress-bar

StackedHorizontalProgressBar Specs Featured in Show some ❤️ Android library with ability to show two progress indicators in one horizontal progress ba

Nishant Srivastava 98 Nov 11, 2022
IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

heyangyang 6 Aug 25, 2022
DownloadProgressBar is an android library that delivers awesome custom progress bar. You can manipulate it's state in every way.

Download Progress Bar Android progress bar with cool animation, inspired by : https://dribbble.com/shots/2012292-Download-Animation ###Attributes Attr

Mariusz Brona 978 Nov 10, 2022
Android fillable progress view working with SVG paths. This is a nice option too if you want to create an interesting branding logo for your app. Based on the iOS project: https://github.com/poolqf/FillableLoaders

Android FillableLoaders Android Open Source library providing an interesting fillable progress view working with SVG paths. This is a nice option too

Jorge Castillo 2k Jan 1, 2023
A simple lib to create a ring-like progress view with corner edges

ProgressRingView Installation Gradle: dependencies { compile 'com.github.flepsik:progress-ring-view:1.2.1' } Maven: <dependency> <groupId>com.g

null 71 Dec 5, 2021
ArcProgressbar project let create Arc progressbar in android in simplest way.

Arc Progressbar In Android ArcProgressbar project let create Arc progressbar in android in simplest way. USAGE To make a Arc Progressbar add ArcProgre

Manish 40 Dec 11, 2022
Android library to display progress like google does in some of his services.

GoogleProgressBar This library is not maintained anymore and there will be no further releases Android library to display different kind of google rel

JPARDOGO 1.3k Dec 27, 2022