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 .
➤ 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()
Logo credit: Alex Gorbunov
➤ License
The source code is licensed under the Apache License 2.0.