🌠An animated loading button.
Add it in your root build.gradle
at the end of repositories:
allprojects {
repositories {
//...omitted for brevity
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation "com.github.kojofosu:AnimatedLoadingButton:$latest_release"
}
Sample implementation here
- Add
ALBButton
in your layout xml file
<com.mcdev.animatedloadingbutton.ALBButton
android:id="@+id/alb_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:default_text="Login"
app:success_text="Yipee!"
app:loading_text="Loading..."
android:layout_marginTop="40dp"
android:gravity="center"/>
- you call
isSuccess()
to activate success button andisError()
to activate error button.
val albButton = findViewById<ALBButton>(R.id.alb_btn)
albButton.setLoadingTextColor(Color.WHITE)
albButton.setLoadingText("Loading...")
albButton.setErrorText("Failed.")
albButton.setOnClickListener(object: OnClickListener{
override fun onClick(view: View) {
//write your loading or login listener
//if login or loading is successful, call albButton.isSuccess() method.
//if login or loading fails, call albButton.isError() method.
}
})