From 4ac3f4abdf36541be1dd780b875463c9b39a459d Mon Sep 17 00:00:00 2001 From: hyeonseo Date: Tue, 22 Aug 2023 09:36:10 +0900 Subject: [PATCH 1/5] =?UTF-8?q?:bento:=20::=20=EB=B0=98=20=EC=BD=94?= =?UTF-8?q?=ED=8A=B8=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/drawable/ic_badminton_court.xml | 96 +++---------------- 1 file changed, 13 insertions(+), 83 deletions(-) diff --git a/GYMI-components/src/main/res/drawable/ic_badminton_court.xml b/GYMI-components/src/main/res/drawable/ic_badminton_court.xml index e0cae70..1d99b22 100644 --- a/GYMI-components/src/main/res/drawable/ic_badminton_court.xml +++ b/GYMI-components/src/main/res/drawable/ic_badminton_court.xml @@ -1,114 +1,44 @@ + android:width="352dp" + android:height="101dp" + android:viewportWidth="352" + android:viewportHeight="101"> - - - - - - - - - - - - - - - - - - - - + android:pathData="M0,0h352v100h-352z" + android:fillColor="#ffffff"/> From a81fb5da80f5b816ed371a2e38e94d644a432e28 Mon Sep 17 00:00:00 2001 From: hyeonseo Date: Tue, 22 Aug 2023 09:36:55 +0900 Subject: [PATCH 2/5] =?UTF-8?q?:lipstick:=20::=20=EB=B0=98=20=EC=BD=94?= =?UTF-8?q?=ED=8A=B8=20=EA=B8=B0=EC=A4=80=EC=9C=BC=EB=A1=9C=20isReserved?= =?UTF-8?q?=20&=20onClick=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/court/GYMIBadmintonCourt.kt | 51 +++++++++++-------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt index bdf98a4..2ef1929 100644 --- a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt +++ b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt @@ -2,6 +2,7 @@ package com.mpersand.gymi_components.component.court import androidx.compose.foundation.Image import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Column import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -10,6 +11,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.BlendMode import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import com.mpersand.gymi_components.R @@ -19,26 +21,35 @@ import com.mpersand.gymi_components.theme.White @Composable fun GYMIBadmintonCourt( modifier: Modifier = Modifier, - isReserved: Boolean, - onClick: () -> Unit + isReserved: Int, + onUpperClick: () -> Unit, + onLowerClick: () -> Unit ) { - var isClicked by remember { mutableStateOf(false) } + var isClicked by remember { mutableStateOf(-1) } - Image( - modifier = modifier.clickable { - isClicked = !isClicked - onClick() - }, - painter = painterResource(id = R.drawable.ic_badminton_court), - contentDescription = "badminton_court", - contentScale = ContentScale.FillBounds, - colorFilter = ColorFilter.tint( - color = when { - isClicked && !isReserved -> GYMITheme.colors.positive - isReserved -> GYMITheme.colors.error - else -> White - }, - blendMode = BlendMode.Darken - ) - ) + Column(modifier = modifier) { + repeat(2) { + Image( + modifier = Modifier + .clickable { + isClicked = if (isClicked == it) -1 else it + if (it % 2 != 0) onLowerClick() else onUpperClick() + } + .graphicsLayer { + if (it % 2 != 0) rotationX = 180f + }, + painter = painterResource(id = R.drawable.ic_badminton_court), + contentDescription = "badminton_court", + contentScale = ContentScale.FillBounds, + colorFilter = ColorFilter.tint( + color = when { + isClicked == it && isReserved != it -> GYMITheme.colors.positive + isReserved == it -> GYMITheme.colors.error + else -> White + }, + blendMode = BlendMode.Darken + ) + ) + } + } } \ No newline at end of file From 287e5a3c10ae6fe42e0c10411b83967f1b0dea4f Mon Sep 17 00:00:00 2001 From: hyeonseo Date: Tue, 22 Aug 2023 09:49:08 +0900 Subject: [PATCH 3/5] =?UTF-8?q?:sparkles:=20::=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=95=9C=EB=B2=88=EC=97=90=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gymi_components/component/court/GYMIBadmintonCourt.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt index 2ef1929..6075bc6 100644 --- a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt +++ b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt @@ -22,8 +22,7 @@ import com.mpersand.gymi_components.theme.White fun GYMIBadmintonCourt( modifier: Modifier = Modifier, isReserved: Int, - onUpperClick: () -> Unit, - onLowerClick: () -> Unit + onClick: () -> Unit ) { var isClicked by remember { mutableStateOf(-1) } @@ -33,7 +32,7 @@ fun GYMIBadmintonCourt( modifier = Modifier .clickable { isClicked = if (isClicked == it) -1 else it - if (it % 2 != 0) onLowerClick() else onUpperClick() + onClick() } .graphicsLayer { if (it % 2 != 0) rotationX = 180f From 51ad44dcefce48da42ee2cf2b76bc87bda9cc3bf Mon Sep 17 00:00:00 2001 From: hyeonseo Date: Tue, 22 Aug 2023 09:59:34 +0900 Subject: [PATCH 4/5] =?UTF-8?q?:lipstick:=20::=20=EB=B0=98=20=EC=BD=94?= =?UTF-8?q?=ED=8A=B8=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/court/GYMIBadmintonCourt.kt | 49 ++++++++----------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt index 6075bc6..210d8c6 100644 --- a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt +++ b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt @@ -2,7 +2,6 @@ package com.mpersand.gymi_components.component.court import androidx.compose.foundation.Image import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Column import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -11,7 +10,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.BlendMode import androidx.compose.ui.graphics.ColorFilter -import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import com.mpersand.gymi_components.R @@ -21,34 +19,27 @@ import com.mpersand.gymi_components.theme.White @Composable fun GYMIBadmintonCourt( modifier: Modifier = Modifier, - isReserved: Int, + isReserved: Boolean, onClick: () -> Unit ) { - var isClicked by remember { mutableStateOf(-1) } + var isClicked by remember { mutableStateOf(false) } - Column(modifier = modifier) { - repeat(2) { - Image( - modifier = Modifier - .clickable { - isClicked = if (isClicked == it) -1 else it - onClick() - } - .graphicsLayer { - if (it % 2 != 0) rotationX = 180f - }, - painter = painterResource(id = R.drawable.ic_badminton_court), - contentDescription = "badminton_court", - contentScale = ContentScale.FillBounds, - colorFilter = ColorFilter.tint( - color = when { - isClicked == it && isReserved != it -> GYMITheme.colors.positive - isReserved == it -> GYMITheme.colors.error - else -> White - }, - blendMode = BlendMode.Darken - ) - ) - } - } + Image( + modifier = modifier + .clickable { + isClicked = !isClicked + onClick() + }, + painter = painterResource(id = R.drawable.ic_badminton_court), + contentDescription = "badminton_court", + contentScale = ContentScale.FillBounds, + colorFilter = ColorFilter.tint( + color = when { + isClicked && !isReserved -> GYMITheme.colors.positive + isReserved -> GYMITheme.colors.error + else -> White + }, + blendMode = BlendMode.Darken + ) + ) } \ No newline at end of file From 7ba904d1db848e7ad2de1e36bef997dd6441bc97 Mon Sep 17 00:00:00 2001 From: hyeonseo Date: Tue, 22 Aug 2023 10:01:08 +0900 Subject: [PATCH 5/5] =?UTF-8?q?:fire:=20::=20clickable=20=EA=B0=9C?= =?UTF-8?q?=ED=96=89=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gymi_components/component/court/GYMIBadmintonCourt.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt index 210d8c6..e492c99 100644 --- a/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt +++ b/GYMI-components/src/main/java/com/mpersand/gymi_components/component/court/GYMIBadmintonCourt.kt @@ -25,8 +25,7 @@ fun GYMIBadmintonCourt( var isClicked by remember { mutableStateOf(false) } Image( - modifier = modifier - .clickable { + modifier = modifier.clickable { isClicked = !isClicked onClick() },