Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

Commit 34e3804

Browse files
authored
Update README.md
additional usage scenarios added
1 parent 6bd01ba commit 34e3804

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ dependencies {
4040
android:layout_width="match_parent"
4141
android:id="@+id/btn_done"
4242
android:layout_margin="20dp"
43-
app:backgroundColor="@android:color/holo_orange_light"
43+
app:backgroundColor="#2962FF"
4444
app:progressColor="@android:color/holo_orange_light"
4545
app:text="DONE!"
4646
app:textColor="@android:color/black" />
47+
4748
```
4849
Available attributes:
4950
* app:backgroundColor - **Button background color** *(default = Color.BLUE)*
@@ -52,6 +53,7 @@ Available attributes:
5253
* app:textColor - **Button text color** *(default = Color.WHITE)*
5354
## Code
5455

56+
#### Java
5557
```java
5658
private ProgressButton pb_button;
5759
...
@@ -72,7 +74,32 @@ pb_button.setOnClickListener(new View.OnClickListener() {
7274
}
7375
});
7476
```
75-
Available methods:
77+
#### Kotlin
78+
```kotlin
79+
val progressButton = findViewById<ProgressButton>(R.id.btn_done)
80+
progressButton.setOnClickListener {
81+
progressButton.startAnim()
82+
Handler().postDelayed({ progressButton.stopAnim { startMainActivity() }}, 2000)
83+
}
84+
```
85+
86+
#### RxJava 2 + kotlin
87+
```rx
88+
disposables.add(signUp()
89+
.observeOn(AndroidSchedulers.mainThread())
90+
.doOnSubscribe { progressButton.startAnim() }
91+
.doOnSuccess { progressButton.stopAnim { startMainActivity() } }
92+
.subscribe({
93+
//your code
94+
},
95+
{
96+
Toast.makeText(this,"error",
97+
Toast.LENGTH_SHORT).show()
98+
}))
99+
```
100+
101+
102+
#### Public methods:
76103
* setBgColor(int color) - **Set button background color**
77104
* setProColor(int color) - **Set progress color**
78105
* setButtonText(String str) - **Set button text**

0 commit comments

Comments
 (0)