-
Notifications
You must be signed in to change notification settings - Fork 544
User Guide
Dmytro Danylyk edited this page May 5, 2014
·
11 revisions
FlatButton
- base class which can be used to display flat button, extends Button
. Configurable by two xml attributes:
<com.dd.processbutton.FlatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Flat Button"
android:textColor="@android:color/white"
custom:colorNormal="@android:color/holo_blue_light"
custom:colorPressed="@android:color/holo_blue_dark" />
ProcessButton
- abstract class extends FlatButton
, behavior is very similar to android ProgressBar
. Main point is to use setProgress
method to set progress from 0
to 100
.
Declare ActionProcessButton
inside your layout
<com.dd.processbutton.iml.ActionProcessButton
android:id="@+id/btnSignIn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/Sign_in"
android:textColor="@android:color/white"
android:textSize="18sp"
custom:colorComplete="@color/green_complete"
custom:colorNormal="@color/blue_normal"
custom:colorPressed="@color/blue_pressed"
custom:colorProgress="@color/purple_progress"
custom:completeText="@string/Success"
custom:progressText="@string/Loading" />
<!--background color which will be displayed when loading is complete-->
custom:colorComplete
<!--text which will be displayed when loading is complete-->
custom:completeText
<!--loading color indicator-->
custom:colorProgress
<!--text which will be displayed when loading is in progress-->
custom:progressText
Control it via Java code
ActionProcessButton btnSignIn = (ActionProcessButton) findViewById(R.id.btnSignIn);
btnSignIn.setMode(ActionProcessButton.Mode.PROGRESS);
// 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);
// completeColor & completeText is shown
button.setProgress(100);
// you can display endless google like progress indicator
btnSignIn.setMode(ActionProcessButton.Mode.PROGRESS);
// set progress > 0 to start progress indicator animation
button.setProgress(1);