-
Notifications
You must be signed in to change notification settings - Fork 543
User Guide
Dmytro Danylyk edited this page May 3, 2014
·
11 revisions
ProcessButton
behavior is very similar to android ProgressBar
. Main point is to use setProgress
method to set progress from 0
to 100
and declare progress indicator style via custom:progressStyle="action"
.
ProcessButton
- has three states:
- Idle -
android:background
andandroid:text
is displayed - In Progress -
custom:progressDrawable
andcustom:progressText
is displayed - Complete -
custom:completeDrawable
andcustom:completeText
is displayed
Declare ProcessButton
inside your layout
<com.dd.processbutton.ProcessButton
android:id="@+id/btnSignIn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_blue_selector"
android:text="Sign in"
custom:completeDrawable="@drawable/rect_green"
custom:completeText="Success"
custom:progressDrawable="@drawable/rect_purple"
custom:progressText="Loading"
custom:progressStyle="action"/>
<!--drawable which will be displayed when loading is complete-->
custom:completeDrawable="@drawable/rect_green"
<!--text which will be displayed when loading is complete-->
custom:completeText="Success"
<!--drawable which will be displayed when loading is in progress-->
custom:progressDrawable="@drawable/rect_purple"
<!--text which will be displayed when loading is in progress-->
custom:progressText="Loading"
<!--progress indicator - action, submit, generate-->
custom:progressStyle="action"
Control it via Java code
ProcessButton btnSignIn = (ProcessButton) findViewById(R.id.btnSignIn);
// no progress
button.setProgress(0);
// progressDrawable cover 50% of button width, progressText is shown
button.setProgress(50);
// progressDrawable cover 75% of button width, progressText is shown
button.setProgress(75);
// completeDrawable & completeText is shown
button.setProgress(100);