Skip to content

Use Surface.ROTATION_0 for the camera targetRotation fallback - #149

Merged
replicant1 merged 1 commit into
mainfrom
fix/camera-target-rotation-constant
Jul 22, 2026
Merged

Use Surface.ROTATION_0 for the camera targetRotation fallback#149
replicant1 merged 1 commit into
mainfrom
fix/camera-target-rotation-constant

Conversation

@replicant1

Copy link
Copy Markdown
Owner

ImageCapture.targetRotation is annotated @RotationValue, so a bare 0 literal trips lint's WrongConstant:

Error: Must be one of: Surface.ROTATION_0, Surface.ROTATION_90,
Surface.ROTATION_180, Surface.ROTATION_270 [WrongConstant]

Surface.ROTATION_0 is the same value and states the intent.

Scope

Covers two of the four affected sites — BlisterCountScreen and ScanScriptScreen. Two remain and are not fixed here:

  • CountTabletsScreen.kt:257 — same ?: 0 pattern, a straight swap, just untouched by the work this was split from.
  • CameraCaptureScreen.kt:176,178 — assigns from a rotation variable rather than a literal, so it likely needs @RotationValue on the source rather than a constant swap. I didn't want to guess at that one.

So lintDebug still fails on main after 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

assembleDebug passes. No behaviour change — Surface.ROTATION_0 is 0.

Split out of the string-externalisation branch (#147), where it had been mixed in with unrelated work. Branches off main and is independent of it.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings July 22, 2026 07:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?: 0 with ?: Surface.ROTATION_0 for imageCapture.targetRotation in ScanScriptScreen and BlisterCountScreen.
  • Add the required android.view.Surface import 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.

@replicant1
replicant1 merged commit f86ffb3 into main Jul 22, 2026
1 check passed
@replicant1
replicant1 deleted the fix/camera-target-rotation-constant branch July 22, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants