-
Notifications
You must be signed in to change notification settings - Fork 1
갤러리 사진 선택 & 재촬영 기능 구현 #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9a44a04
✨ Feat: 갤러리 사진 선택 기능 추가
chanho0908 634cf7a
✨ Feat: ObserveAsEvents 컴포저블 함수 추가
chanho0908 c98e7bb
✨ Feat: 사진 촬영, 업로드 실패시 에러 메시지 출력 기능 추가
chanho0908 3993ff4
✨ Feat: 공용 Round Button 컴포저블 추가
chanho0908 60c6028
✨ Feat: 사진 다시찍기, 갤러리 버튼 이미지 추가
chanho0908 41f034d
✨ Feat: 사진 다시찍기 기능 추가
chanho0908 822a200
♻️ Refactor: 사진 촬영 실패시 에러처리 추가
chanho0908 59f7be2
✨ Feat: 리플 효과 제거 함수에 enable 파라미터 추가
chanho0908 afadfd8
✨ Feat: 사진 촬영시 촬영,갤러리, 렌즈 토글 버튼 비활성화 기능 추가
chanho0908 131e0dc
♻️ Refactor: 갤러리에서 선택된 이미지가 null일시 에러처리 제거
chanho0908 bff39f5
♻️ Refactor: 하위 컴포저블에서 사용중인 부모 컴포저블의 modifier 수정
chanho0908 45ae310
♻️ Refactor: 공용 round 버튼 패키지 수정
chanho0908 213270a
♻️ Refactor: 재촬영 이미지 수정
chanho0908 7a33d2e
♻️ Refactor: 업로드 버튼 중앙 정렬이 맞지 않는 문제 수정
chanho0908 f27a62d
✨ Merge branch 'feat/#38-task-certification' into feat/tast-certifica…
chanho0908 2fab411
♻️ Refactor: ObserveAsEvents의 인자명 수정, withContext 제거
chanho0908 12297dd
♻️ Refactor: AppRoundButton 리뷰 반영
chanho0908 87440bc
♻️ Refactor: 하드코딩된 업로드 리소스 분리
chanho0908 a242104
♻️ Refactor: 촬영 버튼 비활성화 시점을 콜백보다 먼저 하도록 수정
chanho0908 ca84073
♻️ Refactor: 촬영 버튼 활성화 플래그 변수 remember로 수정
chanho0908 8f12e12
♻️ Refactor: stringResource를 사용하도록 수정
chanho0908 f809031
♻️ Refactor: import 누락 수정
chanho0908 3091682
✨Merge branch 'develop' into feat/tast-certification-gallery-pick
chanho0908 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
core/design-system/src/main/java/com/twix/designsystem/components/button/AppRoundButton.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| package com.twix.designsystem.components.button | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Spacer | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.offset | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.twix.designsystem.components.text.AppText | ||
| import com.twix.designsystem.theme.CommonColor | ||
| import com.twix.designsystem.theme.GrayColor | ||
| import com.twix.designsystem.theme.TwixTheme | ||
| import com.twix.domain.model.enums.AppTextStyle | ||
|
|
||
| @Composable | ||
| fun AppRoundButton( | ||
| text: String, | ||
| textColor: Color, | ||
| modifier: Modifier = Modifier, | ||
| textStyle: AppTextStyle = AppTextStyle.T2, | ||
| backgroundColor: Color, | ||
| borderColor: Color = GrayColor.C500, | ||
| hasBorder: Boolean = true, | ||
| ) { | ||
| Box( | ||
| modifier = modifier, | ||
| ) { | ||
| if (hasBorder) { | ||
| Box( | ||
| modifier = | ||
| Modifier | ||
| .fillMaxSize() | ||
| .offset(y = 4.dp) | ||
| .background( | ||
| color = borderColor, | ||
| shape = RoundedCornerShape(100), | ||
| ), | ||
| ) | ||
| } | ||
|
|
||
| Box( | ||
| modifier = | ||
| Modifier | ||
| .fillMaxSize() | ||
| .background( | ||
| color = backgroundColor, | ||
| shape = RoundedCornerShape(100), | ||
| ).then( | ||
| if (hasBorder) { | ||
| Modifier.border( | ||
| width = 1.6.dp, | ||
| color = borderColor, | ||
| shape = RoundedCornerShape(100), | ||
| ) | ||
| } else { | ||
| Modifier | ||
| }, | ||
| ), | ||
| contentAlignment = Alignment.Center, | ||
| ) { | ||
| AppText( | ||
| style = textStyle, | ||
| color = textColor, | ||
| text = text, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
chanho0908 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| fun AppRoundButtonPreview() { | ||
| TwixTheme { | ||
| Column { | ||
| AppRoundButton( | ||
| modifier = | ||
| Modifier | ||
| .width(330.dp) | ||
| .height(68.dp), | ||
| text = "버튼임니다", | ||
| textColor = GrayColor.C500, | ||
| backgroundColor = CommonColor.White, | ||
| ) | ||
| Spacer(modifier = Modifier.height(10.dp)) | ||
| AppRoundButton( | ||
| modifier = | ||
| Modifier | ||
| .width(330.dp) | ||
| .height(68.dp), | ||
| text = "버튼임니다", | ||
| textColor = CommonColor.White, | ||
| backgroundColor = GrayColor.C500, | ||
| hasBorder = false, | ||
| ) | ||
| Spacer(modifier = Modifier.height(10.dp)) | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.twix.ui.base | ||
|
|
||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.LaunchedEffect | ||
| import androidx.lifecycle.Lifecycle | ||
| import androidx.lifecycle.compose.LocalLifecycleOwner | ||
| import androidx.lifecycle.repeatOnLifecycle | ||
| import kotlinx.coroutines.flow.Flow | ||
|
|
||
| /** | ||
| * [Flow]를 통해 전달되는 일회성 이벤트(Side Effect)를 Lifecycle에 안전하게 관찰하기 위한 Composable 함수입니다. | ||
| * * 주로 ViewModel의 Channel이나 SharedFlow를 통해 전달되는 네비게이션, 스낵바 표시 등의 | ||
| * UI 이벤트를 처리할 때 사용됩니다. | ||
| * | ||
| * @param T 이벤트의 타입. | ||
| * @param flow 관찰할 [Flow] 인스턴스 (예: ViewModel의 events). | ||
| * @param onEvent 이벤트가 발생했을 때 실행할 suspend 콜백 함수. | ||
| * | ||
| */ | ||
| @Composable | ||
| fun <T> ObserveAsEvents( | ||
| event: Flow<T>, | ||
| onEvent: suspend (T) -> Unit, | ||
| ) { | ||
| val lifecycleOwner = LocalLifecycleOwner.current | ||
| LaunchedEffect(event, lifecycleOwner) { | ||
| // lifecycleOwner가 STARTED 상태일 때만 수집을 시작 | ||
| // STOPPED 상태가 되면 수집 코루틴을 자동으로 취소 | ||
| lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { | ||
| event.collect(onEvent) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금도 좋긴 한데 내용물이 항상 Text 기반이니까 content를 받지 말고 text, textColor를 추가하는 것도 괜찮을 거 같아요. 그리고 지금 border가 없는 버튼의 경우는 이 컴포저블로 표현이 안되는 거 같아요 borderColor랑 backgroundColor를 같은 색으로 맞춰서 표현한다고 해도 버튼 높이가 다르고 내부 정렬이 안 맞아서 이 부분도 재사용 가능하게 수정 부탁드려요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
border를 선택해서 전달하도록 수정해봤어 !
리뷰 반영 커밋 : 12297dd