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

Commit 6bd01ba

Browse files
author
Andrii Kovalchuk
committed
added sample project
1 parent ce5c2c9 commit 6bd01ba

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# ProgressButton [![](https://jitpack.io/v/muramrr/ProgressButton.svg)](https://jitpack.io/#muramrr/ProgressButton) [![](https://img.shields.io/github/license/muramrr/ProgressButton.svg)](https://github.com/muramrr/ProgressButton/blob/master/LICENSE)
2+
3+
Original prototype [Dribble link](https://dribbble.com/shots/1945593-Login-Home-Screen)
4+
5+
[iOS library](https://github.com/entotsu/TKSubmitTransition)
6+
7+
Sample project available in **app** directory
8+
9+
10+
## Overview
11+
12+
Custom button with progress anim and transition to another activity/fragment
13+
14+
Better to use with **AsyncTask** or **Handler()** or *RxJava* **doFinally()**
15+
16+
![](https://github.com/muramrr/ProgressButton/blob/master/test.gif)
17+
## Installation
18+
19+
Add jitpack repo in your project.gradle
20+
```gradle
21+
allprojects {
22+
repositories {
23+
...
24+
maven { url 'https://jitpack.io' }
25+
}
26+
}
27+
```
28+
29+
Add implementation in your app.gradle
30+
```gradle
31+
dependencies {
32+
implementation 'com.github.muramrr:ProgressButton:1.0'
33+
}
34+
```
35+
## Usage XML
36+
37+
```xml
38+
<com.mmdev.progressbuttonlib.ProgressButton
39+
android:layout_height="50dp"
40+
android:layout_width="match_parent"
41+
android:id="@+id/btn_done"
42+
android:layout_margin="20dp"
43+
app:backgroundColor="@android:color/holo_orange_light"
44+
app:progressColor="@android:color/holo_orange_light"
45+
app:text="DONE!"
46+
app:textColor="@android:color/black" />
47+
```
48+
Available attributes:
49+
* app:backgroundColor - **Button background color** *(default = Color.BLUE)*
50+
* app:progressColor - **Progress loading color** *(default = Color.WHITE)*
51+
* app:text - **Button text** *(default = "")*
52+
* app:textColor - **Button text color** *(default = Color.WHITE)*
53+
## Code
54+
55+
```java
56+
private ProgressButton pb_button;
57+
...
58+
pb_button = findViewById(R.id.btn_done);
59+
pb_button.setOnClickListener(new View.OnClickListener() {
60+
@Override
61+
public void onClick (View v) {
62+
pb_button.startAnim(); //start progress button loading
63+
/**
64+
* manual stop animation method
65+
* you can handle it with Runnable()
66+
* delay progress loading in Handler()
67+
* or you can use it with AsyncTask class
68+
* startAnim() in preExecute
69+
* stopAnim() in postExecute
70+
*/
71+
new Handler().postDelayed(() -> pb_button.stopAnim(this::startSecondActivity), 760);
72+
}
73+
});
74+
```
75+
Available methods:
76+
* setBgColor(int color) - **Set button background color**
77+
* setProColor(int color) - **Set progress color**
78+
* setButtonText(String str) - **Set button text**
79+
* setTextColor(int color) - **Set button text color**
80+
81+
## License
82+
```license
83+
MIT License
84+
85+
Copyright (c) 2019 Andrii Kovalchuk
86+
87+
Permission is hereby granted, free of charge, to any person obtaining a copy
88+
of this software and associated documentation files (the "Software"), to deal
89+
in the Software without restriction, including without limitation the rights
90+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
91+
copies of the Software, and to permit persons to whom the Software is
92+
furnished to do so, subject to the following conditions:
93+
94+
The above copyright notice and this permission notice shall be included in all
95+
copies or substantial portions of the Software.
96+
97+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
98+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
99+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
100+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
101+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
102+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
103+
SOFTWARE.
104+
```

0 commit comments

Comments
 (0)