Skip to content

Commit ee8799b

Browse files
committed
🎨 UNT-T5677 Improved design structure.
1 parent 7f49b31 commit ee8799b

9 files changed

Lines changed: 19 additions & 6 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![alt text](https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton/blob/main/gif/banner.png)
2+
13
# SSJetPackComposeProgressButton
24
### _SSJetPackComposeProgressButton is an elegant button with a different loading animations which makes your app attractive._
35

@@ -7,7 +9,7 @@
79
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.
810

911
## 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.
12+
Please get **Android Studio Arctic Fox 2020.3.1** or above [from here](https://developer.android.com/studio) and use **JDK 11** to build this project.
1113

1214
## Features
1315
- Android’s modern toolkit - Jetpack Compose support.
@@ -141,6 +143,8 @@ Please get **Android Studio Arctic Fox 2020.3.1 Canary 4** or above [from here](
141143
| `rightImagePainter` | Painter to draw inside this right Icon. | `null` |
142144
| `successIconPainter` | Painter to draw inside this success state Icon. | `rememberVectorPainter(image = Icons.Default.Done)` |
143145
| `failureIconPainter` | Painter to draw inside this failiure state Icon. | `rememberVectorPainter(image = Icons.Outlined.Info)` |
146+
| `successIconColor` | Color to be applied to success icon. | assetColor |
147+
| `failureIconColor` | Color to be applied to failure icon. | assetColor |
144148
| `text` | The text to be displayed. | `null` |
145149
| `textModifier` | To apply to this text layout node. | `Modifier` |
146150
| `fontSize` | The size of glyphs to use when painting the text. | `TextUnit.Unspecified` |

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fun SSLoadingButtonExample() {
120120
elevation = ButtonDefaults.elevation(),
121121
colors = ButtonDefaults.buttonColors(backgroundColor = colorResource(id = R.color.light_blue))
122122
) {
123-
Text(text = stringResource(id = R.string.on_success), color = Color.White)
123+
Text(text = stringResource(id = R.string.on_success), color = Color.White, fontSize = FONT_SIZE.sp)
124124
}
125125
Button(
126126
onClick = {
@@ -145,7 +145,7 @@ fun SSLoadingButtonExample() {
145145
elevation = ButtonDefaults.elevation(),
146146
colors = ButtonDefaults.buttonColors(backgroundColor = colorResource(id = R.color.light_blue))
147147
) {
148-
Text(text = stringResource(id = R.string.on_failure), color = Color.White)
148+
Text(text = stringResource(id = R.string.on_failure), color = Color.White, fontSize = FONT_SIZE.sp)
149149
}
150150
}
151151

@@ -269,6 +269,7 @@ fun SSLoadingButtonExample() {
269269
text = stringResource(id = R.string.stylish_text),
270270
fontStyle = FontStyle.Italic,
271271
fontSize = FONT_SIZE.sp,
272+
fontWeight = FontWeight.Bold,
272273
fontFamily = FontFamily.Monospace,
273274
cornerRadius = COMMON_CORNER_RADIUS,
274275
textModifier = Modifier.padding(TWELVE.dp),
@@ -285,6 +286,7 @@ fun SSLoadingButtonExample() {
285286
fontFamily = FontFamily.SansSerif,
286287
textModifier = Modifier.padding(TWELVE.dp),
287288
fontSize = FONT_SIZE.sp,
289+
fontWeight = FontWeight.Bold,
288290
blinkingIcon = true,
289291
padding = PaddingValues(TWELVE.dp),
290292
cornerRadius = COMMON_CORNER_RADIUS,
@@ -302,6 +304,7 @@ fun SSLoadingButtonExample() {
302304
fontFamily = FontFamily.Serif,
303305
textModifier = Modifier.padding(TWELVE.dp),
304306
fontSize = FONT_SIZE.sp,
307+
fontWeight = FontWeight.Bold,
305308
padding = PaddingValues(TWELVE.dp),
306309
cornerRadius = COMMON_CORNER_RADIUS,
307310
colors = ButtonDefaults.buttonColors(backgroundColor = colorResource(id = R.color.pink))
@@ -376,6 +379,8 @@ fun SSLoadingButtonExample() {
376379
textModifier = Modifier.padding(ten.dp),
377380
fontWeight = FontWeight.Bold,
378381
fontSize = FONT_SIZE.sp,
382+
successIconColor = colorResource(id = R.color.dark_green),
383+
failureIconColor = colorResource(id = R.color.colorPrimaryDark),
379384
leftImagePainter = painterResource(id = R.drawable.simform_logo),
380385
buttonBorderStroke = BorderStroke(COMMON_BORDER_WIDTH.dp, colorResource(id = R.color.pink))
381386
)

app/src/main/java/com/simform/ssjetpackcomposeprogressbutton/utils/Constant.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package com.simform.ssjetpackcomposeprogressbutton.utils
44
const val COMMON_WIDTH = 480
55
const val COMMON_HEIGHT = 60
66
const val TOP_BUTTON_HEIGHT = 50
7-
const val TOP_BUTTON_RADIUS = 30
7+
const val TOP_BUTTON_RADIUS = 10
88
const val COMMON_BORDER_WIDTH = 3
99
const val COMMON_CORNER_RADIUS = 25
1010
const val FONT_SIZE = 20

gif/banner.png

154 KB
Loading

gif/custom_fail.gif

65 KB
Loading

gif/custom_success.gif

61 KB
Loading

gif/failure.gif

135 KB
Loading

gif/success.gif

-732 KB
Loading

ssjetpackcomposeprogressbutton/src/main/java/com/simform/ssjetpackcomposeprogressbuttonlibrary/SSJetPackComposeProgressButton.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ import kotlinx.coroutines.delay
7474
* @rightImagePainter painter [Painter] to draw inside this right Icon.
7575
* @successIconPainter painter [Painter] to draw inside this success state Icon.
7676
* @failureIconPainter painter [Painter] to draw inside this failiure state Icon.
77+
* @successIconColor Color to be applied to success icon.
78+
* @failureIconColor Color to be applied to failure icon.
7779
* @param text The text to be displayed.
7880
* @param textModifier [Modifier] to apply to this text layout node.
7981
* @param fontSize The size of glyphs to use when painting the text. See [TextStyle.fontSize].
@@ -107,6 +109,8 @@ fun SSJetPackComposeProgressButton(
107109
rightImagePainter: Painter? = null,
108110
successIconPainter: Painter = rememberVectorPainter(image = Icons.Default.Done),
109111
failureIconPainter: Painter = rememberVectorPainter(image = Icons.Outlined.Info),
112+
successIconColor: Color = assetColor,
113+
failureIconColor: Color = assetColor,
110114
text: String? = null,
111115
textModifier: Modifier = Modifier,
112116
fontSize: TextUnit = TextUnit.Unspecified,
@@ -328,7 +332,7 @@ fun SSJetPackComposeProgressButton(
328332
)
329333
)
330334
.size(minHeightWidth - twenty.dp),
331-
tint = assetColor
335+
tint = successIconColor
332336
)
333337
//FAILURE State icon
334338
Icon(
@@ -342,7 +346,7 @@ fun SSJetPackComposeProgressButton(
342346
)
343347
)
344348
.size(minHeightWidth - twenty.dp),
345-
tint = assetColor
349+
tint = failureIconColor
346350
)
347351
//LOADING State
348352
var effectiveMinHeight = minHeightWidth

0 commit comments

Comments
 (0)