feat: 优化歌词翻译/音译切换按钮UI布局 - #427
Conversation
- 将译/音切换按钮移至进度条上方左侧,与网易云音乐布局一致 - 实现字体高亮效果:当前状态字体高亮显示 - 修复SAF URI解析问题,支持检测本地音译歌词文件 - 优化歌词文件检测逻辑,提高检测成功率
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: cwuom/NeriPlayer/.coderabbit.yaml Review profile: QUIET Plan: Advanced Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (7)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough新增次级歌词模式解析,用于根据翻译和音标歌词的可用性选择显示内容。播放页、横屏歌词视图和全屏歌词页使用解析后的模式控制副歌词显示。全屏歌词页新增模式切换控件,并将选择写入设置。更多选项中的歌词设置会根据当前歌词内容调整文案和选项。 Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The previously reported local-lyrics lookup failures are addressed, and no actionable issue remains in the secondary-lyrics controls. The change is ready for normal merge checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change appears limited to lyric display and preferences, with no identified security-sensitive action. An interrupted preference update could nevertheless leave the display choice inconsistent across views. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 4.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 6 files. (3 skipped: 3 unsupported.) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Note
Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.
🟡 Other comments (2)
app/src/main/java/moe/ouom/neriplayer/data/local/media/LocalMediaSupport.kt-660-660 (1)
660-660: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win避免对非文档 URI 调用
getDocumentId。当
source是普通content://URI 且resolveLocalFile返回null时,inspectLyricsFast会调用parseSafDocumentIdToPath。该函数直接调用android.provider.DocumentsContract.getDocumentId(uri);非文档 URI 会抛出IllegalArgumentException。PlayerLyricsProvider的本地歌词路径未捕获该异常,因此本地歌词读取会失败。请先使用
DocumentsContract.isDocumentUri(context, uri)检查 URI,或捕获异常并返回null。app/src/main/java/moe/ouom/neriplayer/data/local/media/LocalMediaSupport.kt-1218-1221 (1)
1218-1221: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win将
home:映射到 Documents 目录。对于 Android 内置
ExternalStorageProvider,home:的根目录是Environment.DIRECTORY_DOCUMENTS。当前代码会把home:track.mp3映射到外部存储根目录下的track.mp3。当该路径不存在时,parseSafDocumentIdToPath返回null,因此inspectLyricsFromDirectFile不会调用findNearbyLyricFiles,同目录的.roma.lrc也无法被发现。File( File( Environment.getExternalStorageDirectory(), Environment.DIRECTORY_DOCUMENTS ), relativePath )
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: cwuom/NeriPlayer/.coderabbit.yaml
Review profile: QUIET
Plan: Advanced
Run ID: caa15f84-bb5a-4bc1-b419-ac6816255167
📒 Files selected for processing (4)
app/src/main/java/moe/ouom/neriplayer/core/player/metadata/PlayerLyricsProvider.ktapp/src/main/java/moe/ouom/neriplayer/data/local/media/LocalMediaSupport.ktapp/src/main/java/moe/ouom/neriplayer/ui/screen/LyricsScreen.ktapp/src/main/java/moe/ouom/neriplayer/ui/screen/NowPlayingScreen.kt
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
…erence, offset & secondary line toggle) - Merge upstream PR cwuom#417: support lyric source preference order and default lyric offset settings - Merge upstream PR cwuom#427: add secondary lyric toggle button (translation / romanized phonetic) and UI layout improvements - Preserve local modifications including word-timed lyric fallback chain (Kugou -> QQ -> AMLL -> CloudMusic), home roaming, and custom playback action toolbar buttons
描述 / Description
优化歌词页面的"译/音"切换按钮UI,将其移至进度条上方左侧,与网易云音乐的布局保持一致。同时修复了SAF URI解析问题,使应用能够正确检测本地音译歌词文件(.roma.lrc)。
类型 / Type
修复或解决的问题 / Issues Fixed or Closed by This PR
清单 / Checklist
其他信息 / Additional Information
UI 变更说明
技术细节
LyricsProgressSection内部移至进度条上方的独立Row中parseSafDocumentIdToPath函数,从 SAF document ID 中提取实际文件路径inspectLyricsFast函数,支持通过 context 参数解析 SAF URI修改文件
LyricsScreen.kt- UI布局调整LocalMediaSupport.kt- SAF URI解析和歌词文件检测PlayerLyricsProvider.kt- 传递context参数NowPlayingScreen.kt- 传递context参数变更摘要