ViewStateLayout - Easy way to manage common state templates like loading, empty, error etc.!

Last update: Jun 11, 2022

ViewStateLayout

Easy way to manage common state templates like loading, empty, error etc.!

How to

Step 1. Add the JitPack repository to your build file

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

Step 2. Add the dependency

dependencies {
  implementation 'com.github.kamrul3288:ViewStateLayout:1.0.4'
}

Usage

Then wrap a view which target area(view) to show states.

">
<com.iamkamrul.library.ViewStateConstraintLayout
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
        
       <androidx.recyclerview.widget.RecyclerView
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          android:id="@+id/listRv"
          android:layout_width="0dp"
          android:layout_height="0dp"/>
        
        
 com.iamkamrul.library.ViewStateConstraintLayout>

Finally in your activity/fragment get reference and call showXXX methods

binding.root.setSimpleProgressBarStatus(true)
binding.root.showSimpleNetworkError {
  // refresh button call
}

API(Also support lottie animation) and customization

fun setSimpleProgressBarStatus(status:Boolean, progressBarColor:Int = R.color.orange)
fun showSimpleNetworkError(
errorImage:Int = R.drawable.ic_no_internet,
title:String = context.getString(R.string.title_no_internet),
message:String = context.getString(R.string.message_no_internet),
buttonText:String = context.getString(R.string.button_refresh),
buttonDrawable:Int = R.drawable.bg_orange_border_radius_30,
buttonTextColor:Int = R.color.white,
refreshCallback:()->Unit
)
fun hideSimpleNetworkError()
fun showSimpleDataEmptyView(
emptyImage:Int = R.drawable.ic_no_result,
message:String = context.getString(R.string.message_no_data_found),
buttonText:String = context.getString(R.string.button_refresh),
buttonDrawable:Int = R.drawable.bg_orange_border_radius_30,
buttonTextColor:Int = R.color.white,
refreshCallback:()->Unit
)
fun hideSimpleDataEmptyView()

License

Copyright 2022 Kamrul Hasan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GitHub

https://github.com/kamrul3288/ViewStateLayout
You might also like...

ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way

ConstraintLayout is a layout manager for Android which allows you to position and size widgets in a flexible way. It's available for both the Android view system and Jetpack Compose.

Jun 17, 2022

An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu

ResideLayout An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu. Can be used on Android 1.6(I haven't try it.)

Apr 15, 2022

This component like SwipeRefreshLayout, it is more beautiful than SwipeRefreshLayout.

This component like SwipeRefreshLayout, it is more beautiful than SwipeRefreshLayout.

android-PullRefreshLayout This component like SwipeRefreshLayout, it is more beautiful than SwipeRefreshLayout. Demo Usage Add dependency. dependencie

Jun 21, 2022

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images.  Plugins are available for features like markers, hotspots, and path drawing.

This project isn't maintained anymore. It is now recommended to use https://github.com/peterLaurence/MapView. MapView is maintained by Peter, one of o

Jun 7, 2022

Easy, flexible and powerful Swipe Layout for Android

Easy, flexible and powerful Swipe Layout for Android

SwipeRevealLayout A layout that you can swipe/slide to show another layout. Demo Overview Drag mode Drag mode normal: Drag mode same_level: Features F

Jun 23, 2022

A lightweight, good expandability Android library used for displaying different pages like loading, error, empty, timeout or even your custom page when you load a page

A lightweight, good expandability Android library used for displaying different pages like loading, error, empty, timeout or even your custom page when you load a page

中文 | English LoadSir 👉 👈 LoadSir是一个高效易用,低碳环保,扩展性良好的加载反馈页管理框架,在加载网络或其他数据时候,根据需求切换状态页面, 可添加自定义状态页面,如加载中,加载失败,无数据,网络超时,如占位图,登录失效等常用页面。可配合网络加载框架,结合返回 状态

Jun 14, 2022

🤹 Common Kotlin utilities made for my personal usage, comes with SLF4J utilities, common extensions, common Gradle utilities, and more.

🤹 common-utils Common Kotlin utilities made for my personal usage, comes with SLF4J utilities, common extensions, ansi-colours, common Gradle utiliti

Jan 15, 2022

Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel

Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel

ACProgressLite English Version / 中文版本 An Android loading widget library. Lite and easy to use, strong customizability. Can be used to implement 'iOS'

Apr 22, 2022

Compose-buttons - A set of Loading animations used in Buttons to convey a "loading" state after the button is clicked.

Compose-buttons - A set of Loading animations used in Buttons to convey a

Loading Buttons A set of Loading animations used in Buttons to convey a "loading" state after the button is clicked. A simple demo application that sh

Mar 17, 2022

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

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

State Views for Android (BETA version) Create & Show progress, data or error views, the easy way! StateViews is based on ViewSwitcher mechanism and al

May 18, 2022

Example Jetpack Compose Android App, that uses the newest mechanisms, like StateFlow, SharedFlow, etc. to manage states and handle events. ViewModel, UI and Screenshot tests included :)

