-
Notifications
You must be signed in to change notification settings - Fork 1.2k
User Guide
Dmytro Danylyk edited this page Jun 7, 2014
·
13 revisions
The lib SOON will be available on Maven Central, stay tuned!
Declare button inside your layout XML file:
<com.dd.CircularProgressButton
android:id="@+id/btnWithText"
android:layout_width="196dp"
android:layout_height="64dp"
android:layout_marginTop="16dp"
android:textColor="@color/white"
android:textSize="18sp"
app:textComplete="@string/Complete"
app:textError="@string/Error"
app:textIdle="@string/Upload" />
Button state depends on progress:
- normal state [0]
- progress state [1-99]
- success state [100]
- error state [-1]
To change progress use CircularProgressButton.setProgress(int value)
method.
Idle state
CircularProgressButton.setProgress(0)
- To change text
app:textIdle="@string/Upload"
- To change background color
app:colorIdle="@color/green"
Progress state 1
CircularProgressButton.setProgress(1)
will automatically morph button from idle (square shape) state to progress (circle shape) state.
- To change indicator color
app:colorIndicator="@color/blue"
- To change indicator background color
app:colorIndicatorBackground="@color/grey"
- To change circle background color
app:colorProgress="@color/white"
Progress state 50
CircularProgressButton.setProgress(50)
Complete state 100
CircularProgressButton.setProgress(-1)
- To change text
app:textError="@string/Error"
- To change background color
app:colorError="@color/red"
Error state -1
CircularProgressButton.setProgress(-1)
- To change text
app:textComplete="@string/Complete"
- To change background color
app:colorComplete="@color/green"