Easy Android Loading

Additional

Language
Kotlin
Version
1.2 (Jun 20, 2021)
Created
Dec 18, 2019
Updated
Jun 20, 2021 (Retired)
Owner
Gk Mohammad Emon (Gkemon)
Contributor
Gk Mohammad Emon (Gkemon)
1
Activity
Badge
Generate
Download
Source code

Advertisement

Easy Loading For Android By Just A One Lined Code !!!

Just configure a singleton loading instance once without additional boilerplate code and reuse it to show and hide from anywhere (Both Activity or Fragment) you want .


???? Table of Contents

➤ Table of Contents

➤ Installation

Step 1. Add the JitPack repository to your root build.gradle at the end of repositories

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

Step 2. Add the dependency

dependencies {
  implementation 'com.github.Gkemon:Easy-Android-Loading:1.1'
}

➤ Getting Started

Setup default configuration :

class MainActivity : AppCompatActivity() {
     .
     .
     .
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
 
       /* It is the mandatory configuration which is needed to be
        * declared after calling setContentView --*/
        
       LoadingPopup.getInstance(activity)
                   .defaultLovelyLoading()
                   .build()
     
 /*OR*/    
     
       /* If adding background color or opacity is needed then -- */
        LoadingPopup.getInstance(activity)
                            .defaultLovelyLoading()
                            .setBackgroundColor(android.R.color.holo_red_dark)
                            .setBackgroundOpacity(myBackgroundOpacity)/*Int between 0-100*/
                            .build()
        .
 .     
       }

Setup custom configuration :

class MainActivity : AppCompatActivity() {
     .
     .
     .
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
 
       LoadingPopup.getInstance(activity)
                .customLoading()
                .setCustomViewID(R.layout.layout_my_custom_loading)
   /*layout resource id which holds the custom loading view. If setting up  
    *background color is needed for the inputted layout then call it like that
    *setCustomViewID(R.layout.layout_my_custom_loading,R.color.my_color)*/
                .doIntentionalDelay()
  /*If intentional delay is needed. Otherwise call .noIntentionalDelay()*/
                .setDelayDurationInMillSec(5000)
                .setBackgroundOpacity(myBackgroundOpacity)
                .build()

        .
 .     
       }

Showing or Hiding Loading:


          /* For showing loading just call  --> */
           LoadingPopup.showLoadingPopUp()
  
  
          /* For hiding loading just call --> */
           LoadingPopup.hideLoadingPopUp()
  

LinkedIn   Inbox

Logo credit: Alex Gorbunov

➤ License

The source code is licensed under the Apache License 2.0.