Example Jetpack Compose Android App, that uses the newest mechanisms, like StateFlow, SharedFlow, etc. to manage states and handle events. ViewModel, UI and Screenshot tests included :)

AndroidMVIExample Example Jetpack Compose Android App, that uses the newest mechanisms, like StateFlow, SharedFlow, etc. to manage states and handle e

Jun 6, 2022

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

May 20, 2022

Collection of source codes, utilities, templates and snippets for Android development.

Android Templates and Utilities [DEPRECATED] Android Templates and Utilities are deprecated. I started with this project in 2012. Android ecosystem ha

May 30, 2022

Collection of Compose UI Templates

Collection of Compose UI Templates

Compose UI Templates This repository contains set of Android compose ui templats which helps you to learn compose in Android. 💻 Requirements To try o

Jun 17, 2022

Android Templates: RxJava

Android Templates: RxJava Our optimized Android templates used in our android projects Setup Clone the project Checkout our main development branch ko

Dec 29, 2021

A Common RecyclerView.Adapter implementation which supports all kind of items and has useful data operating APIs such as remove,add,etc.

A Common RecyclerView.Adapter  implementation which supports all kind of items and has useful data operating APIs such as remove,add,etc.

##PowerfulRecyclerViewAdapter A Common RecyclerView.Adapter implementation which supports any kind of items and has useful data operating APIs such as

Apr 22, 2022

Just a Wheel——A easy way to setEmptyView to ListView、GridView or RecyclerView etc..

 Just a Wheel——A easy way to setEmptyView to ListView、GridView or RecyclerView etc..

中文说明在这里 TEmptyView Just a Wheel—— A easier way to setEmptyView. Without having to write xml file every time. It supports AdapterView(ListView,GridView

Apr 24, 2022

💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. 💳 EasyFlipView Built with ❤︎ by Wajahat Karim and

Jun 16, 2022

💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. 💳 EasyFlipView Built with ❤︎ by Wajahat Karim and

Jun 16, 2022
Allows the easy creation of animated transition effects when the state of Android UI has changed
Allows the easy creation of animated transition effects when the state of Android UI has changed

android-transition Android-Transition allows the easy creation of view transitions that reacts to user inputs. The library is designed to be general e

Jun 15, 2022
Jun 13, 2022
A layout that creates a loading-like progress around it's child ( circle ) on touch, inspired from Destiny's ( PS4 ) accept mechanism
A layout that creates a loading-like progress around it's child ( circle ) on touch, inspired from Destiny's ( PS4 )  accept mechanism

HoldToLoadLayout HoldToLoadLayout is a view group that can contain a single child. It draws your child to middle of layout, and performs loading wheel

Feb 8, 2022
A customize multiple state layout for Android.
A customize multiple state layout for Android.

MultiStateLayout ?? A customize multiple state layout for Android. (中文文档) Preview Download the sample apk to see more: Sample APK. Setup Add the multi

Nov 24, 2021
Android Library that lights items for tutorials or walk-throughs etc...
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

Jun 23, 2022
A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc. really a practical RefreshLayout!
A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc.  really a practical RefreshLayout!

RecyclerRefreshLayout English | 中文版 RecyclerRefreshLayout based on the {@link android.support.v4.widget.SwipeRefreshLayout} The RecyclerRefreshLayout

Jun 18, 2022
Material Design Search View Layout, now implemented in Google Maps, Dialer, etc

THIS PROJECT IS DEPRECATED Component is not maintained anymore. Implementation of Lollipop+ Dialer and Google Maps. DEMO Add in View Add to your layou

Jun 15, 2022
An elegant way to show your menu or messages.

Android View Hover In my opinion, jumping to a new activity to show your menu is a kind of wasting time and life. So, I think, we need a hover view, t

Jun 15, 2022
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Jun 15, 2022
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Jun 17, 2022