Implement wheel picker behavior for synced lyrics#326
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @Composable | ||
| fun LyricWordSpan( | ||
| word: SyncedWord, | ||
| isHighlighted: Boolean, |
There was a problem hiding this comment.
Import SyncedWord before using it
LyricWordSpan and sanitizeSyncedWords reference the SyncedWord data class, but the file only imports SyncedLine. Without importing com.theveloper.pixelplay.data.model.SyncedWord, this file does not compile (unresolved reference). Add the missing import so the new helpers build.
Useful? React with 👍 / 👎.
| internal fun highlightSnapOffsetPx( | ||
| viewportHeight: Int, | ||
| itemSize: Int, | ||
| highlightOffsetPx: Float | ||
| ): Int { | ||
| if (viewportHeight <= 0 || itemSize <= 0) return 0 | ||
| val viewport = viewportHeight.toFloat() | ||
| val halfItem = itemSize / 2f | ||
| val targetCenter = (viewport / 2f) - highlightOffsetPx | ||
| val clampedCenter = targetCenter.coerceIn(halfItem, viewport - halfItem) | ||
| return (clampedCenter - halfItem).roundToInt() |
There was a problem hiding this comment.
Add kotlin.math.roundToInt import
highlightSnapOffsetPx calls roundToInt() but no kotlin.math.roundToInt import is present (only abs is imported). Because roundToInt is not part of the default Kotlin imports, the module will fail to compile. Import the function or fully qualify it.
Useful? React with 👍 / 👎.
Summary
LyricsSheetto provide wheel-picker-style synced lyrics with configurable highlight zone and sanitized word renderingTesting
./gradlew testDebugUnitTest(fails: SDK location not configured in environment)https://chatgpt.com/codex/tasks/task_e_6902c9ebdc80832f950c4bdb0db09cc9