From 855209a1ff18c92554032f8d7abffce8c59c36aa Mon Sep 17 00:00:00 2001 From: penguinseohyun Date: Mon, 29 Apr 2024 22:05:20 +0900 Subject: [PATCH 1/3] =?UTF-8?q?ui=20:=20setting=20ui=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/application/MainActivity.kt | 172 +++++++++++------- 1 file changed, 103 insertions(+), 69 deletions(-) diff --git a/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt b/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt index 333bee6c8e..fee6a51441 100644 --- a/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt +++ b/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt @@ -36,6 +36,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.shape.RoundedCornerShape @@ -1639,141 +1640,174 @@ class MainActivity : ComponentActivity() { } @Composable - fun Setting(){ + fun Setting() { - val alarmbtnState = remember{ mutableStateOf(false) } - val databtnState = remember{ mutableStateOf(false) } - val InquirybtnState = remember{ mutableStateOf(false) } - val versionbtnState = remember{ mutableStateOf(false) } + val alarmbtnState = remember { mutableStateOf(false) } + val databtnState = remember { mutableStateOf(false) } + val version : String = "V 1.1" + val versionState = remember { mutableStateOf(true)} + val LatestVersion : String = "가장 최신버전이에요" + val NotLatestVersion : String = "앗 ! 최신버전이 아니에요. 업데이트가 필요해요" + val InquirybtnState = remember { mutableStateOf(false) } + val versionbtnState = remember { mutableStateOf(false) } Box( Modifier .background(tertiary_500) .fillMaxSize() - .padding(horizontal = 30.dp)) { + .padding(horizontal = 30.dp) + ) { Column( Modifier - .padding(top = 40.dp)) { + .padding(top = 40.dp) + ) { Column(modifier = Modifier - .width(83.dp) - .clickable { alarmbtnState.value = !alarmbtnState.value }){ - Column(modifier = Modifier.padding(horizontal = 8.dp)) { - P_Medium18( - content = "알림 설정", - color = if(alarmbtnState.value) primary_500 else black - ) - } - Spacer(modifier = Modifier.height(4.dp)) - Divider(color = if(alarmbtnState.value) primary_500 else black) + .wrapContentWidth() + .clickable { + alarmbtnState.value = !alarmbtnState.value + databtnState.value = false + InquirybtnState.value = false + versionbtnState.value = false + }) { + Column(modifier = Modifier.padding(horizontal = 8.dp)) { + P_Medium( + content = "알림 설정", + color = if (alarmbtnState.value) primary_500 else black, + size = if (alarmbtnState.value) 18.sp else 14.sp + ) + Spacer(modifier = Modifier.height(4.dp)) + } + Divider(color = if (alarmbtnState.value) primary_500 else black, + modifier = if (alarmbtnState.value) Modifier.width(83.dp) else Modifier.width(68.dp)) + } - if (alarmbtnState.value){ + if (alarmbtnState.value) { Spacer(modifier = Modifier.height(8.dp)) Toggle() Spacer(modifier = Modifier.height(16.dp)) - } - else{ + } else { Spacer(modifier = Modifier.height(40.dp)) } Column(modifier = Modifier - .width(134.dp) - .clickable { }){ - Column(modifier = Modifier.padding(horizontal = 8.dp)) { - P_Medium18( - content = "계정 이메일 변경", - color = black - ) - } - Spacer(modifier = Modifier.height(4.dp)) - Divider(color = black) - } - Spacer(modifier = Modifier.height(40.dp)) - - - Column(modifier = Modifier - .width(99.dp) - .clickable { databtnState.value = !databtnState.value }){ + .wrapContentWidth() + .clickable { + databtnState.value = !databtnState.value + alarmbtnState.value = false + InquirybtnState.value = false + versionbtnState.value = false + }) { Column(modifier = Modifier.padding(horizontal = 8.dp)) { - P_Medium18( + P_Medium( content = "데이터 허용", - color = if(databtnState.value) primary_500 else black + color = if (databtnState.value) primary_500 else black, + size = if (databtnState.value) 18.sp else 14.sp ) } Spacer(modifier = Modifier.height(4.dp)) - Divider(color = if(databtnState.value) primary_500 else black) + Divider(color = if (databtnState.value) primary_500 else black, + modifier = if (databtnState.value) Modifier.width(99.dp) else Modifier.width(80.dp)) } - if (databtnState.value){ + if (databtnState.value) { Spacer(modifier = Modifier.height(8.dp)) Toggle() Spacer(modifier = Modifier.height(8.dp)) - P_Medium11(content = "셀룰러 데이터를 허용하면, 데이터 환경에서도 녹음카드 분석 가능해요\n" + - "허용하지 않으면, Wi-Fi가 연결된 환경에서만 분석돼요", color = neutral_600) + P_Medium11( + content = "셀룰러 데이터를 허용하면, 데이터 환경에서도 녹음카드 분석 가능해요\n" + + "허용하지 않으면, Wi-Fi가 연결된 환경에서만 분석해요", color = neutral_600 + ) Spacer(modifier = Modifier.height(16.dp)) - } - else{ + } else { Spacer(modifier = Modifier.height(40.dp)) } Column(modifier = Modifier - .width(79.dp) - .clickable { InquirybtnState.value = !InquirybtnState.value }){ + .wrapContentWidth() + .clickable { + versionbtnState.value = !versionbtnState.value + alarmbtnState.value = false + databtnState.value = false + InquirybtnState.value = false + }) { Column(modifier = Modifier.padding(horizontal = 8.dp)) { - P_Medium18( - content = "문의하기", - color = if(InquirybtnState.value) primary_500 else black + P_Medium( + content = "버전안내", + color = if (versionbtnState.value) primary_500 else black, + size = if (versionbtnState.value) 18.sp else 14.sp ) } Spacer(modifier = Modifier.height(4.dp)) - Divider(color = if(InquirybtnState.value) primary_500 else black) + Divider(color = if (versionbtnState.value) primary_500 else black, + modifier = if (versionbtnState.value) Modifier.width(79.dp) else Modifier.width(65.dp)) } - if (InquirybtnState.value){ + if (versionbtnState.value) { Spacer(modifier = Modifier.height(8.dp)) - P_Medium14(content = "kookminmoment@gmail.com", color = black) + Row { + Spacer(modifier = Modifier.width(8.dp)) + P_Medium14(content = version, color = black) + Spacer(modifier = Modifier.width(40.dp)) + P_Medium11(content = if(versionState.value) LatestVersion else NotLatestVersion, color = neutral_500) + } + Spacer(modifier = Modifier.height(16.dp)) - } - else{ + } else { Spacer(modifier = Modifier.height(40.dp)) } Column(modifier = Modifier - .width(79.dp) - .clickable { versionbtnState.value = !versionbtnState.value }){ + .wrapContentWidth() + .clickable { + InquirybtnState.value = !InquirybtnState.value + alarmbtnState.value = false + databtnState.value = false + versionbtnState.value = false + }) { Column(modifier = Modifier.padding(horizontal = 8.dp)) { - P_Medium18( - content = "버전안내", - color = if (versionbtnState.value) primary_500 else black + P_Medium( + content = "문의하기", + color = if (InquirybtnState.value) primary_500 else black, + size = if (InquirybtnState.value) 18.sp else 14.sp ) } Spacer(modifier = Modifier.height(4.dp)) - Divider(color = if (versionbtnState.value) primary_500 else black) + Divider(color = if (InquirybtnState.value) primary_500 else black, + modifier = if (InquirybtnState.value) Modifier.width(79.dp) else Modifier.width(65.dp)) } - if (versionbtnState.value){ + if (InquirybtnState.value) { Spacer(modifier = Modifier.height(8.dp)) - P_Medium14(content = "v1.1", color = black) + Row { + Spacer(modifier = Modifier.width(8.dp)) + Column { + P_Medium14(content = "kookminmoment@gmail.com", color = black) + Spacer(modifier = Modifier.height(4.dp)) + P_Medium11(content = "앗 ! 사용하시면서 불편한 점이 있으시다고요?\n" + + "이메일로 보내주시면 친절히 답변해드릴게요", color = neutral_500) + } + } Spacer(modifier = Modifier.height(16.dp)) - } - else{ + } else { Spacer(modifier = Modifier.height(40.dp)) } Column( Modifier - .padding(top = 150.dp)) { - Column(Modifier.clickable { }) { + .padding(top = 150.dp) + ) { + Column(Modifier.clickable { }) { P_Medium14("로그아웃", black) } Spacer(modifier = Modifier.height(28.dp)) - Column(Modifier.clickable { }) { + Column(Modifier.clickable { }) { P_Medium14("탈퇴하기", black) } } + } } } -} @Composable fun Toggle() { From 948e50d4e5978b25dd7d9a9ab75daf5004ed609d Mon Sep 17 00:00:00 2001 From: penguinseohyun Date: Mon, 29 Apr 2024 23:18:24 +0900 Subject: [PATCH 2/3] =?UTF-8?q?ui=20:=20setting=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83,=20=ED=83=88=ED=87=B4=ED=95=98=EA=B8=B0=20di?= =?UTF-8?q?alog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/application/MainActivity.kt | 38 +++++++++- .../application/app/composable/Composable.kt | 76 +++++++++++++++++++ .../android/application/domain/TestDomain.kt | 34 ++++++++- 3 files changed, 144 insertions(+), 4 deletions(-) diff --git a/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt b/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt index fee6a51441..c2a76b251d 100644 --- a/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt +++ b/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt @@ -89,11 +89,13 @@ import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import coil.compose.AsyncImage import coil.request.ImageRequest +import com.capstone.android.application.app.composable.CustomOnlyTitleCheckDialog import com.capstone.android.application.app.composable.CustomTitleCheckDialog import com.capstone.android.application.app.composable.FancyProgressBar import com.capstone.android.application.app.screen.MainScreen import com.capstone.android.application.app.screen.BottomNavItem import com.capstone.android.application.data.local.Emotion +import com.capstone.android.application.domain.CustomOnlyTitleCheckViewModel import com.capstone.android.application.domain.CustomTitleCheckViewModel import com.capstone.android.application.ui.CardActivity import com.capstone.android.application.ui.PostTripActivity @@ -1651,6 +1653,12 @@ class MainActivity : ComponentActivity() { val InquirybtnState = remember { mutableStateOf(false) } val versionbtnState = remember { mutableStateOf(false) } + val viewModel_OnlyTitle: CustomOnlyTitleCheckViewModel = viewModel() + val CustomOnlyTitleCheckDialogState = viewModel_OnlyTitle.CustomOnlyTitleCheckDialogState.value + + val viewModel_Title: CustomTitleCheckViewModel = viewModel() + val CustomTitleCheckDialogState = viewModel_Title.CustomTitleCheckDialogState.value + Box( Modifier @@ -1797,13 +1805,39 @@ class MainActivity : ComponentActivity() { Modifier .padding(top = 150.dp) ) { - Column(Modifier.clickable { }) { + Column(Modifier.clickable { + viewModel_OnlyTitle.showCustomOnlyTitleCheckDialog() + }) { P_Medium14("로그아웃", black) } + + if (CustomOnlyTitleCheckDialogState.title.isNotBlank()) { + CustomOnlyTitleCheckDialog( + title = CustomOnlyTitleCheckDialogState.title, + checkleft = CustomOnlyTitleCheckDialogState.checkleft, + checkright = CustomOnlyTitleCheckDialogState.checkright, + onClickleft = { /*로그아웃 기능*/ }, + onClickright = { CustomOnlyTitleCheckDialogState.onClickright() } + ) + } + Spacer(modifier = Modifier.height(28.dp)) - Column(Modifier.clickable { }) { + Column(Modifier.clickable { viewModel_Title.showCustomTitleCheckDialog() }) { P_Medium14("탈퇴하기", black) } + + if (CustomTitleCheckDialogState.title.isNotBlank()) { + CustomTitleCheckDialog( + title = "정말 탈퇴하시나요 .. ?", + description = "새로운 계정으로 만나는 건 가능하지만\n" + + "지금까지의 우리 추억은 모두 사라져요", + checkleft = "네", + checkright = "아니요", + onClickleft = { /*탈퇴 기능*/ }, + onClickright = { CustomTitleCheckDialogState.onClickright() }, + onClickCancel = { CustomTitleCheckDialogState.onClickCancel()} + ) + } } } } diff --git a/Android/moment-android/app/src/main/java/com/capstone/android/application/app/composable/Composable.kt b/Android/moment-android/app/src/main/java/com/capstone/android/application/app/composable/Composable.kt index 82f36cae5c..fac9a91831 100644 --- a/Android/moment-android/app/src/main/java/com/capstone/android/application/app/composable/Composable.kt +++ b/Android/moment-android/app/src/main/java/com/capstone/android/application/app/composable/Composable.kt @@ -82,6 +82,7 @@ import com.capstone.android.application.ui.theme.black import com.capstone.android.application.ui.theme.neutral_100 import com.capstone.android.application.ui.theme.neutral_500 import com.capstone.android.application.ui.theme.neutral_600 +import com.capstone.android.application.ui.theme.primary_500 import com.capstone.android.application.ui.theme.tertiary_500 import kotlin.math.roundToInt @@ -491,6 +492,81 @@ fun CustomTitleCheckDialog( } } + +// 제목 다이얼로그 +@Composable +fun CustomOnlyTitleCheckDialog( + title : String, + checkleft: String, + checkright: String, + onClickleft: () -> Unit, + onClickright: () -> Unit +){ + Dialog(onDismissRequest = { }, + properties = DialogProperties( + dismissOnBackPress = true, + dismissOnClickOutside = true + ) + ) { + Card(modifier = Modifier + .fillMaxSize() + .wrapContentHeight() + .padding(horizontal = 40.dp)){ + Column(modifier = Modifier + .padding(8.dp) + .fillMaxWidth() + .background(tertiary_500)) { + + Column( + Modifier + .wrapContentSize() + .padding(top = 20.dp, bottom = 16.dp) + .align(Alignment.CenterHorizontally), + horizontalAlignment = Alignment.CenterHorizontally) { + Row { + P_ExtraBold16(content = "정말 ", color = black) + P_ExtraBold16(content = "로그아웃", color = primary_500) + P_ExtraBold16(content = " 하시나요?", color = black) + } + + } + + Row( + Modifier + .padding(8.dp) + .fillMaxWidth() + .wrapContentHeight(), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically){ + Column( + Modifier + .padding(8.dp) + .weight(0.2f) + .clickable { onClickleft() }, + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center) { + YJ_Bold15(content = checkleft, color = black) + } + Divider( + Modifier + .width(2.dp) + .height(20.dp), neutral_500) + + Column( + Modifier + .padding(8.dp) + .weight(0.2f) + .clickable { onClickright() }, + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center) { + YJ_Bold15(content = checkright, color = black) + } + } + } + } + } +} + @Preview(apiLevel = 33) @Composable fun ReciptPreview() { diff --git a/Android/moment-android/app/src/main/java/com/capstone/android/application/domain/TestDomain.kt b/Android/moment-android/app/src/main/java/com/capstone/android/application/domain/TestDomain.kt index 23aab145ea..90a0a206ae 100644 --- a/Android/moment-android/app/src/main/java/com/capstone/android/application/domain/TestDomain.kt +++ b/Android/moment-android/app/src/main/java/com/capstone/android/application/domain/TestDomain.kt @@ -29,6 +29,14 @@ data class CustomTitleCheckDialogState( val onClickCancel: () -> Unit = {}, ) +data class CustomOnlyTitleCheckDialogState( + val title: String = "", + val checkleft: String = "", + val checkright: String = "", + val onClickleft: () -> Unit = {}, + val onClickright: () -> Unit = {} +) + //제목없는 선택형 다이얼로그 @HiltViewModel @@ -54,7 +62,7 @@ class CustomNoTitleCheckViewModel @Inject constructor() : ViewModel(){ } } -//제목 선택형 다이얼로그 +//제목 소제목 선택형 다이얼로그 @HiltViewModel class CustomTitleCheckViewModel @Inject constructor() : ViewModel(){ val CustomTitleCheckDialogState : MutableState = @@ -76,4 +84,26 @@ class CustomTitleCheckViewModel @Inject constructor() : ViewModel(){ fun resetDialogState() { CustomTitleCheckDialogState.value = CustomTitleCheckDialogState() } -} \ No newline at end of file +} + +//제목만 선택형 다이얼로그 +@HiltViewModel +class CustomOnlyTitleCheckViewModel @Inject constructor() : ViewModel(){ + val CustomOnlyTitleCheckDialogState : MutableState = + mutableStateOf( + CustomOnlyTitleCheckDialogState() + ) + fun showCustomOnlyTitleCheckDialog(){ + CustomOnlyTitleCheckDialogState.value = CustomOnlyTitleCheckDialogState( + title = "정말 로그아웃 하시나요?", + checkleft = "네", + checkright = "아니요", + onClickleft = { }, + onClickright = { resetDialogState() }, + ) + } + + fun resetDialogState() { + CustomOnlyTitleCheckDialogState.value = CustomOnlyTitleCheckDialogState() + } +} From 157218aa3ff78991e73be09ce4a0b16d24c81bab Mon Sep 17 00:00:00 2001 From: penguinseohyun Date: Thu, 2 May 2024 17:20:05 +0900 Subject: [PATCH 3/3] chore --- .../android/application/MainActivity.kt | 266 ++++++++++-------- .../android/application/ui/ReciptActivity.kt | 7 +- 2 files changed, 152 insertions(+), 121 deletions(-) diff --git a/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt b/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt index c2a76b251d..02021f5dbf 100644 --- a/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt +++ b/Android/moment-android/app/src/main/java/com/capstone/android/application/MainActivity.kt @@ -98,6 +98,7 @@ import com.capstone.android.application.data.local.Emotion import com.capstone.android.application.domain.CustomOnlyTitleCheckViewModel import com.capstone.android.application.domain.CustomTitleCheckViewModel import com.capstone.android.application.ui.CardActivity +import com.capstone.android.application.ui.OnboardingScreen import com.capstone.android.application.ui.PostTripActivity import com.capstone.android.application.ui.ReciptActivity import com.capstone.android.application.ui.ReciptScreen @@ -461,9 +462,10 @@ class MainActivity : ComponentActivity() { Center, End, } + @OptIn(ExperimentalPagerApi::class, ExperimentalFoundationApi::class) @Composable - fun Home(){ + fun Home() { val density = LocalDensity.current val defaultActionSize = 80.dp @@ -541,7 +543,7 @@ class MainActivity : ComponentActivity() { } } - }else{ + } else { Text( modifier = Modifier.clickable { navController.navigate(MainScreen.RecordDaily.screenRoute) }, text = "일상기록", @@ -552,7 +554,7 @@ class MainActivity : ComponentActivity() { } LazyRow { - items(2){index-> + items(2) { index -> Box( modifier = Modifier @@ -587,15 +589,15 @@ class MainActivity : ComponentActivity() { LazyColumn( modifier = Modifier .padding(start = 16.dp, end = 4.dp) - ){ + ) { items( count = 8, itemContent = { - if(it==1){ + if (it == 1) { ItemTrip(type = 1) - }else if(it==2){ + } else if (it == 2) { ItemTrip(type = 2) - }else{ + } else { ItemTrip(type = 0) } @@ -608,7 +610,7 @@ class MainActivity : ComponentActivity() { } @Composable - fun RecordDaily(){ + fun RecordDaily() { Column( modifier = Modifier .fillMaxSize() @@ -641,14 +643,19 @@ class MainActivity : ComponentActivity() { LazyColumn( modifier = Modifier .padding(start = 16.dp, end = 4.dp) - ){ + ) { items( count = 8, itemContent = { Column( modifier = Modifier.clickable { - startActivity(Intent(this@MainActivity,TripFileActivity::class.java)) - } , + startActivity( + Intent( + this@MainActivity, + TripFileActivity::class.java + ) + ) + }, ) { Box( modifier = Modifier.clip(RectangleShape), @@ -661,7 +668,7 @@ class MainActivity : ComponentActivity() { .fillMaxSize() .background(color = Color.White), verticalAlignment = Alignment.CenterVertically - ){ + ) { Text( text = "2024.03.05", @@ -673,8 +680,7 @@ class MainActivity : ComponentActivity() { Divider( modifier = Modifier .height(50.dp) - .width(1.dp) - , + .width(1.dp), color = Color("#99342E".toColorInt()), thickness = 2.dp ) @@ -695,8 +701,7 @@ class MainActivity : ComponentActivity() { modifier = Modifier .fillMaxWidth() .height(1.dp) - .padding(end = 8.dp) - , + .padding(end = 8.dp), color = Color("#C3C1C1".toColorInt()), thickness = 2.dp ) @@ -711,7 +716,7 @@ class MainActivity : ComponentActivity() { @OptIn(ExperimentalFoundationApi::class) @Composable - fun ItemTrip(type:Int){ + fun ItemTrip(type: Int) { val density = LocalDensity.current val defaultActionSize = 80.dp val endActionSizePx = with(density) { (defaultActionSize * 2).toPx() } @@ -740,8 +745,8 @@ class MainActivity : ComponentActivity() { Column( modifier = Modifier.clickable { - startActivity(Intent(this@MainActivity,TripFileActivity::class.java)) - } , + startActivity(Intent(this@MainActivity, TripFileActivity::class.java)) + }, ) { Box( modifier = Modifier.clip(RectangleShape), @@ -767,7 +772,7 @@ class MainActivity : ComponentActivity() { reverseDirection = true ), verticalAlignment = Alignment.CenterVertically - ){ + ) { Column { Text( @@ -785,8 +790,7 @@ class MainActivity : ComponentActivity() { Divider( modifier = Modifier .height(50.dp) - .width(1.dp) - , + .width(1.dp), color = Color("#99342E".toColorInt()), thickness = 2.dp ) @@ -817,7 +821,7 @@ class MainActivity : ComponentActivity() { .requireOffset() + endActionSizePx) .roundToInt(), 0 ) - } , + }, horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically ) { @@ -863,17 +867,18 @@ class MainActivity : ComponentActivity() { reverseDirection = true ) ) { - if(type==1){ + if (type == 1) { Box( contentAlignment = Alignment.TopCenter - ){ + ) { Spacer(modifier = Modifier.width(18.dp)) Image( modifier = Modifier .width(76.dp) .height(32.dp), - painter = painterResource(id = R.drawable.img_alarm_red), contentDescription = "" + painter = painterResource(id = R.drawable.img_alarm_red), + contentDescription = "" ) Text( text = "현재 여행중이에요", @@ -884,15 +889,16 @@ class MainActivity : ComponentActivity() { } Spacer(modifier = Modifier.weight(1f)) - if(type==2){ + if (type == 2) { Box( contentAlignment = Alignment.TopCenter - ){ + ) { Image( modifier = Modifier .width(76.dp) .height(32.dp), - painter = painterResource(id = R.drawable.img_alarm_green), contentDescription = "" + painter = painterResource(id = R.drawable.img_alarm_green), + contentDescription = "" ) Text( text = "카드 분석중이에요", @@ -904,11 +910,9 @@ class MainActivity : ComponentActivity() { } - } - } Spacer(modifier = Modifier.height(24.dp)) @@ -916,8 +920,7 @@ class MainActivity : ComponentActivity() { modifier = Modifier .fillMaxWidth() .height(1.dp) - .padding(end = 8.dp) - , + .padding(end = 8.dp), color = Color("#C3C1C1".toColorInt()), thickness = 2.dp ) @@ -926,7 +929,7 @@ class MainActivity : ComponentActivity() { } @Composable - fun HomeTrip(){ + fun HomeTrip() { Column( modifier = Modifier.fillMaxSize() ) { @@ -942,8 +945,8 @@ class MainActivity : ComponentActivity() { ) } .padding(horizontal = 4.dp) - ){ - items(3){ + ) { + items(3) { Column { Spacer(modifier = Modifier.height(8.dp)) Box( @@ -959,54 +962,65 @@ class MainActivity : ComponentActivity() { } @Composable - fun Receipt(){ + fun Receipt() { Column( modifier = Modifier .fillMaxSize() .padding(20.dp) - ) { + ) { Image( modifier = Modifier.fillMaxWidth(), painter = painterResource(id = R.drawable.test_image), contentDescription = "test" ) Spacer(modifier = Modifier.height(8.dp)) BigButton("만들기", true, - onClick = {startActivity(Intent(this@MainActivity, ReciptActivity::class.java))}) + onClick = { startActivity(Intent(this@MainActivity, ReciptActivity::class.java)) }) } } @Composable - fun ReceiptPost(EditCheckState: MutableState, ReceiptCheckState: MutableState) { + fun ReceiptPost( + EditCheckState: MutableState, + ReceiptCheckState: MutableState + ) { //영수증 게시 - val testList = mutableListOf(1,2,3,4,5,6,7,8,9,10,11) + val testList = mutableListOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) Column( Modifier .fillMaxWidth() - .padding(horizontal = 12.dp)) { + .padding(horizontal = 12.dp) + ) { - MyGrid(testList, 2, EditCheckState,ReceiptCheckState) + MyGrid(testList, 2, EditCheckState, ReceiptCheckState) } } + @Composable fun MyGrid( content: List, columnSize: Int, EditCheckState: MutableState, ReceiptCheckState: MutableState - ){ - val rowsCount = 1 + (content.size -1)/columnSize // row 개수 + ) { + val rowsCount = 1 + (content.size - 1) / columnSize // row 개수 BoxWithConstraints { val maxWidth = this.maxWidth LazyColumn { items(rowsCount) { rowIndex -> - val rangeStart = rowIndex*columnSize - var rangeEnd = rangeStart + columnSize -1 - if (rangeEnd > content.lastIndex) rangeEnd = content.lastIndex // row로 표현될 list의 range를 계산, slice하여 row 생성 - RowOfGrid(content.slice(rangeStart..rangeEnd), maxWidth/columnSize, EditCheckState, ReceiptCheckState) + val rangeStart = rowIndex * columnSize + var rangeEnd = rangeStart + columnSize - 1 + if (rangeEnd > content.lastIndex) rangeEnd = + content.lastIndex // row로 표현될 list의 range를 계산, slice하여 row 생성 + RowOfGrid( + content.slice(rangeStart..rangeEnd), + maxWidth / columnSize, + EditCheckState, + ReceiptCheckState + ) } } @@ -1021,7 +1035,7 @@ class MainActivity : ComponentActivity() { EditCheckState: MutableState, ReceiptCheckState: MutableState ) { - val interactionSource = remember { MutableInteractionSource() } + var intent = Intent(this@MainActivity, ReciptActivity::class.java) intent.putExtra("MoveScreen", "ReceiptPost_Big") @@ -1033,7 +1047,7 @@ class MainActivity : ComponentActivity() { Log.d("hihihi", "RowOfGrid: $item") val checkState = rememberSaveable { mutableStateOf(false) } - Box( modifier = Modifier + Box(modifier = Modifier .width(columnWidth) .height(224.dp) .padding(horizontal = 25.dp, vertical = 8.dp) @@ -1047,11 +1061,12 @@ class MainActivity : ComponentActivity() { //MiniTheme1() MiniTheme2() - if (EditCheckState.value){ + if (EditCheckState.value) { Column( Modifier .padding(10.dp) - .align(Alignment.BottomEnd)) { + .align(Alignment.BottomEnd) + ) { Column( Modifier .size(32.dp) @@ -1067,14 +1082,17 @@ class MainActivity : ComponentActivity() { } } - if(checkState.value){ + if (checkState.value) { Column( Modifier .padding(10.dp) - .align(Alignment.BottomEnd)) { - Column(Modifier.size(32.dp), + .align(Alignment.BottomEnd) + ) { + Column( + Modifier.size(32.dp), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center) { + verticalArrangement = Arrangement.Center + ) { Image( painter = painterResource(R.drawable.ic_receipt_check_red), contentDescription = "장소", @@ -1091,15 +1109,16 @@ class MainActivity : ComponentActivity() { @Composable - fun Record(){ + fun Record() { } @OptIn(ExperimentalMaterial3Api::class) @Composable - fun RecordNavigatesheet(recordOpen : MutableState, sheetState: SheetState, closeSheet: () -> Unit - ){ + fun RecordNavigatesheet( + recordOpen: MutableState, sheetState: SheetState, closeSheet: () -> Unit + ) { val coroutineScope = rememberCoroutineScope() @@ -1109,27 +1128,33 @@ class MainActivity : ComponentActivity() { shape = RoundedCornerShape(topStart = 3.dp, topEnd = 3.dp), containerColor = tertiary_500, dragHandle = null - ){ + ) { Box( modifier = Modifier .fillMaxWidth() .background(tertiary_500) .height(248.dp), ) { - Column(modifier = Modifier - .padding(top = 17.dp) - .align(Alignment.TopCenter)) { + Column( + modifier = Modifier + .padding(top = 17.dp) + .align(Alignment.TopCenter) + ) { Box( modifier = Modifier.width(213.dp), contentAlignment = Alignment.Center - ){ - Image(modifier = Modifier - .height(42.dp) - .width(213.dp), - painter = painterResource(R.drawable.img_alarm_center_grey), - contentDescription = "record") - P_Medium11(content = "녹음은 한번에 최대 10분까지 가능해요\n" + - "최대 시간을 넘어가면 자동 종료 후 저장됩니다", color = white ) + ) { + Image( + modifier = Modifier + .height(42.dp) + .width(213.dp), + painter = painterResource(R.drawable.img_alarm_center_grey), + contentDescription = "record" + ) + P_Medium11( + content = "녹음은 한번에 최대 10분까지 가능해요\n" + + "최대 시간을 넘어가면 자동 종료 후 저장됩니다", color = white + ) } } @@ -1164,10 +1189,12 @@ class MainActivity : ComponentActivity() { }) { YJ_Bold15("삭제", black) } - Spacer(modifier = Modifier.width(46.dp)) - Image(modifier = Modifier.size(50.dp), - painter = painterResource(R.drawable.ic_record_ing), - contentDescription = "record") + Spacer(modifier = Modifier.width(46.dp)) + Image( + modifier = Modifier.size(50.dp), + painter = painterResource(R.drawable.ic_record_ing), + contentDescription = "record" + ) Spacer(modifier = Modifier.width(46.dp)) Column(Modifier.clickable { @@ -1193,7 +1220,7 @@ class MainActivity : ComponentActivity() { @SuppressLint("UnrememberedMutableState") @Composable - fun Favorite(){ + fun Favorite() { var expanded = remember { mutableStateOf(true) } val imageList = mutableStateListOf() @@ -1312,9 +1339,8 @@ class MainActivity : ComponentActivity() { .clickable { cardItems[index].isFavorite.value = !cardItems[index].isFavorite.value - } - , - painter = painterResource(id = if(cardItems[index].isFavorite.value) R.drawable.ic_heart_red else R.drawable.ic_heart_white), + }, + painter = painterResource(id = if (cardItems[index].isFavorite.value) R.drawable.ic_heart_red else R.drawable.ic_heart_white), contentDescription = "" ) Spacer(modifier = Modifier.width(16.dp)) @@ -1843,6 +1869,8 @@ class MainActivity : ComponentActivity() { } } + + @Composable fun Toggle() { @@ -1850,46 +1878,49 @@ class MainActivity : ComponentActivity() { "켜기", "끄기" ) - var selectedOption by remember { mutableStateOf(states[0])} + var selectedOption by remember { mutableStateOf(states[0]) } val onSelectionChange = { text: String -> selectedOption = text } - Row(modifier = Modifier - .width(120.dp) - .height(40.dp) - .clip(shape = RoundedCornerShape(3.dp)) - .background(secondary_50) - ) { - states.forEach { text -> - Column( modifier = Modifier - .width(60.dp) - .height(40.dp) - .clip(shape = RoundedCornerShape(3.dp)) - .clickable { - onSelectionChange(text) - } - .background( - if (text == selectedOption) { - primary_500 - } else { - secondary_50 - } - ), - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center - ) { - P_Medium14(content = text, - color = if (text == selectedOption) white else neutral_500 ) + Row( + modifier = Modifier + .width(120.dp) + .height(40.dp) + .clip(shape = RoundedCornerShape(3.dp)) + .background(secondary_50) + ) { + states.forEach { text -> + Column(modifier = Modifier + .width(60.dp) + .height(40.dp) + .clip(shape = RoundedCornerShape(3.dp)) + .clickable { + onSelectionChange(text) } - + .background( + if (text == selectedOption) { + primary_500 + } else { + secondary_50 + } + ), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center + ) { + P_Medium14( + content = text, + color = if (text == selectedOption) white else neutral_500 + ) } + } + } } @SuppressLint("UnrememberedMutableState") @Composable - fun MiniTheme1(){ + fun MiniTheme1() { val emotionList = mutableStateListOf() emotionList.add( @@ -1949,7 +1980,7 @@ class MainActivity : ComponentActivity() { horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - P_Medium("암스테르담 성당 여행", white , 5.sp) + P_Medium("암스테르담 성당 여행", white, 5.sp) Image( modifier = Modifier @@ -1966,7 +1997,7 @@ class MainActivity : ComponentActivity() { modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally ) { - P_Medium("여행의 기록을 한 줄로 기록하세요:)",neutral_500, 5.sp) + P_Medium("여행의 기록을 한 줄로 기록하세요:)", neutral_500, 5.sp) } } @@ -1984,7 +2015,7 @@ class MainActivity : ComponentActivity() { Modifier.size(5.dp) ) Spacer(modifier = Modifier.width(4.dp)) - P_Medium("북촌한옥마을",primary_500, 4.5.sp) + P_Medium("북촌한옥마을", primary_500, 4.5.sp) } Column( @@ -2024,7 +2055,7 @@ class MainActivity : ComponentActivity() { Modifier.size(5.dp) ) Spacer(modifier = Modifier.width(4.dp)) - P_Medium("암스테르담 공항",primary_500, 4.5.sp) + P_Medium("암스테르담 공항", primary_500, 4.5.sp) } Column( @@ -2090,7 +2121,7 @@ class MainActivity : ComponentActivity() { ) { Column( modifier = Modifier.width(40.dp) - ) { + ) { LinearProgressIndicator( progress = { item.persent.toFloat() / 100 }, modifier = Modifier.height(3.dp), @@ -2137,7 +2168,7 @@ class MainActivity : ComponentActivity() { @SuppressLint("UnrememberedMutableState") @Composable - fun MiniTheme2(){ + fun MiniTheme2() { val emotionList = mutableStateListOf() @@ -2288,7 +2319,9 @@ class MainActivity : ComponentActivity() { Spacer(modifier = Modifier.height(4.dp)) Row( - Modifier.fillMaxWidth().padding(horizontal = 20.dp), + Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp), horizontalArrangement = Arrangement.Center ) { Column( @@ -2460,7 +2493,6 @@ class MainActivity : ComponentActivity() { } } - @SuppressLint("UnrememberedMutableState") @Preview(apiLevel = 33) @Composable fun MainPreview() { diff --git a/Android/moment-android/app/src/main/java/com/capstone/android/application/ui/ReciptActivity.kt b/Android/moment-android/app/src/main/java/com/capstone/android/application/ui/ReciptActivity.kt index 08bc8a8edf..92ba913b3d 100644 --- a/Android/moment-android/app/src/main/java/com/capstone/android/application/ui/ReciptActivity.kt +++ b/Android/moment-android/app/src/main/java/com/capstone/android/application/ui/ReciptActivity.kt @@ -3,7 +3,6 @@ package com.capstone.android.application.ui import android.annotation.SuppressLint import android.content.Intent import android.os.Bundle -import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.BorderStroke @@ -42,7 +41,6 @@ import androidx.compose.runtime.snapshots.SnapshotStateList import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.res.painterResource @@ -51,7 +49,6 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.core.graphics.toColorInt import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost @@ -985,6 +982,7 @@ class ReciptActivity : ComponentActivity() { } } + @SuppressLint("UnrememberedMutableState") @Composable fun SaveRecipt(theme: Int){ @@ -1529,6 +1527,8 @@ class ReciptActivity : ComponentActivity() { } } + + @SuppressLint("UnrememberedMutableState") @Composable fun ReceiptPost_Big(){ //모아보기에서 영수증 하나 선택해서 크게 보는 화면 (수정, 내보내기 가능) @@ -1844,7 +1844,6 @@ class ReciptActivity : ComponentActivity() { @Composable fun ReciptPreview() { ApplicationTheme { - SaveRecipt("theme1") } }}