Show or hide Loading on button such as ProgressBar.
- Add the mavenCentral() repository to your root build.gradle at the end of repositories:
allprojects {
repositories {
...
mavenCentral()
}
}
- Add the ProgressButton dependency in the build.gradle:
implementation group: 'com.apachat', name: 'progressbutton-android', version: '1.0.7'
Sometimes we need to show loading on button as per requirement we don't want to block full screen view with default loading or dialogs. So you can use this library to show loading on button hide loading after that when you want.
Its very easy to use ProgressButton as its a custom button and contain all features of android default button with some extra attributes.
<layout
...
<com.apachat.progressbutton.core.ProgressButton
android:id="@+id/progressButton"
android:layout_width="200dp"
android:layout_height="51dp"
android:layout_marginTop="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Hello World!"
android:textColor="@color/white"
app:pb_buttonColor="@color/colorPrimary"
app:pb_isShadowEnable="true"
app:pb_isCircular="true"
app:pb_loaderColor="@color/colorAccent"
app:pb_shadowColor="@color/colorPrimaryDark"
app:pb_shadowHeight="5dp" />
...
</layout>
You can easily use to show loading on button click by calling showLoading();
and hide loading by calling
hideLoading();
whenever you want to stop loading.
Show Loading
ProgressButton progressButton = (ProgressButton) findViewById(R.id.progressButton); progressButton.showLoading();
Hide Loading
ProgressButton progressButton = (ProgressButton) findViewById(R.id.progressButton); progressButton.hideLoading();
For bugs, feature requests, and discussion please use GitHub Issues.