Skip to content

Commit

Permalink
Adjustment study stroke and input section size on writing practice sc…
Browse files Browse the repository at this point in the history
…reen
  • Loading branch information
syt0r committed Mar 28, 2023
1 parent f8aa791 commit 4159588
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class WritingPracticeViewModel(
val currentStrokeMistakes = state.value.let { it as ScreenState.Review }
.reviewState.value
.currentStrokeMistakes
val path = if (currentStrokeMistakes >= 2) correctStroke else inputData.path
val path = if (currentStrokeMistakes > 2) correctStroke else inputData.path
StrokeProcessingResult.Mistake(path)
}
Logger.d("<< result[$result]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,28 @@ fun WritingPracticeInputSection(
.filterIsInstance<StrokeProcessingResult.Correct>()
.size

val animationAwareStrokesToDraw =
state.drawnStrokesCount - pendingCorrectAnimationsCount

Kanji(
strokes = state.strokes.take(
state.drawnStrokesCount - pendingCorrectAnimationsCount
),
strokes = state.strokes.take(animationAwareStrokesToDraw),
modifier = Modifier.fillMaxSize()
)

when {
state.isStudyMode && state.strokes.size > state.drawnStrokesCount -> {
state.isStudyMode -> {
val studyStrokeIndex = kotlin.math.min(
a = state.strokes.size - 1,
b = animationAwareStrokesToDraw
)
StudyStroke(
path = state.strokes[state.drawnStrokesCount],
path = state.strokes[studyStrokeIndex],
hintClicksCount = hintClickCounter,
delayAnimation = state.drawnStrokesCount == 0 && hintClickCounter.value == 0
)
}
hintClickCounter.value > 0 -> {
transition.totalDurationNanos
HintStroke(
path = state.strokes[state.drawnStrokesCount],
hintClicksCountState = hintClickCounter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ private fun ReviewState(
infoSectionBottomPadding.value = it.heightFromScreenBottom
}
.sizeIn(maxWidth = 400.dp)
.aspectRatio(1f, matchHeightConstraintsFirst = true)
.padding(horizontal = 20.dp)
.padding(bottom = 20.dp)
.aspectRatio(1f, matchHeightConstraintsFirst = true)
)

}
Expand Down

0 comments on commit 4159588

Please sign in to comment.