Skip to content

appsfeature/progress-button

Repository files navigation

ProgressButton

Show button with progress bar

Library size is : 15Kb

Screenshots

Preview 1

Setup

Add this to your project build.gradle

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

Dependency

dependencies {
    implementation 'com.github.appsfeature:progress-button:1.11'
}

Usage

In your activity_main.xml class:

      <include layout="@layout/button_progress"/>

In your activity class:

Initialization method

    btnAction = ProgressButton.newInstance(this, getActivityRootView())
                  .setText("Send Request") 
                  .setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) { 
                      }
                  });

Update progress bar methods

      //use this method to initiate progress bar while starting task in background
      btnAction.startProgress();

      // call this method when getting success response from background task
      btnAction.revertSuccessProgress(new ProgressButton.Listener() {
          @Override
          public void onAnimationCompleted() {
          }
      });
      // use this method when getting wrong response and revert the initial stage of button
      btnAction.revertProgress();

About

Button with progress

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages