Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ internal data class HilitLoadingIndicatorGeometry(

internal fun hilitLoadingIndicatorGeometry(size: Dp): HilitLoadingIndicatorGeometry {
require(size > 0.dp) { "HilitLoadingIndicator size must be positive." }
// 원형 스피너라 너비·높이는 항상 같아야 한다 (LOADING_INDICATOR_SIZE_RATIO 주석 참고).
val graphicSize = size * LOADING_INDICATOR_SIZE_RATIO
return HilitLoadingIndicatorGeometry(
containerSize = size,
graphicWidth = size * LOADING_INDICATOR_WIDTH_RATIO,
graphicHeight = size * LOADING_INDICATOR_HEIGHT_RATIO,
graphicWidth = graphicSize,
graphicHeight = graphicSize,
)
}

Expand All @@ -111,8 +113,11 @@ internal val LOADING_INDICATOR_EASING =
sin(radians)
}

private const val LOADING_INDICATOR_WIDTH_RATIO = 72f / 74f
private const val LOADING_INDICATOR_HEIGHT_RATIO = 73f / 74f
// 원본 벡터 리소스(loading_indicator.xml)의 선언 크기는 72x73dp 로 Figma export 과정에서
// 생긴 1dp 오차가 있다(Figma 439:10407 프레임 자체는 74x74 정사각형). 회전하는 원형 스피너가
// 세로로 살짝 긴 타원으로 그려져 회전할 때마다 중심이 미묘하게 어긋나 보이던 원인(#176)이라,
// 더 작은 쪽 비율(72/74)을 너비·높이 모두에 써서 강제로 정사각형(원)이 되게 한다.
private const val LOADING_INDICATOR_SIZE_RATIO = 72f / 74f
private const val LOADING_INDICATOR_SPEED_VARIATION = 0.65f
private const val LOADING_INDICATOR_FULL_CYCLE_RADIANS = (2.0 * PI).toFloat()
private val DEFAULT_LOADING_INDICATOR_SIZE = 74.dp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import kotlin.test.assertTrue

class HilitLoadingIndicatorTest {
@Test
fun `기본 크기는 74dp 컨테이너 안에 72dp 곱하기 73dp 그래픽을 배치한다`() {
fun `기본 크기는 74dp 컨테이너 안에 72dp 정사각형 그래픽을 배치한다`() {
val geometry = hilitLoadingIndicatorGeometry(size = 74.dp)

assertEquals(74.dp, geometry.containerSize)
assertEquals(72.dp, geometry.graphicWidth)
assertEquals(73.dp, geometry.graphicHeight)
assertEquals(72.dp, geometry.graphicHeight)
}

@Test
fun `사용자 크기에서도 원본 그래픽 비율을 유지한다`() {
fun `사용자 크기에서도 그래픽은 항상 정사각형을 유지한다`() {
val geometry = hilitLoadingIndicatorGeometry(size = 148.dp)

assertEquals(148.dp, geometry.containerSize)
assertEquals(144.dp, geometry.graphicWidth)
assertEquals(146.dp, geometry.graphicHeight)
assertEquals(144.dp, geometry.graphicHeight)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ internal fun InterviewReportContent(
// 폴링 중 화면을 벗어날 수 있도록 닫기 버튼은 계속 노출한다.
Column(modifier = Modifier.fillMaxSize()) {
ReportTopBar(onClose = { onIntent(InterviewReportIntent.ClickClose) })
// weight(1f)만 주면 Column 안에서 폭은 콘텐츠(스피너)에 맞춰 줄어들고,
// Column 기본 정렬(Alignment.Start)에 따라 그 좁은 Box 자체가 왼쪽에
// 붙어버려 스피너가 화면 중앙이 아니라 왼쪽으로 치우쳐 보였다(#176).
// fillMaxWidth() 를 더해 Box 폭을 화면 전체로 넓혀야 안의 Alignment.Center
// 가 실제로 화면 가로 중앙을 기준으로 동작한다.
CenteredMessage(
modifier = Modifier.weight(1f),
modifier = Modifier.weight(1f).fillMaxWidth(),
content = { HilitLoadingIndicator() },
)
}
Expand All @@ -69,8 +74,9 @@ internal fun InterviewReportContent(
// 이전에는 안내 문구만 있고 액션이 없어 막다른 화면이었다.
Column(modifier = Modifier.fillMaxSize()) {
ReportTopBar(onClose = { onIntent(InterviewReportIntent.ClickClose) })
// Loading phase 와 같은 이유로 fillMaxWidth() 가 필요하다(#176).
CenteredMessage(
modifier = Modifier.weight(1f),
modifier = Modifier.weight(1f).fillMaxWidth(),
content = {
Text(
text = "리포트를 불러오지 못했어요. 다시 시도해 주세요.",
Expand Down