Skip to content

Commit 5176733

Browse files
authored
Merge pull request #4 from yml-org/CM-1336_Tag_Container_Animation
Updated Read me file
2 parents 8b5414b + 65582bb commit 5176733

File tree

7 files changed

+331
-158
lines changed

7 files changed

+331
-158
lines changed

README.md

Lines changed: 123 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,145 @@
1-
21
# AndroidYCoreUI
3-
==================
2+
3+
4+
## Y Tags
5+
6+
Y Tag is a UI element in Android (some times referred to as chips) which displays a piece of
7+
information.
8+
It consist of a leading icon(optional), Text and a trailing icon (optional).
9+
10+
## Features
11+
12+
- Fully customizable
13+
- Shape
14+
- Leading and Trailing Icons
15+
- Border
16+
- Background
17+
- Text style
18+
- Shadow
19+
- Provides a container called Tag view container which holds multiple tags
20+
- Container size can be fixed or variable
21+
- If container does not have enough space to accommodate the given tags, it will show over flow
22+
tag which is configurable.
23+
- Built with Compose UI
24+
25+
## Usage
26+
27+
28+
**Basic**
29+
30+
```
31+
TagView(text ="Default")
32+
```
33+
34+
**Customizations**
35+
36+
```
37+
val text = "Y Tag"
38+
val tagViewModifiers = TagViewModifiers.Builder()
39+
.width(140.dp)
40+
.shape(CircleShape)
41+
.backgroundColor(backgroundColor)
42+
.enableBorder(true)
43+
.borderColor(Color.Red)
44+
.textColor(Color.Black)
45+
.maxLines(1)
46+
.overFlow(TextOverflow.Ellipsis)
47+
.build()
48+
val leadingIcon = { tagViewData ->
49+
IconButton(
50+
onClick = {}) {
51+
Icon(painter = painterResource(id = R.drawable.ic_location_24px),
52+
contentDescription = null,
53+
tint = iconTint
54+
)
55+
}
56+
}
57+
58+
val trailingIcon = { tagViewData ->
59+
IconButton(
60+
onClick = {}) {
61+
Icon(painter = painterResource(id = R.drawable.ic_close_20px),
62+
contentDescription = null,
63+
tint = iconTint
64+
)
65+
}
66+
}
67+
68+
TagView(text = text, tagViewModifiers = tagViewModifiers, leadingIcon = leadingIcon, trailingIcon = trailingIcon, enabled = true)
69+
```
70+
71+
**Y Tag Container**
72+
73+
```
74+
val tagViewData = remember {
75+
mutableStateListOf<TagViewData>()
76+
}
77+
78+
tagViewData.addAll(
79+
TagViewData(
80+
text = "capsule",
81+
tagViewModifiers = TagViewModifiers.Builder()
82+
.width(90.dp)
83+
.shape(CircleShape)
84+
.backgroundColor(backgroundColor).textColor(textColor).style(textStyle).build()
85+
))
86+
87+
val tagViewContainerModifiers = TagViewContainerModifiers.Builder()
88+
.shape(RoundedCornerShape(4.dp)
89+
.tagSpacingVertical(8.dp)
90+
.tagSpacingHorizontal(8.dp)
91+
.width(360.dp)
92+
.height(50.dp)
93+
.moreTagConfiguration(
94+
TagViewData(
95+
overFlowText = { count ->
96+
"+ $count more"
97+
},
98+
tagViewModifiers = TagViewModifiers.Builder()
99+
.backgroundColor(colorResource(id = R.color.light_blue_300))
100+
.shape(CircleShape).width(80.dp).textAlign(TextAlign.Start).height(30.dp)
101+
.maxLines(1).overFlow(TextOverflow.Ellipsis).textAlign(TextAlign.Center)
102+
.textColor(Color.Black).fontWeight(FontWeight.Medium).onCLick { }.build()
103+
)
104+
).onCLick {}
105+
.build()
106+
107+
TagViewContainer(tagViewData = tagViewData, tagViewContainerModifiers = tagViewContainerModifiers)
108+
```
109+
110+
## Screenshots
111+
112+
<img src="screenshots/Stepper_Screenshot_1.jpg"/>
113+
114+
## Demo
115+
116+
<img src="screenshots/y_tag_13_s.gif"/>
4117

5118
### How to generate test report
119+
6120
- Generating jacoco test report
7121
- Gradle command `clean build createMergedJacocoReport`
8122
- From android studio
9123
- Open gradle menu bar from android studio right side panel
10124
- Click on the gradle icon and
11125
- In command popup window type `clean build createMergedJacocoReport` and press enter
12126
- Wait for the execution completion,
13-
- After successful execution each module level execution report will be stored in 'module\build\reports\jacoco\html\index.html'.
127+
- After successful execution each module level execution report will be stored in '
128+
module\build\reports\jacoco\html\index.html'.
14129

15130
### How to generate dokka report
16-
- Gradle command single module `clean build dokkaHtml` for multi module `clean build dokkaHtmlMultiModule`
131+
132+
- Gradle command single module `clean build dokkaHtml` for multi
133+
module `clean build dokkaHtmlMultiModule`
17134
- From android studio
18135
- Open gradle menu bar from android studio right side panel
19136
- Click on the gradle icon and
20137
- In command popup window type `dokkaHtml` for multi module `dokkaHtmlMultiModule`
21138

22139
### How to check KTLint
140+
23141
- Gradle command for checking lint error `ktlintCheck`
24142
- Gradle command for formatting code `ktlintFormat`
25-
=======
143+
=======
26144

27145

core/ui/src/main/java/co/yml/coreui/core/ui/templates/AppBar.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.*
66
import androidx.compose.material3.*
77
import androidx.compose.runtime.Composable
88
import androidx.compose.ui.Modifier
9-
import androidx.compose.ui.graphics.Color
109
import androidx.compose.ui.res.dimensionResource
1110
import androidx.compose.ui.res.painterResource
1211
import androidx.compose.ui.res.stringResource

core/ui/src/main/java/co/yml/coreui/core/ui/ytag/TagViewContainer.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@ fun TagViewContainer(
124124

125125
// over flow item
126126
with(moreTag) {
127-
val tagViewModifiers = tagViewModifiers.copy(onClick = {
128-
tagViewContainerModifiers.onClick.invoke(moreTag)
127+
val tagViewModifiers = moreTag.tagViewModifiers.copy(onClick = {
128+
moreTag.tagViewModifiers.onClick.invoke(moreTag)
129129
})
130130
TagView(
131-
text = overFlowText.value,
131+
text = "",
132132
leadingIcon = leadingIcon,
133133
trailingIcon = trailingIcon,
134134
enabled = enabled,
135135
tagViewModifiers = tagViewModifiers,
136-
overFlowText = ""
136+
overFlowText = overFlowText.value
137137
)
138138
}
139139
}

core/ui/src/main/java/co/yml/coreui/core/ui/ytag/model/TagViewData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ data class TagViewData(
2323
val overFlowText: (Int) -> String = { _ -> "" }
2424
)
2525

26-
data class AlphaAnimation(var enabled: Boolean = true, val durationMillis: Int = 650)
26+
data class AlphaAnimation(var enabled: Boolean = false, val durationMillis: Int = 650)

0 commit comments

Comments
 (0)