Fix 6 code review issues: subtitle robustness & lint cleanup#11
Merged
Conversation
…rnings
Critical fixes:
- Fixed state mutation in remember block (PlayerScreen.kt): extracted subtitle detection to testable function
- Fixed regex case-sensitivity: changed from ([a-z]{2}) to (?i)([a-zA-Z]{2}) to match uppercase language codes
- Fixed empty displayLanguage fallback: properly fall back to language code for unknown locales
- Removed unused baseNameNoExt variable
Medium fixes:
- Added snackbar confirmation when sample torrents are added (MainScreen.kt)
- Converted SharedPreferences.edit() to KTX extension for cleaner syntax
Code quality improvements:
- Created PlayerScreenTest with 6 unit tests for subtitle detection logic
- Fixed all lint warnings: removed redundant qualifiers, suppressed Java deprecation warnings
- Converted legacy Long delay to Duration (3.seconds)
- Converted redundant boolean comparisons to range check
- Updated README.md with Recent Improvements section
All 24 unit tests pass, lint clean, tested on R37 emulator.
5c0f664 to
c953168
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses 6 code review findings from PR #9 (subtitles) and #10 (sample torrents):
Critical Issues:
rememberblock → extracted subtitle detection logic to pure function([a-z]{2})now matches uppercase codes likeEN_USxx→ showsxxinstead of blank)baseNameNoExtvariableMedium Issues:
SharedPreferences.edit()to KTX extension functionCode Quality:
delay(3_000L)todelay(3.seconds)with Duration APIin 0.01f..<0.05f)Testing
Files Changed
PlayerScreen.kt— refactored subtitle logic, fixed state mutation, case-insensitive regex, KTX editMainScreen.kt— snackbar feedback, removed redundant qualifiers, KTX edit, range checkTheme.kt— fixed API 31 dynamic colors warning with @SuppressLintDataRepository.kt— converted delay to Duration APIPlayerScreenTest.kt— new unit test suite for subtitle detectionREADME.md— added Recent Improvements section