Skip to content

Commit

Permalink
issue boostcampwm-2022#171 feat: content text remember 설정
Browse files Browse the repository at this point in the history
Co-authored-by: junhyeongleeee <[email protected]>
  • Loading branch information
junhyeongleeee committed Jul 25, 2023
1 parent 2dc079a commit fee1db1
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ private fun PlayScreen(
val muteState by viewModel.muteState.collectAsStateWithLifecycle()
val contentShowState by viewModel.contentShowState.collectAsStateWithLifecycle()
val dateModel = viewModel.dateModel
val contentText by viewModel.text.collectAsStateWithLifecycle()

val soundComposition by rememberLottieComposition(
LottieCompositionSpec.Asset(stringResource(R.string.lottie_sound))
Expand Down Expand Up @@ -189,7 +190,7 @@ private fun PlayScreen(
ContentText(
extendedSpans = extendedSpans,
contentShowState = contentShowState,
dateModel = dateModel
text = contentText
)

if (state != PlayState.Playing) {
Expand Down Expand Up @@ -242,7 +243,7 @@ private fun MenuImage(
private fun BoxScope.ContentText(
extendedSpans: ExtendedSpans,
contentShowState: ContentShowState,
dateModel: DateModel
text: String?
) {
AnimatedVisibility(
visible = contentShowState.state,
Expand All @@ -251,8 +252,11 @@ private fun BoxScope.ContentText(
exit = fadeOut()
) {
Text(
modifier = Modifier
.drawBehind(extendedSpans)
.align(Alignment.Center),
text = buildAnnotatedString {
(dateModel.text ?: "").split("\n").also { texts ->
(text ?: "").split("\n").also { texts ->
texts.forEachIndexed { i, text ->
append(
extendedSpans.extend(
Expand All @@ -272,12 +276,8 @@ private fun BoxScope.ContentText(
}
}
},
modifier = Modifier
.drawBehind(extendedSpans)
.align(Alignment.Center),
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 16.sp
fontSize = 22.sp,
textAlign = TextAlign.Center
)
}
}
Expand Down

0 comments on commit fee1db1

Please sign in to comment.