|
1 | 1 | # SSJetPackComposeProgressButton |
2 | | -### _SSJetPackComposeProgressButton is an elegant button with a different loading animations._ |
| 2 | +### _SSJetPackComposeProgressButton is an elegant button with a different loading animations which makes your app attractive._ |
3 | 3 |
|
4 | 4 | [][git-repo-url] [](https://jitpack.io/#SimformSolutionsPvtLtd/SSJetPackComposeProgressButton) [](https://kotlinlang.org) [](https://www.android.com/) [](https://android-arsenal.com/api?level=21) |
5 | 5 |
|
| 6 | +# Jetpack Compose |
| 7 | +Jetpack Compose is Android’s modern toolkit for building native UI. It simplifies and accelerates UI development on Android. Quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs. |
| 8 | + |
| 9 | +## How to get started |
| 10 | +Please get **Android Studio Arctic Fox 2020.3.1 Canary 4** or above [from here](https://developer.android.com/studio/preview/) and use **JDK 11** to build this project. |
| 11 | + |
6 | 12 | ## Features |
7 | 13 | - Android’s modern toolkit - Jetpack Compose support. |
8 | 14 | - Newly designed loading animation make your app atterective. |
9 | 15 | - Blinking icon button for your hot-feature |
10 | 16 | - Button with text, right and left icon |
11 | 17 | - Different types of state makes it easy to manage button. (Idle, Loading, Success, failure) |
12 | 18 | - Fully customized button (Corner radius, background, colors, animation speed etc.) |
| 19 | +- Customize button loading animation with your logo and special animation effect. |
13 | 20 |
|
14 | 21 | # 🎬 Preview |
15 | 22 |
|
16 | 23 | | On Success | On Failure | |
17 | 24 | |--|--| |
18 | 25 | |  |  | |
19 | 26 |
|
| 27 | +# 🎬 Customized loading animation |
| 28 | + |
| 29 | +| On Success | On Failure | |
| 30 | +|--|--| |
| 31 | +|  |  | |
| 32 | + |
20 | 33 | ## Installation |
21 | 34 | 1. Add it in your root build.gradle at the end of repositories: |
22 | 35 |
|
|
33 | 46 |
|
34 | 47 | ```groovy |
35 | 48 | dependencies { |
36 | | - implementation 'com.github.SimformSolutionsPvtLtd:SSJetPackComposeProgressButton:1.0.4' |
| 49 | + implementation 'com.github.SimformSolutionsPvtLtd:SSJetPackComposeProgressButton:1.0.5' |
37 | 50 | } |
38 | 51 | ``` |
39 | 52 |
|
40 | 53 | ## Usage |
41 | | -* Just use SSLoadingButton where you want button. |
| 54 | +* Just use SSJetPackComposeProgressButton where you want button. |
| 55 | + |
| 56 | + ```kotlin |
| 57 | + var submitButtonState by remember { mutableStateOf(SSButtonState.IDLE) } |
| 58 | + SSJetPackComposeProgressButton( |
| 59 | + type = SSButtonType.CLOCK, |
| 60 | + width = 300.dp, |
| 61 | + height = 50.dp, |
| 62 | + onClick = { |
| 63 | + //Perform action on click of button and make it's state to LOADING |
| 64 | + submitButtonState = SSButtonState.LOADING |
| 65 | + }, |
| 66 | + assetColor = Color.Red, |
| 67 | + buttonState = submitButtonState |
| 68 | + ) |
| 69 | + ``` |
| 70 | + ```kotlin |
| 71 | + // On Success change submitButtonState to success state |
| 72 | + submitButtonState = SSButtonState.SUCCESS |
| 73 | + ``` |
| 74 | + ```kotlin |
| 75 | + // On Failure change submitButtonState to failure state |
| 76 | + submitButtonState = SSButtonState.FAILIURE |
| 77 | + ``` |
| 78 | + |
| 79 | +## Customization |
| 80 | +* You can customize loading icon and animation effect according to your requirement.You can apply multiple animation effect from rotation, zoom-in-out and color changer too. |
42 | 81 |
|
43 | 82 | ```kotlin |
44 | | - var submitButtonState by remember { mutableStateOf(SSButtonState.IDLE) } |
45 | | - SSJetPackComposeProgressButton( |
46 | | - type = SSButtonType.CLOCK, |
47 | | - width = 300.dp, |
48 | | - height = 50.dp, |
49 | | - onClick = { |
50 | | - //Perform action on click of button and make it state to LOADING |
51 | | - submitButtonState = SSButtonState.LOADING |
52 | | - }, |
53 | | - assetColor = Color.Red, |
54 | | - buttonState = submitButtonState |
| 83 | + var submitButtonState by remember { mutableStateOf(SSButtonState.IDLE) } |
| 84 | + SSJetPackComposeProgressButton( |
| 85 | + type = SSButtonType.CUSTOM, |
| 86 | + width = 300.dp, |
| 87 | + height = 50.dp, |
| 88 | + onClick = { |
| 89 | + //Perform action on click of button and make it's state to LOADING |
| 90 | + submitButtonState = SSButtonState.LOADING |
| 91 | + }, |
| 92 | + assetColor = Color.Red, |
| 93 | + buttonState = submitButtonState, |
| 94 | + successIconPainter = painterResource(id = R.drawable.custom_success), |
| 95 | + failureIconPainter = painterResource(id = R.drawable.custom_fail), |
| 96 | + colors = ButtonDefaults.buttonColors(backgroundColor = Color.White), |
| 97 | + padding = PaddingValues(six.dp), |
| 98 | + text = stringResource(id = R.string.simform), |
| 99 | + textModifier = Modifier.padding(ten.dp), |
| 100 | + fontWeight = FontWeight.Bold, |
| 101 | + leftImagePainter = painterResource(id = R.drawable.simform_logo), |
| 102 | + buttonBorderStroke = BorderStroke(two.dp, colorResource(id = R.color.pink)), |
| 103 | + customLoadingIconPainter = painterResource(id = R.drawable.simform_logo), |
| 104 | + customLoadingEffect = SSCustomLoadingEffect( |
| 105 | + rotation = false, |
| 106 | + zoomInOut = true, |
| 107 | + colorChanger = false |
55 | 108 | ) |
| 109 | + ) |
56 | 110 | ``` |
57 | 111 | ```kotlin |
58 | | - // On Success change submitButtonState to success state |
59 | | - submitButtonState = SSButtonState.SUCCESS |
| 112 | + // On Success change submitButtonState to success state |
| 113 | + submitButtonState = SSButtonState.SUCCESS |
60 | 114 | ``` |
61 | 115 | ```kotlin |
62 | | - // On Failure change submitButtonState to failure state |
63 | | - submitButtonState = SSButtonState.FAILIURE |
| 116 | + // On Failure change submitButtonState to failure state |
| 117 | + submitButtonState = SSButtonState.FAILIURE |
64 | 118 | ``` |
| 119 | + |
65 | 120 | ### All Attributes |
66 | 121 | ------------------------ |
67 | 122 |
|
68 | 123 | | Attribute | Description | Default | |
69 | 124 | | --- | --- | --- | |
70 | | -| `type` | Choose type of animation from:[CIRCLE, WHEEL, ZOOM_IN_OUT_CIRCLE, CLOCK, SPIRAL] | None | |
| 125 | +| `type` | Choose type of animation from:[CIRCLE, WHEEL, ZOOM_IN_OUT_CIRCLE, CLOCK, SPIRAL, CUSTOM] | None | |
71 | 126 | | `width` | Width to be applied to the button. | None | |
72 | 127 | | `height` | Height to be applied to the button. | None | |
73 | 128 | | `onClick` | Will be called when the user clicks the button. | None | |
|
97 | 152 | | `customLoadingEffect` | Custom loading animation type like roation, zoom in out etc. | `SSCustomLoadingEffect( rotation = false, zoomInOut = false, colorChanger = false)` | |
98 | 153 | | `customLoadingPadding` | Spacing between button border and loading icon. | `0` | |
99 | 154 |
|
100 | | -## Customization |
101 | | -* You can customize loading icon and animation effect according to your requirement.You can apply multiple animation effect from roationm, zoom-in-out and color changer. |
102 | | - |
103 | | - ```kotlin |
104 | | - var submitButtonState by remember { mutableStateOf(SSButtonState.IDLE) } |
105 | | - SSJetPackComposeProgressButton( |
106 | | - type = SSButtonType.CLOCK, |
107 | | - width = 300.dp, |
108 | | - height = 50.dp, |
109 | | - onClick = { |
110 | | - //Perform action on click of button and make it state to LOADING |
111 | | - submitButtonState = SSButtonState.LOADING |
112 | | - }, |
113 | | - assetColor = Color.Red, |
114 | | - buttonState = submitButtonState, |
115 | | - successIconPainter = painterResource(id = R.drawable.custom_success), |
116 | | - failureIconPainter = painterResource(id = R.drawable.custom_fail), |
117 | | - colors = ButtonDefaults.buttonColors(backgroundColor = Color.White), |
118 | | - padding = PaddingValues(six.dp), |
119 | | - text = stringResource(id = R.string.simform), |
120 | | - textModifier = Modifier.padding(ten.dp), |
121 | | - fontWeight = FontWeight.Bold, |
122 | | - leftImagePainter = painterResource(id = R.drawable.simform_logo), |
123 | | - buttonBorderStroke = BorderStroke(two.dp, colorResource(id = R.color.pink)), |
124 | | - customLoadingIconPainter = painterResource(id = R.drawable.simform_logo), |
125 | | - customLoadingEffect = SSCustomLoadingEffect( |
126 | | - rotation = false, |
127 | | - zoomInOut = true, |
128 | | - colorChanger = false |
129 | | - ) |
130 | | - ) |
131 | | - ``` |
132 | | - ```kotlin |
133 | | - // On Success change submitButtonState to success state |
134 | | - submitButtonState = SSButtonState.SUCCESS |
135 | | - ``` |
136 | | - ```kotlin |
137 | | - // On Failure change submitButtonState to failure state |
138 | | - submitButtonState = SSButtonState.FAILIURE |
139 | | - ``` |
140 | | - |
141 | | -# 🎬 Custom loading animation |
142 | | - |
143 | | -| On Success | On Failure | |
144 | | -|--|--| |
145 | | -|  |  | |
146 | | - |
147 | 155 |
|
148 | 156 | ## Find this library useful? ❤️ |
149 | 157 | Support it by joining __[stargazers]__ for this repository.⭐ |
150 | 158 |
|
151 | | -## 🤝 How to Contribute |
| 159 | +## How to Contribute🤝 |
152 | 160 |
|
153 | 161 | Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪 |
154 | 162 | Check out our __[Contributing Guide]__ for ideas on contributing. |
|
0 commit comments