Skip to content

add CaptureSlots table, CaptureRtlPolicy, and adaptive slot scope metadata - #651

Draft
Kimblebee wants to merge 3 commits into
mainfrom
kim/adaptive/capture-slots
Draft

Kimblebee wants to merge 3 commits into
mainfrom
kim/adaptive/capture-slots

Conversation

@Kimblebee

Copy link
Copy Markdown
Collaborator

Stacked PR: Based on main

Summary

Introduces the foundational slot-table and scope contracts for adaptive capture layouts in :ui:components:capture. By bundling capture chrome controls into an @Immutable CaptureSlots table, extending PreviewOverlaySlotScope and CaptureSlotScope with orientation and isCompact container hints, defining CaptureRtlPolicy, and providing deterministic PlaceholderCaptureSlots scaffolding, this slice unblocks independent review and geometry testing of side rails (kim/adaptive/side-rails), multi-posture layouts (kim/adaptive/layouts), and the CaptureScaffold orchestrator (kim/adaptive/layout-orchestrator) with zero behavioral or visual change to main.

Key Changes

  • Slot Scope Metadata (OverlapAwareStyleProvider.kt, CaptureScaffold.kt):
    • Added default-backed orientation: Orientation = Orientation.Horizontal and isCompact: Boolean = false to PreviewOverlaySlotScope and promoted both onto CaptureSlotScope.
    • Updated OverlapAwareStyleProvider, CaptureSlotScopeImpl, and static PreviewOverlaySlotScope(...) / CaptureSlotScope(...) preview/test factories to propagate orientation and isCompact alongside viewfinder-overlap styling.
  • Slot Table & Overlap Adapter (CaptureSlots.kt):
    • Added @Immutable internal data class CaptureSlots bundling 13 PreviewOverlaySlotScope.(Modifier) -> Unit control slots plus snackBar and errorDialog, each defaulting to {} so omitted controls collapse cleanly.
    • Added OverlapAwareCaptureSlot to bind OverlapAwareStyleProvider(orientation, isCompact) around individual CaptureSlots lambdas.
  • Interim Ergonomic RTL Policy (CaptureSlots.kt):
    • Added public @Immutable data class CaptureRtlPolicy(mirrorSideRails = false, mirrorCompactBottomBar = false) and LocalCaptureRtlPolicy (staticCompositionLocalOf) so camera chrome stays anchored to its physical sides by default while remaining overridable in previews and tests.
  • Placeholder Scaffolding (CaptureSlots.kt):
    • Added CaptureSlotTokens, PlaceholderControlBox, PlaceholderViewfinder, and PlaceholderCaptureSlots (default / sideRail) that transpose control dimensions for Orientation.Vertical vs. Orientation.Horizontal, respond to isCompact, and recycle canonical TestTags constants.

Technical Notes

  • Two-tier scope boundary: Typing internal CaptureSlots on PreviewOverlaySlotScope lets spatial posture layouts provide orientation, isCompact, and live viewfinder-overlap styling without depending on CaptureScaffoldState or ZoomStateManager, while CaptureScaffold seamlessly lifts PreviewOverlaySlotScope into CaptureSlotScope via rememberCaptureSlotScope.
  • Modifier ordering for parent constraint clamping: OverlapAwareCaptureSlot applies caller modifiers to the outer OverlapAwareStyleProvider Box so boundsInWindow() measures true slot placement. PlaceholderControlBox applies incoming modifier before .size(width, height) so parent containers can prepend Modifier.sizeIn(...) to clamp dimensions in condensed windows.
  • Duplicate test-tag prevention: PlaceholderCaptureSlots.sideRail(tagQuickSettingsOverlay = false) omits QUICK_SETTINGS_BOTTOM_SHEET on the inner placeholder by default so outer Quick Settings sheet/card containers in kim/adaptive/layouts can own that tag without duplicate-node matcher failures.

Not Included Yet

  • Comes later in this series:
    • Live CaptureScaffold wiring and 7-mode orchestration (kim/adaptive/layout-orchestrator).
    • Container-level RTL enforcement (kim/adaptive/side-rails, kim/adaptive/layouts).
    • Dedicated vertical control UIs (#649 indicator pill, #635 toggle switch, #648 Quick Settings card, #644 zoom bar RTL polish).
    • Counter-rotation, outer viewfinder hoisting, and upright content gravity (kim/adaptive/layout-rotation -> kim/adaptive/content-gravity).
  • Open follow-ups:
    • Right-to-left behavior is not finalized: Keeping side rails on their physical sides is an interim default; ordering inside vertical components (zoom stops, status indicators) and whether the full layout should mirror remain open for follow-up polish.

Testing

  • Added Robolectric Compose test suite CaptureSlotsTest (:ui:components:capture:testDebugUnitTest):
    • captureRtlPolicy_defaultsToUnmirrored_andPropagatesThroughCompositionLocal — verifies default unmirrored policy and LocalCaptureRtlPolicy subtree overrides.
    • captureSlotScope_exposesMetadata_overlapContainerColors_andDismissCallback — verifies orientation, isCompact, isOverViewfinder, isRecording, dismissQuickSettings(), and BLACK_60 / WHITE_20 container colors.
    • captureSlots_andPlaceholders_adaptAxisAndRecycleExistingTags — verifies PREVIEW_DISPLAY viewfinder tagging, Modifier.sizeIn(maxHeight = 40.dp) clamping on vertical zoom placeholders, and tagQuickSettingsOverlay toggling.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces adaptive layout metadata (orientation and isCompact) to PreviewOverlaySlotScope and CaptureSlotScope to support responsive UI control sizing and arrangement in different container contexts. It also adds a new CaptureSlots.kt file containing layout slot definitions, placeholder controls, RTL policies, and tokens, along with a comprehensive test suite in CaptureSlotsTest.kt. No review comments were provided for this pull request.

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.

1 participant