Use Surface.ROTATION_0 for the camera targetRotation fallback - #149
Merged
Conversation
ImageCapture.targetRotation is annotated @RotationValue, so a bare 0 literal trips lint's WrongConstant. Surface.ROTATION_0 is the same value and states the intent. Covers the blister-count and scan-script previews; CameraCaptureScreen and CountTabletsScreen still have the same issue and are left for a follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR replaces the 0 literal fallback used for ImageCapture.targetRotation with Surface.ROTATION_0 in two camera-backed screens, aligning with the @RotationValue/WrongConstant lint requirements while keeping the same runtime behavior.
Changes:
- Replace
?: 0with?: Surface.ROTATION_0forimageCapture.targetRotationinScanScriptScreenandBlisterCountScreen. - Add the required
android.view.Surfaceimport in both files.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/src/main/java/com/example/aitoui/scan/ScanScriptScreen.kt | Uses Surface.ROTATION_0 instead of a bare 0 for targetRotation fallback to satisfy @RotationValue lint expectations. |
| app/src/main/java/com/example/aitoui/inhand/blister/BlisterCountScreen.kt | Same targetRotation fallback adjustment, plus Surface import, to avoid WrongConstant lint warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
ImageCapture.targetRotationis annotated@RotationValue, so a bare0literal trips lint'sWrongConstant:Surface.ROTATION_0is the same value and states the intent.Scope
Covers two of the four affected sites —
BlisterCountScreenandScanScriptScreen. Two remain and are not fixed here:CountTabletsScreen.kt:257— same?: 0pattern, a straight swap, just untouched by the work this was split from.CameraCaptureScreen.kt:176,178— assigns from arotationvariable rather than a literal, so it likely needs@RotationValueon the source rather than a constant swap. I didn't want to guess at that one.So
lintDebugstill fails onmainafter this merges. Worth a follow-up that clears the remaining two and gets lint back to green, at which point it could go in CI.Verification
assembleDebugpasses. No behaviour change —Surface.ROTATION_0is0.Split out of the string-externalisation branch (#147), where it had been mixed in with unrelated work. Branches off
mainand is independent of it.🤖 Generated with Claude Code