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

Overview

Loading Layout for Android 🔁

Loading layout example

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line. It takes away the boilerplate of setting view.setVisibility on all your various views when the state of your screen transitions between loading/loading overlay/ completed/error/empty states.

Usage

  1. Add it to your XML layout and add in your various layouts as direct children of LoadingLayout.
  2. Make sure to add in android:tag to your elements corresponding to what you'd like them to represent:
Layout type android:tag
Complete @string/ll_complete
Loading @string/ll_loading
Empty (optional view) @string/ll_empty
Error (optional view) @string/ll_error

Your layout should end up looking something like this:

... ">
<com.valartech.loadinglayout.LoadingLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        
        <TextView
            android:tag="@string/ll_empty"            
            ...
            />

        
        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:tag="@string/ll_loading" />

        
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:tag="@string/ll_complete">
          ...
        FrameLayout>

        
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:tag="@string/ll_error"
            android:text="@string/error"
            />
    com.valartech.loadinglayout.LoadingLayout>
  1. And now chunks of code like this:
loadingView?.visibility = View.VISIBLE
completeView?.visibility = View.GONE
emptyView?.visibility = View.GONE
errorView?.visibility = View.GONE

can be replaced by loadingLayout.setState(LOADING)

Adding to your project

Release

//in your project-level build.gradle
allprojects {
    repositories { //not under buildscript
        maven { url "https://jitpack.io" } 
    }
}

//in your app module's build.gradle
dependencies {
    implementation "com.valartech:loading-layout:${version}"
}

Custom XML attributes

Attribute Description
default_state Initial state of the view. Defaults to complete.
overlay_tint Colour of the overlay tint. Defaults to 50% transparent black.
cross_fade_success Enable cross-fade animation when transitioning loading -> complete. Defaults to true

Tips

  • You're free to use a single view (like a ProgressBar) or a container of views(like a ConstraintLayout) as a child of the LoadingLayout.
  • The LOADING_OVERLAY is a special state that shows the loading state over the completed state, with a tint applied over it. It also prevents button clicks from reaching the completed layout.
  • Use tools:default_state to quickly check how different view states would look within your layout.

Contributing

Thank you for wanting to add to this project! Please go through the Contributing guide for details on how you can help.

Caveat

This library does add in an extra view into your layout hierarchy, and would thus cause a slight hit in performance. We have not seen this be a noticeable issue in our apps even on complex views, but use as per your discretion on deeply nested layouts.

You might also like...
:seedling: A custom loading view for android, just like alipay.
:seedling: A custom loading view for android, just like alipay.

#SmileyLoadingView A custom loading view, just like alipay. Usage Edit your layout XML: cn.refactor.smileyloadingview.lib.SmileyLoadingView

KdLoadingView - A Custom Loading View for Android
KdLoadingView - A Custom Loading View for Android

KdLoadingView This is a circular loading view for android. Motivation In default progress view, its hard to change drawable, color and animation. So t

A feature rich staged progress bar with modifiable steps in between its stages.
A feature rich staged progress bar with modifiable steps in between its stages.

StageStepBar A staged progressbar that you can use if you want finer control of the steps in between its stages. You can customize: Number of steps be

A simple and flexible Fillable Progress Layout written in Kotlin
A simple and flexible Fillable Progress Layout written in Kotlin

FillProgressLayout 🔥 A simple and flexible Fill Progress Layout written in Kotlin 🔥 Netflix button animation using FillProgressLayout Support Librar

An Android library providing to realize wave loading effect.

WaveLoadingView WaveLoadingView - An Android library that provides a realistic wave-loading effect. Sample Usage For a working implementation of this

A wave-like loading drawable
A wave-like loading drawable

#WaveLoading This library provides a wave loading animation as a Drawable. How to use Add dependency: compile 'com.race604.waveloading:library:1.1.1'

A loading animation based on Floating Action Button
A loading animation based on Floating Action Button

FAB-Loading A loading animation based on Floating Action Button. Usage Include the LoadingView widget in your view: io.saeid.fabloading.LoadingView

Some loading GIF .
Some loading GIF .

Android GifLoadingView This project idea is from Link . Thanks for the idea. I like all the animation in that webpage , but it's so hard to develop al

MaterialLoadingProgressBar   provide a styled ProgressBar which looks  like SwipeRefreshLayout's loading indicator(support-v4  v21+)
MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4 v21+)

MaterialLoadingProgressBar MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4

Releases(1.0.0)
Owner
ValarTech
Building delightful digital experiences
ValarTech
Android library to realize the various states and transitions in a ProgressBar.

StateProgressBar StateProgressBar is an Android library to realize the various states and transitions in a ProgressBar. Quick Start Get a feel of how

Kofi Gyan 1.5k Jan 9, 2023
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

dinus_developer 4.1k Dec 27, 2022
Customizable bouncing dots for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

LoadingDots for Android Customizable bouncing dots view for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

Eyal Biran 162 Dec 2, 2022
A circular android ProgressBar library which extends View, and the usage same as ProgressBar, It has solid,line and solid_line three styles. Besides, progress value can be freely customized.

CircleProgressBar 中文版文档 The CircleProgressBar extends View, It has both solid and line two styles. Besides, progress value can be freely customized. I

dinus_developer 1.2k Jan 3, 2023
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'

Cloudist Technology Co., Ltd. 234 Nov 24, 2022
An Android percentage chart that displays the progress of any single given task or information.

Percentage Chart View A Java-based easy to use and highly adjustable custom view that displays the progress of a single given task. Please feel free t

Rami Jemli 364 Dec 20, 2022
ColoringLoading 4.7 0.0 Java This project provide Coloring Loading View for Android. And this project is not using the image file!

ColoringLoading ![Release](https://img.shields.io/github/release/recruit-lifestyle/ColoringLoading.svg?label=maven version) This project provide Color

Recruit Lifestyle Co. Ltd. 379 Jul 25, 2022
Android loading view

Loading Loading is a poject with kinds of Android loading view. Yan can see the wiki for more detail. RotateLoading BookLoading NewtonCradleLoading Us

null 1.2k Jan 1, 2023
An animated circle loading view

Animated Circle Loading View A determiante/indetermiante loading view animation. Based on android-watch-loading-animation by Nils Banner. How it looks

José Luis Martín 1.2k Dec 7, 2022
Cool bezier loading view

What's BezierLoadingView ? A cool loading view with Bezier and a smooth circular motion, Demo Features Bezier Circular motion ##Attributes name format

巴掌 828 Oct 10, 2022