Skip to content

Commit 986cfc3

Browse files
Updated catalog app home screen elements properties.
1 parent 2a16eef commit 986cfc3

File tree

3 files changed

+56
-17
lines changed

3 files changed

+56
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ data class TagViewModifiers(
8484
val semantics: String
8585
) {
8686
class Builder {
87-
private var minWidth: Dp = 52.dp
87+
private var minWidth: Dp = 80.dp
8888
private var minHeight: Dp = 32.dp
8989
private var width: Dp? = null
9090
private var height: Dp = minHeight
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="light_gray">#E0E0E0</color>
4+
</resources>

feature/ytag/src/main/java/co/yml/coreui/feature/ytag/ui/YTagActivity.kt

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class YTagActivity : ComponentActivity() {
7070
items(10) { item ->
7171
when (item) {
7272
0 -> CapsuleTag()
73-
// 1 -> RectangleTag()
74-
// 2 -> RoundRectangleTag()
73+
1 -> RectangleTag()
74+
2 -> RoundRectangleTag()
7575
3 -> DefaultTag()
7676
4 -> TagWithLeadingIcon()
7777
5 -> TagWithTrailingIcon()
@@ -105,7 +105,6 @@ fun DefaultTag() {
105105
@Composable
106106
fun CapsuleTag() {
107107
val tagViewModifiers = TagViewModifiers.Builder()
108-
.width(100.dp)
109108
.shape(CircleShape)
110109
.backgroundColor(Color.Black)
111110
.textColor(Color.White)
@@ -121,7 +120,7 @@ fun CapsuleTag() {
121120
@Composable
122121
fun RectangleTag() {
123122
val tagViewModifiers = TagViewModifiers.Builder()
124-
.width(100.dp)
123+
.width(90.dp)
125124
.shape(RectangleShape)
126125
.backgroundColor(Color.Black)
127126
.textColor(Color.White)
@@ -138,7 +137,7 @@ fun RectangleTag() {
138137
fun RoundRectangleTag() {
139138
val tagViewModifiers = TagViewModifiers.Builder()
140139
.shape(RoundedCornerShape(dimensionResource(id = R.dimen.padding_small)))
141-
.width(100.dp)
140+
.width(120.dp)
142141
.backgroundColor(Color.Black)
143142
.textColor(Color.White)
144143
.style(textStyle)
@@ -154,7 +153,7 @@ fun RoundRectangleTag() {
154153
fun TagWithLeadingIcon() {
155154
val context = LocalContext.current
156155
val tagViewModifiers = TagViewModifiers.Builder()
157-
.width(100.dp)
156+
.width(120.dp)
158157
.maxLines(1)
159158
.overFlow(TextOverflow.Ellipsis)
160159
.shape(CircleShape)
@@ -185,7 +184,7 @@ fun TagWithLeadingIcon() {
185184
fun TagWithTrailingIcon() {
186185
val context = LocalContext.current
187186
val tagViewModifiers = TagViewModifiers.Builder()
188-
.width(100.dp)
187+
.width(150.dp)
189188
.maxLines(1)
190189
.textAlign(TextAlign.Start)
191190
.overFlow(TextOverflow.Ellipsis)
@@ -217,7 +216,7 @@ fun TagWithTrailingIcon() {
217216
fun TagWithLeadingTrailingIcon() {
218217
val context = LocalContext.current
219218
val tagViewModifiers = TagViewModifiers.Builder()
220-
.width(100.dp)
219+
.width(140.dp)
221220
.maxLines(1)
222221
.overFlow(TextOverflow.Ellipsis)
223222
.shape(CircleShape)
@@ -309,6 +308,9 @@ fun ShadowTag() {
309308

310309
@Composable
311310
fun DefaultTagViewContainer() {
311+
val context = LocalContext.current
312+
val text = stringResource(id = co.yml.coreui.feature.ytag.R.string.tag_leading_icon)
313+
312314
val tagViewModifiers = TagViewModifiers.Builder()
313315
.shape(CircleShape)
314316
.width(100.dp)
@@ -326,7 +328,7 @@ fun DefaultTagViewContainer() {
326328
val tagViewData = listOf(
327329
TagViewData("Tag view 1", tagViewModifiers),
328330
TagViewData("Tag 2", TagViewModifiers.Builder()
329-
.width(100.dp)
331+
.width(60.dp)
330332
.shape(CircleShape)
331333
.backgroundColor(Color.Black)
332334
.textColor(Color.White)
@@ -336,10 +338,42 @@ fun DefaultTagViewContainer() {
336338
Log.i("check_click", "tag view clicked")
337339
}
338340
.build()),
339-
TagViewData("Tag 3", tagViewModifiers),
341+
TagViewData("Tag 3", TagViewModifiers.Builder()
342+
.width(100.dp)
343+
.textColor(Color.Black)
344+
.enableBorder(true)
345+
.borderColor(Color.Red)
346+
.borderWidth(dimensionResource(id = R.dimen.padding_very_tiny))
347+
.backgroundColor(Color.White)
348+
.shape(CircleShape)
349+
.style(textStyle)
350+
.build()),
340351
TagViewData("Tag view 4", tagViewModifiers),
341-
TagViewData("Tag view 5", tagViewModifiers),
342-
TagViewData("Tag view 6", tagViewModifiers),
352+
TagViewData("Tag 5", tagViewModifiers.copy(width = 60.dp)),
353+
TagViewData(text = "Tag view 6", tagViewModifiers = TagViewModifiers.Builder()
354+
.width(120.dp)
355+
.maxLines(1)
356+
.textAlign(TextAlign.Start)
357+
.overFlow(TextOverflow.Ellipsis)
358+
.shape(CircleShape)
359+
.backgroundColor(Color.Black)
360+
.textColor(Color.White)
361+
.build()
362+
,leadingIcon = { enabled ->
363+
IconButton(
364+
modifier = Modifier.size(dimensionResource(id = R.dimen.padding_normal_medium)),
365+
onClick = {
366+
if (enabled) {
367+
Toast.makeText(context, text, Toast.LENGTH_SHORT).show()
368+
}
369+
}) {
370+
Icon(
371+
painter = painterResource(id = co.yml.coreui.feature.ytag.R.drawable.ic_location_24px),
372+
contentDescription = null,
373+
tint = Color.White
374+
)
375+
}
376+
}),
343377
TagViewData("Tag view 7", tagViewModifiers),
344378
TagViewData("Tag view 8", tagViewModifiers),
345379
TagViewData("Tag view 9", tagViewModifiers),
@@ -355,17 +389,18 @@ fun DefaultTagViewContainer() {
355389
.shape(RoundedCornerShape(4.dp))
356390
.tagSpacingVertical(8.dp)
357391
.tagSpacingHorizontal(8.dp)
358-
.backgroundColor(Color.Gray)
392+
.backgroundColor(colorResource(id = R.color.light_gray))
359393
.width(250.dp)
360-
.height(240.dp)
394+
.height(230.dp)
361395
.moreTagConfiguration(
362396
TagViewData(
363397
overFlowText = {count ->
364398
"$count more"
365399
},
366-
tagViewModifiers = TagViewModifiers.Builder().backgroundColor(Color.Gray)
400+
tagViewModifiers = TagViewModifiers.Builder().backgroundColor(colorResource(id = R.color.light_gray))
367401
.width(100.dp)
368-
.textColor(Color.White)
402+
.textColor(Color.Black)
403+
.textAlign(TextAlign.Start)
369404
.onCLick { Log.i("check_click", "more tag clicked") }.build()
370405
)
371406
)

0 commit comments

Comments
 (0)