-
Notifications
You must be signed in to change notification settings - Fork 1
대본 교정 화면 구현 #143
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
Open
moondev03
wants to merge
9
commits into
develop
Choose a base branch
from
feat/#122-대본-교정-화면-구현
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "feat/#122-\uB300\uBCF8-\uAD50\uC815-\uD654\uBA74-\uAD6C\uD604"
Open
대본 교정 화면 구현 #143
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9bf1268
refactor: 발표 상세 정보의 연습 기록 선택적 처리 및 UseCase 로직 개선
moondev03 6dc995e
refactor: Report 기능 모듈 패키지 구조 개선 및 경로 이동
moondev03 40488a3
fix: `FetchPresentationDetailUseCase` 내 잘못된 레포지토리 메서드 호출 수정
moondev03 341de97
feat: 스크롤 방향에 따라 상단 바를 숨기거나 보여주는 레이아웃 컴포넌트 추가
moondev03 83ab2f7
feat: 발표 대본 분석 및 교정 기능 추가
moondev03 81f6f12
feat: 대본 분석 상세 조회 API 연동 및 UI 에러 처리 강화
moondev03 724486c
refactor: Ktor HTTP 클라이언트 로그 내 인증 헤더 보안 처리
moondev03 e4267f4
refactor: ReportMetricCards 클릭 시 리플 효과 제거
moondev03 cb2ffb9
fix: `ScriptTextContent` 내 하이라이트 텍스트 생성 로직 안정화
moondev03 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
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
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
19 changes: 16 additions & 3 deletions
19
...e/model/src/main/java/com/team/prezel/core/model/presentation/PresentationScriptDetail.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 |
|---|---|---|
| @@ -1,16 +1,29 @@ | ||
| package com.team.prezel.core.model.presentation | ||
|
|
||
| data class PresentationScriptDetail( | ||
| val presentationId: Long, | ||
| val audioUrl: String, | ||
| val originalScript: String, | ||
| val scriptCorrections: List<ScriptCorrection>, | ||
| ) | ||
|
|
||
| data class ScriptCorrection( | ||
| val errorType: String, | ||
| val errorType: ScriptErrorType, | ||
| val sentence: String, | ||
| val originalText: String, | ||
| val correctedText: String, | ||
| val reason: String, | ||
| ) | ||
|
|
||
| enum class ScriptErrorType( | ||
| val value: String, | ||
| ) { | ||
| GRAMMAR("GRAMMAR"), | ||
| SPELLING("SPELLING"), | ||
| ; | ||
|
|
||
| companion object { | ||
| fun from(value: String): ScriptErrorType = | ||
| entries.find { entry -> | ||
| entry.value == value | ||
| } ?: throw IllegalArgumentException("지원하지 않는 에러 타입입니다.") | ||
|
moondev03 marked this conversation as resolved.
|
||
| } | ||
| } | ||
115 changes: 115 additions & 0 deletions
115
Prezel/core/ui/src/main/java/com/team/prezel/core/ui/component/HideOnScrollTopBarLayout.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,115 @@ | ||
| package com.team.prezel.core.ui.component | ||
|
|
||
| import androidx.compose.animation.AnimatedVisibility | ||
| import androidx.compose.animation.core.tween | ||
| import androidx.compose.animation.fadeIn | ||
| import androidx.compose.animation.fadeOut | ||
| import androidx.compose.foundation.ScrollState | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.verticalScroll | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.LaunchedEffect | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableIntStateOf | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.runtime.snapshotFlow | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.platform.LocalDensity | ||
| import androidx.compose.ui.unit.Dp | ||
| import androidx.compose.ui.unit.dp | ||
| import kotlinx.coroutines.flow.distinctUntilChanged | ||
| import kotlinx.coroutines.flow.map | ||
| import kotlin.math.abs | ||
|
|
||
| private const val DEFAULT_TOP_BAR_ANIMATION_DURATION_MILLIS = 200 | ||
| private val DEFAULT_TOP_BAR_SCROLL_THRESHOLD = 48.dp | ||
|
|
||
| @Composable | ||
| fun HideOnScrollTopBarLayout( | ||
| scrollState: ScrollState, | ||
| topBar: @Composable () -> Unit, | ||
| body: @Composable () -> Unit, | ||
| modifier: Modifier = Modifier, | ||
| bottomBar: @Composable () -> Unit = {}, | ||
| scrollThreshold: Dp = DEFAULT_TOP_BAR_SCROLL_THRESHOLD, | ||
| animationDurationMillis: Int = DEFAULT_TOP_BAR_ANIMATION_DURATION_MILLIS, | ||
| ) { | ||
| val scrollThresholdPx = with(LocalDensity.current) { scrollThreshold.roundToPx() } | ||
| var isTopBarVisible by remember { mutableStateOf(true) } | ||
| var previousScrollPosition by remember { mutableIntStateOf(0) } | ||
| var topBarToggleAnchorPosition by remember { mutableIntStateOf(0) } | ||
|
|
||
| LaunchedEffect(scrollState, scrollThresholdPx) { | ||
| snapshotFlow { scrollState.value } | ||
| .map { currentScrollPosition -> | ||
| calculateTopBarVisibility( | ||
| currentScrollPosition = currentScrollPosition, | ||
| previousScrollPosition = previousScrollPosition, | ||
| topBarToggleAnchorPosition = topBarToggleAnchorPosition, | ||
| scrollThresholdPx = scrollThresholdPx, | ||
| isTopBarVisible = isTopBarVisible, | ||
| onScrollPositionChanged = { previousScrollPosition = it }, | ||
| onAnchorChanged = { topBarToggleAnchorPosition = it }, | ||
| ) | ||
| }.distinctUntilChanged() | ||
| .collect { visible -> | ||
| isTopBarVisible = visible | ||
| } | ||
| } | ||
|
|
||
| Column(modifier = modifier.fillMaxSize()) { | ||
| AnimatedVisibility( | ||
| visible = isTopBarVisible, | ||
| enter = fadeIn(animationSpec = tween(animationDurationMillis)), | ||
| exit = fadeOut(animationSpec = tween(animationDurationMillis)), | ||
| ) { | ||
| topBar() | ||
| } | ||
|
|
||
| Box( | ||
| modifier = Modifier | ||
| .weight(1f) | ||
| .verticalScroll(scrollState), | ||
| ) { | ||
| body() | ||
| } | ||
|
|
||
| bottomBar() | ||
| } | ||
| } | ||
|
|
||
| private fun calculateTopBarVisibility( | ||
| currentScrollPosition: Int, | ||
| previousScrollPosition: Int, | ||
| topBarToggleAnchorPosition: Int, | ||
| scrollThresholdPx: Int, | ||
| isTopBarVisible: Boolean, | ||
| onScrollPositionChanged: (Int) -> Unit, | ||
| onAnchorChanged: (Int) -> Unit, | ||
| ): Boolean { | ||
| val isAtTop = currentScrollPosition == 0 | ||
| val isScrollingUp = currentScrollPosition < previousScrollPosition | ||
| val hasExceededThreshold = abs(currentScrollPosition - topBarToggleAnchorPosition) >= scrollThresholdPx | ||
|
|
||
| onScrollPositionChanged(currentScrollPosition) | ||
|
|
||
| return when { | ||
| isAtTop -> { | ||
| onAnchorChanged(0) | ||
| true | ||
| } | ||
| hasExceededThreshold && isScrollingUp -> { | ||
| onAnchorChanged(currentScrollPosition) | ||
| true | ||
| } | ||
| hasExceededThreshold && !isScrollingUp -> { | ||
| onAnchorChanged(currentScrollPosition) | ||
| false | ||
| } | ||
| else -> isTopBarVisible | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| plugins { | ||
| alias(libs.plugins.prezel.android.feature.impl) | ||
| alias(libs.plugins.kotlinx.serialization) | ||
| } | ||
|
|
||
| android { | ||
|
|
||
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
12 changes: 12 additions & 0 deletions
12
...rt/impl/src/main/java/com/team/prezel/feature/report/impl/navigation/ReportInnerNavKey.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,12 @@ | ||
| package com.team.prezel.feature.report.impl.navigation | ||
|
|
||
| import androidx.navigation3.runtime.NavKey | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| sealed interface ReportInnerNavKey : NavKey { | ||
| @Serializable | ||
| data class ScriptCorrection( | ||
| val analysisResultId: Long, | ||
| ) : ReportInnerNavKey | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.