Skip to content

Commit 5f5c7fb

Browse files
Merge pull request #16 from SimformSolutionsPvtLtd/feature/UNT-T5677_readme_and_licenece_update
📝 UNT-T5677 Readme and License Updated.
2 parents 03d4890 + 4a168e5 commit 5f5c7fb

File tree

6 files changed

+136
-7
lines changed

6 files changed

+136
-7
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright [2021] [Simform Solutions]
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,126 @@
1-
# android-morphing-button-jetpack-compose
1+
# SSJetPackComposeProgressButton
2+
### _SSJetPackComposeProgressButton is an elegant button with a different loading animations._
3+
4+
[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)][git-repo-url] [![](https://jitpack.io/v/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose.svg)](https://jitpack.io/#SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose) [![Kotlin Version](https://img.shields.io/badge/Kotlin-v1.5.10-blue.svg)](https://kotlinlang.org) [![Platform](https://img.shields.io/badge/Platform-Android-green.svg?style=flat)](https://www.android.com/) [![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21)
5+
6+
## Features
7+
- Android’s modern toolkit - Jetpack Compose support.
8+
- Newly designed loading animation make your app atterective.
9+
- Blinking icon button for your hot-feature
10+
- Button with text, right and left icon
11+
- Different types of state makes it easy to manage button. (Idle, Loading, Success, failure)
12+
- Fully customized button (Corner radius, background, colors, animation speed etc.)
13+
14+
# 🎬 Preview
15+
16+
| On Success | On Failure |
17+
|--|--|
18+
| ![](https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/blob/feature/UNT-T5677_readme_and_licenece_update/gif/success.gif) | ![](https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/blob/feature/UNT-T5677_readme_and_licenece_update/gif/failure.gif) |
19+
20+
## Installation
21+
1. Add it in your root build.gradle at the end of repositories:
22+
23+
```groovy
24+
allprojects {
25+
repositories {
26+
...
27+
maven { url 'https://jitpack.io' }
28+
}
29+
}
30+
```
31+
32+
* Add the dependency in your app's build.gradle file
33+
34+
```groovy
35+
dependencies {
36+
implementation 'com.github.SimformSolutionsPvtLtd:android-morphing-button-jetpack-compose:Tag'
37+
}
38+
```
39+
40+
## Usage
41+
* Just use SSLoadingButton where you want button.
42+
43+
```kotlin
44+
var submitButtonState by remember { mutableStateOf(SSButtonState.IDLE) }
45+
SSLoadingButton(
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
55+
)
56+
```
57+
```kotlin
58+
// On Success change submitButtonState to success state
59+
submitButtonState = SSButtonState.SUCCESS
60+
```
61+
```kotlin
62+
// On Failure change submitButtonState to failure state
63+
submitButtonState = SSButtonState.FAILIURE
64+
```
65+
### All Attributes
66+
------------------------
67+
68+
| Attribute | Description | Default |
69+
| --- | --- | --- |
70+
| `type` | Choose type of animation from:[CIRCLE, WHEEL, ZOOM_IN_OUT_CIRCLE, CLOCK, SPIRAL] | None |
71+
| `width` | Width to be applied to the button. | None |
72+
| `height` | Height to be applied to the button. | None |
73+
| `onClick` | Will be called when the user clicks the button. | None |
74+
| `assetColor` | Color to be applied to icon and text inside button. | None |
75+
| `buttonState` | Represent the state of button from IDLE, LOADING, SUCCESS, FAILIURE from SSButtonState. | None |
76+
| `buttonBorderStroke` | Border to draw around the button. | None |
77+
| `blinkingIcon` | Icon will be blink with size and color. | `false` |
78+
| `cornerRadius` | Corner radius to be applied to the button. | `20` |
79+
| `speedMillis` | Speed of the animation while changing the state. | `1000` |
80+
| `enabled` | Controls the enabled state of the button. | `true` |
81+
| `elevation` | It is used to resolve the elevation for this button in different. | `ButtonDefaults.elevation()` |
82+
| `colors` | Colors that will be used to resolve the background and content color for this button in different states | `ButtonDefaults.buttonColors()` |
83+
| `padding` | The spacing values to apply internally between the container and the content. | `PaddingValues(0.dp)` |
84+
| `alphaValue` | The alpha of the drawn area. | `1f` |
85+
| `leftImagePainter` | Painter to draw inside this left Icon. | `null` |
86+
| `rightImagePainter` | Painter to draw inside this right Icon. | `null` |
87+
| `successIconPainter` | Painter to draw inside this success state Icon. | `rememberVectorPainter(image = Icons.Default.Done)` |
88+
| `failureIconPainter` | Painter to draw inside this failiure state Icon. | `rememberVectorPainter(image = Icons.Outlined.Info)` |
89+
| `text` | The text to be displayed. | `null` |
90+
| `textModifier` | To apply to this text layout node. | `Modifier` |
91+
| `fontSize` | The size of glyphs to use when painting the text. | `TextUnit.Unspecified` |
92+
| `fontStyle` | The typeface variant to use when drawing the letters (e.g., italic). | `null` |
93+
| `fontFamily` | The font family to be used when rendering the text. | `null` |
94+
| `hourHandColor` | Color will be apply to hour hand in clock type animation only. | `Color.Black` |
95+
96+
97+
## Find this library useful? ❤️
98+
Support it by joining __[stargazers]__ for this repository.⭐
99+
100+
## 🤝 How to Contribute
101+
102+
Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪
103+
Check out our __[Contributing Guide]__ for ideas on contributing.
104+
105+
## Bugs and Feedback
106+
For bugs, feature requests, and discussion please use __[GitHub Issues]__.
107+
108+
## License
109+
```
110+
Copyright 2021 Simform Solutions
111+
112+
Licensed under the Apache License, Version 2.0 (the "License");
113+
you may not use this file except in compliance with the License.
114+
You may obtain a copy of the License at
115+
http://www.apache.org/licenses/LICENSE-2.0
116+
Unless required by applicable law or agreed to in writing, software
117+
distributed under the License is distributed on an "AS IS" BASIS,
118+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119+
See the License for the specific language governing permissions and limitations under the License.
120+
```
121+
122+
[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
123+
[git-repo-url]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose.git>
124+
[stargazers]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/stargazers>
125+
[Contributing Guide]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/blob/main/CONTRIBUTING.md>
126+
[GitHub Issues]: <https://github.com/SimformSolutionsPvtLtd/android-morphing-button-jetpack-compose/issues>

app/src/main/java/com/simform/ssloadingbuttonandroid/MainActivity.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
1515
import androidx.compose.foundation.layout.padding
1616
import androidx.compose.foundation.lazy.LazyColumn
1717
import androidx.compose.material.Button
18+
import androidx.compose.material.ButtonColors
1819
import androidx.compose.material.ButtonDefaults
1920
import androidx.compose.material.Text
2021
import androidx.compose.material.icons.Icons
@@ -31,6 +32,7 @@ import androidx.compose.ui.Alignment
3132
import androidx.compose.ui.Modifier
3233
import androidx.compose.ui.graphics.Color
3334
import androidx.compose.ui.graphics.SolidColor
35+
import androidx.compose.ui.graphics.graphicsLayer
3436
import androidx.compose.ui.graphics.vector.rememberVectorPainter
3537
import androidx.compose.ui.res.colorResource
3638
import androidx.compose.ui.res.stringResource
@@ -107,9 +109,9 @@ fun SSLoadingButtonExample() {
107109
modifier = Modifier
108110
.padding(six.dp)
109111
.weight(oneFloat),
110-
elevation = ButtonDefaults.elevation(),
112+
elevation = ButtonDefaults.elevation(), colors = ButtonDefaults.buttonColors(backgroundColor = colorResource(id = R.color.light_blue))
111113
) {
112-
Text(text = stringResource(id = R.string.on_success))
114+
Text(text = stringResource(id = R.string.on_success), color = Color.White )
113115
}
114116
Button(
115117
onClick = {
@@ -127,9 +129,9 @@ fun SSLoadingButtonExample() {
127129
modifier = Modifier
128130
.padding(six.dp)
129131
.weight(1f),
130-
elevation = ButtonDefaults.elevation()
132+
elevation = ButtonDefaults.elevation(), colors = ButtonDefaults.buttonColors(backgroundColor = colorResource(id = R.color.light_blue))
131133
) {
132-
Text(text = stringResource(id = R.string.on_failure))
134+
Text(text = stringResource(id = R.string.on_failure), color = Color.White)
133135
}
134136
}
135137
}
@@ -240,7 +242,8 @@ fun SSLoadingButtonExample() {
240242
fontFamily = FontFamily.SansSerif,
241243
textModifier = Modifier.padding(six.dp),
242244
blinkingIcon = true,
243-
padding = PaddingValues(six.dp)
245+
padding = PaddingValues(six.dp),
246+
colors = ButtonDefaults.buttonColors( backgroundColor = colorResource(id = R.color.light_blue))
244247
)
245248
SSLoadingButton(
246249
assetColor = Color.White,

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
<color name="white">#FFFFFFFF</color>
1010
<color name="dark_green">#07a34d</color>
1111
<color name="yellow">#ffbb00</color>
12+
<color name="light_blue">#23395D</color>
1213
</resources>

gif/failure.gif

13.4 MB
Loading

gif/success.gif

12.7 MB
Loading

0 commit comments

Comments
 (0)