Skip to content

Commit e66070a

Browse files
authored
Merge pull request #95 from eshc123/dev
[RELEASE]
2 parents 7279145 + f80da90 commit e66070a

File tree

23 files changed

+877
-197
lines changed

23 files changed

+877
-197
lines changed

core/common/src/main/java/com/eshc/goonersapp/core/common/util/DateUtil.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ object DateUtil {
1616
.format(DateTimeFormatter.ofPattern("yyyy.MM"))
1717
}
1818

19-
fun getYearAndMonthAndDateString(date: String): String {
19+
fun getYearAndMonthAndDateString(date: String,useTwoDigitYear : Boolean = false): String {
2020
if (date.isBlank()) return date
2121
return LocalDate.parse(date, defaultDateFormat)
22-
.format(DateTimeFormatter.ofPattern("yyyy.MM.dd"))
22+
.format(DateTimeFormatter.ofPattern(
23+
if(useTwoDigitYear) "yy.MM.dd"
24+
else "yyyy.MM.dd"
25+
))
2326
}
2427

2528
fun getYearAndMonthAndDateAndTimeString(date: String): String {

core/data/src/main/java/com/eshc/goonersapp/core/data/mapper/SeasonMapper.kt

+1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ fun RemoteRank.toModel() = Rank(
2929
goalDifference = goalDifference,
3030
teamId = teamId,
3131
teamName = teamName,
32+
teamImgUrl = teamImgUrl,
3233
shortCode = shortCode
3334
)

core/designsystem/src/main/java/com/eshc/goonersapp/core/designsystem/__IconPack.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.eshc.goonersapp.core.designsystem
22

33
import androidx.compose.ui.graphics.vector.ImageVector
4-
import com.eshc.goonersapp.core.designsystem.iconpack.IcArrowDown
4+
import com.eshc.goonersapp.core.designsystem.iconpack.IcBall
5+
import com.eshc.goonersapp.core.designsystem.iconpack.IcTrophy
56
import kotlin.collections.List as ____KtList
67

78
public object IconPack
@@ -13,6 +14,6 @@ public val IconPack.Icons: ____KtList<ImageVector>
1314
if (__Icons != null) {
1415
return __Icons!!
1516
}
16-
__Icons= listOf(IcArrowDown)
17+
__Icons= listOf(IcBall, IcTrophy)
1718
return __Icons!!
1819
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.eshc.goonersapp.core.designsystem.component
2+
3+
import androidx.compose.foundation.layout.Column
4+
import androidx.compose.foundation.layout.WindowInsets
5+
import androidx.compose.foundation.layout.displayCutout
6+
import androidx.compose.foundation.layout.navigationBars
7+
import androidx.compose.foundation.layout.windowInsetsPadding
8+
import androidx.compose.foundation.shape.RoundedCornerShape
9+
import androidx.compose.material3.ExperimentalMaterial3Api
10+
import androidx.compose.material3.ModalBottomSheet
11+
import androidx.compose.material3.rememberModalBottomSheetState
12+
import androidx.compose.runtime.Composable
13+
import androidx.compose.ui.Modifier
14+
import androidx.compose.ui.unit.dp
15+
import com.eshc.goonersapp.core.designsystem.theme.ColorFFFFFFFF
16+
17+
@OptIn(ExperimentalMaterial3Api::class)
18+
@Composable
19+
fun GnrBottomSheet(
20+
onDismiss: () -> Unit,
21+
content : @Composable () -> Unit
22+
) {
23+
val modalBottomSheetState = rememberModalBottomSheetState()
24+
ModalBottomSheet(
25+
onDismissRequest = onDismiss,
26+
sheetState = modalBottomSheetState,
27+
shape = RoundedCornerShape(
28+
topStart = 35.dp,
29+
topEnd = 35.dp
30+
),
31+
containerColor = ColorFFFFFFFF,
32+
windowInsets = WindowInsets.displayCutout
33+
) {
34+
Column(
35+
modifier = Modifier.windowInsetsPadding(WindowInsets.navigationBars)
36+
) {
37+
content()
38+
}
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.eshc.goonersapp.core.designsystem.component
2+
3+
import androidx.compose.foundation.layout.PaddingValues
4+
import androidx.compose.foundation.layout.fillMaxWidth
5+
import androidx.compose.foundation.shape.RoundedCornerShape
6+
import androidx.compose.material.ButtonDefaults
7+
import androidx.compose.material.Text
8+
import androidx.compose.material.TextButton
9+
import androidx.compose.runtime.Composable
10+
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.graphics.Color
12+
import androidx.compose.ui.text.style.TextAlign
13+
import androidx.compose.ui.unit.Dp
14+
import androidx.compose.ui.unit.dp
15+
import com.eshc.goonersapp.core.designsystem.theme.ColorFF10358A
16+
import com.eshc.goonersapp.core.designsystem.theme.ColorFFFFFFFF
17+
import com.eshc.goonersapp.core.designsystem.theme.GnrTypography
18+
19+
@Composable
20+
fun GnrTextButton(
21+
text: String,
22+
onClick: () -> Unit,
23+
modifier: Modifier = Modifier,
24+
containerColor: Color = ColorFF10358A,
25+
contentColor: Color = ColorFFFFFFFF,
26+
round: Dp = 15.dp,
27+
contentPaddingValues : PaddingValues = PaddingValues(vertical = 10.dp,)
28+
) {
29+
TextButton(
30+
modifier = modifier,
31+
onClick = onClick,
32+
colors = ButtonDefaults.textButtonColors(
33+
backgroundColor = containerColor,
34+
contentColor = contentColor
35+
),
36+
shape = RoundedCornerShape(round),
37+
contentPadding = contentPaddingValues
38+
) {
39+
Text(
40+
modifier = Modifier.fillMaxWidth(),
41+
text = text,
42+
style = GnrTypography.heading2SemiBold,
43+
textAlign = TextAlign.Center
44+
)
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,49 @@
11
package com.eshc.goonersapp.core.designsystem.component
22

33
import androidx.compose.foundation.BorderStroke
4+
import androidx.compose.foundation.background
45
import androidx.compose.foundation.clickable
56
import androidx.compose.foundation.layout.Box
7+
import androidx.compose.foundation.layout.Column
8+
import androidx.compose.foundation.layout.PaddingValues
69
import androidx.compose.foundation.layout.fillMaxWidth
10+
import androidx.compose.foundation.layout.heightIn
711
import androidx.compose.foundation.layout.padding
12+
import androidx.compose.foundation.layout.wrapContentHeight
813
import androidx.compose.foundation.lazy.LazyColumn
9-
import androidx.compose.foundation.lazy.itemsIndexed
10-
import androidx.compose.foundation.lazy.rememberLazyListState
14+
import androidx.compose.foundation.lazy.items
15+
import androidx.compose.foundation.shape.CircleShape
1116
import androidx.compose.foundation.shape.RoundedCornerShape
1217
import androidx.compose.material3.ButtonDefaults
1318
import androidx.compose.material3.HorizontalDivider
1419
import androidx.compose.material3.Icon
15-
import androidx.compose.material3.LocalContentColor
16-
import androidx.compose.material3.MaterialTheme
1720
import androidx.compose.material3.OutlinedButton
18-
import androidx.compose.material3.Surface
1921
import androidx.compose.material3.Text
2022
import androidx.compose.runtime.Composable
21-
import androidx.compose.runtime.CompositionLocalProvider
22-
import androidx.compose.runtime.LaunchedEffect
2323
import androidx.compose.runtime.getValue
2424
import androidx.compose.runtime.mutableStateOf
2525
import androidx.compose.runtime.remember
2626
import androidx.compose.runtime.setValue
27+
import androidx.compose.ui.Alignment
2728
import androidx.compose.ui.Modifier
29+
import androidx.compose.ui.draw.clip
30+
import androidx.compose.ui.graphics.Color
2831
import androidx.compose.ui.unit.dp
29-
import androidx.compose.ui.window.Dialog
3032
import com.eshc.goonersapp.core.designsystem.IconPack
3133
import com.eshc.goonersapp.core.designsystem.iconpack.IcArrowDown
34+
import com.eshc.goonersapp.core.designsystem.theme.ColorFF000000
35+
import com.eshc.goonersapp.core.designsystem.theme.ColorFF181818
3236
import com.eshc.goonersapp.core.designsystem.theme.ColorFF777777
3337
import com.eshc.goonersapp.core.designsystem.theme.ColorFF9E9E9E
3438
import com.eshc.goonersapp.core.designsystem.theme.ColorFFDCDCDC
39+
import com.eshc.goonersapp.core.designsystem.theme.ColorFFF5F5F5
3540
import com.eshc.goonersapp.core.designsystem.theme.GnrTypography
36-
import com.eshc.goonersapp.core.designsystem.theme.GoonersAppTheme
3741

3842
@Composable
39-
fun <T> GnrDropdownMenu(
43+
fun GnrDropdownMenuWithBottomSheet(
44+
label : String,
4045
modifier: Modifier = Modifier,
41-
label: String = "",
42-
items: List<T> = emptyList(),
43-
notSetLabel: String? = null,
44-
selectedIndex: Int = -1,
45-
onItemSelected: (index: Int, item: T) -> Unit,
46-
selectedItemToString: (T) -> String = { it.toString() },
47-
drawItem: @Composable (T, Boolean, Boolean, () -> Unit) -> Unit = { item, selected, itemEnabled, onClick ->
48-
LargeDropdownMenuItem(
49-
text = item.toString(),
50-
selected = selected,
51-
enabled = itemEnabled,
52-
onClick = onClick,
53-
)
54-
},
46+
bottomSheetContent : @Composable (()-> Unit) -> Unit
5547
) {
5648
var expanded by remember { mutableStateOf(false) }
5749

@@ -61,7 +53,7 @@ fun <T> GnrDropdownMenu(
6153
contentColor = ColorFF9E9E9E
6254
),
6355
border = BorderStroke(1.dp, ColorFFDCDCDC),
64-
shape = RoundedCornerShape(100.dp),
56+
shape = CircleShape,
6557
onClick = {
6658
expanded = true
6759
}
@@ -70,7 +62,7 @@ fun <T> GnrDropdownMenu(
7062
modifier = Modifier
7163
.weight(1f)
7264
.padding(end = 4.dp),
73-
text = items.getOrNull(selectedIndex)?.let { selectedItemToString(it) } ?: label,
65+
text = label,
7466
style = GnrTypography.body1Regular,
7567
color = ColorFF777777
7668
)
@@ -81,75 +73,97 @@ fun <T> GnrDropdownMenu(
8173
}
8274

8375
if (expanded) {
84-
Dialog(
85-
onDismissRequest = { expanded = false },
76+
GnrBottomSheet(
77+
onDismiss = {
78+
expanded = !expanded
79+
}
8680
) {
87-
GoonersAppTheme {
88-
Surface(
89-
shape = RoundedCornerShape(12.dp),
90-
) {
91-
val listState = rememberLazyListState()
92-
if (selectedIndex > -1) {
93-
LaunchedEffect("ScrollToSelected") {
94-
listState.scrollToItem(index = selectedIndex)
95-
}
96-
}
97-
98-
LazyColumn(modifier = Modifier.fillMaxWidth(), state = listState) {
99-
if (notSetLabel != null) {
100-
item {
101-
LargeDropdownMenuItem(
102-
text = notSetLabel,
103-
selected = false,
104-
enabled = false,
105-
onClick = { },
106-
)
107-
}
108-
}
109-
itemsIndexed(items) { index, item ->
110-
val selectedItem = index == selectedIndex
111-
drawItem(
112-
item,
113-
selectedItem,
114-
true
115-
) {
116-
onItemSelected(index, item)
117-
expanded = false
118-
}
81+
bottomSheetContent{
82+
expanded = !expanded
83+
}
84+
}
85+
}
86+
}
11987

120-
if (index < items.lastIndex) {
121-
HorizontalDivider(modifier = Modifier.padding(horizontal = 16.dp))
122-
}
123-
}
124-
}
125-
}
88+
@Composable
89+
fun <T> GnrMenuContent(
90+
title: String,
91+
menuItems : List<T>,
92+
selectedItem : T? = null,
93+
onClick: (T?) -> Unit,
94+
modifier: Modifier = Modifier
95+
) {
96+
var selected by remember {
97+
mutableStateOf(selectedItem)
98+
}
99+
Column(
100+
modifier = modifier,
101+
horizontalAlignment = Alignment.CenterHorizontally
102+
) {
103+
Text(
104+
modifier = Modifier.padding(vertical = 7.dp),
105+
text = title,
106+
style = GnrTypography.heading2SemiBold,
107+
color = ColorFF181818
108+
)
109+
LazyColumn(
110+
modifier = Modifier
111+
.fillMaxWidth()
112+
.heightIn(max = 217.dp),
113+
contentPadding = PaddingValues(start = 15.dp, end = 15.dp, bottom = 16.dp)
114+
) {
115+
items(
116+
menuItems
117+
) {
118+
GnrMenuItem(
119+
text = it.toString(),
120+
selected = selected == it,
121+
onClick = {
122+
selected = it
123+
},
124+
modifier = Modifier.fillMaxWidth()
125+
)
126126
}
127127
}
128+
HorizontalDivider()
129+
GnrTextButton(
130+
modifier = Modifier
131+
.padding(vertical = 16.dp, horizontal = 50.dp)
132+
.fillMaxWidth()
133+
.wrapContentHeight(),
134+
onClick = {
135+
onClick(selected)
136+
},
137+
text = "OK"
138+
)
128139
}
140+
129141
}
130142

131143
@Composable
132-
fun LargeDropdownMenuItem(
144+
fun GnrMenuItem(
133145
text: String,
134146
selected: Boolean,
135-
enabled: Boolean,
136147
onClick: () -> Unit,
148+
modifier: Modifier = Modifier
137149
) {
138-
val contentColor = when {
139-
!enabled -> MaterialTheme.colorScheme.onSurface
140-
selected -> MaterialTheme.colorScheme.primary
141-
else -> MaterialTheme.colorScheme.onSurface
150+
Box(
151+
modifier = modifier
152+
.wrapContentHeight()
153+
.clip(RoundedCornerShape(10.dp))
154+
.background(if (selected) ColorFFF5F5F5 else Color.Transparent)
155+
.clickable {
156+
onClick()
157+
}
158+
.padding(vertical = 7.dp)
159+
,
160+
contentAlignment = Alignment.Center
161+
) {
162+
Text(
163+
text = text,
164+
style = GnrTypography.body1Medium,
165+
color = ColorFF000000
166+
)
142167
}
143168

144-
CompositionLocalProvider(LocalContentColor provides contentColor) {
145-
Box(modifier = Modifier
146-
.clickable(enabled) { onClick() }
147-
.fillMaxWidth()
148-
.padding(16.dp)) {
149-
Text(
150-
text = text,
151-
style = MaterialTheme.typography.titleSmall,
152-
)
153-
}
154-
}
155169
}

0 commit comments

Comments
 (0)