Skip to content

feat: implement edge-to-edge support across Pluto#362

Open
argahutama wants to merge 6 commits into
androidPluto:developfrom
argahutama:feature/edge-to-edge-handlings
Open

feat: implement edge-to-edge support across Pluto#362
argahutama wants to merge 6 commits into
androidPluto:developfrom
argahutama:feature/edge-to-edge-handlings

Conversation

@argahutama
Copy link
Copy Markdown

@argahutama argahutama commented May 20, 2026

Summary

Adopts Android's edge-to-edge display mode throughout the Pluto library, its plugins, and the sample app. Content now draws behind the status bar and navigation bar; insets are handled explicitly via WindowInsetsCompat so nothing gets clipped.


Changes

deps: add androidx-activity dependency for edge-to-edge support

  • Added androidx.activity:activity-ktx to the version catalog, pluto/lib, and sample — required for the enableEdgeToEdge() API.

feat: enable edge-to-edge in Pluto core activities

  • PlutoActivity — replaced legacy WindowManager flags and manual status-bar colour with enableEdgeToEdge() + ViewCompat.setOnApplyWindowInsetsListener applying top/bottom padding.
  • SelectorActivity — same pattern; preserves the layout's initial padding so insets are additive.
  • RulerActivity — adjusts the floating controls' topMargin instead of padding to keep the ruler widget unaffected.
  • Plugin fragment layouts (datastore, exceptions, logger, network, rooms-database, shared-preferences, selector dialog) — removed android:fitsSystemWindows="true"; insets are now consumed at the activity level.

feat: add edge-to-edge support to layout-inspector plugin

  • ViewHierarchyFragment — calls WindowCompat.setDecorFitsSystemWindows(false) in onStart and applies insets to the app-bar top padding and list bottom padding. Added @id/appBarContent to the layout.
  • ViewInfoFragment — removed the now-redundant manual bottom-padding insets listener for the preview bottom sheet.
  • Layout XMLs (view_info, view_hierarchy, view_attr) — removed android:fitsSystemWindows.

Bug fix — InspectOverlay coordinate mismatch under edge-to-edge:

enableEdgeToEdge() + paddingTop = statusBarHeight on the Pluto root view shifts InspectOverlay down the screen. InspectedView.reset() was storing rects in screen-absolute coordinates (via getLocationOnScreen), while canvas drawing and MotionEvent coordinates are overlay-local — causing hit-testing and selection highlights to be offset by roughly the status-bar height.

  • InspectedView now holds a reference to the overlay View and calls overlay.getLocationOnScreen() inside every reset(), subtracting the offset so all rects are in overlay-local space. Works correctly for both edge-to-edge and non-edge-to-edge inspected apps.
  • InspectOverlay.tryGetFrontView() wraps the traversal in doOnLayout {} so the position is read only after the overlay's first layout pass (before layout getLocationOnScreen always returns [0, 0]).

feat: enable edge-to-edge in sample app activities

  • MainActivity and DemoLayoutInspectorActivity — added enableEdgeToEdge() and explicit inset handling (app-bar top, actions/root bottom, horizontal gutters).
  • Added @id/appBar to both activity layouts so the inset listener can reference the correct view.

Screenshots

Screenshot_20260521_054257 Screenshot_20260521_054307 Screenshot_20260521_054318 Screenshot_20260521_054342 Screenshot_20260521_055347

argahutama and others added 4 commits May 21, 2026 05:29
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- PlutoActivity: replace legacy window flags with enableEdgeToEdge() and
  apply top/bottom padding via WindowInsetsCompat
- SelectorActivity: add enableEdgeToEdge() and inset-aware padding
- RulerActivity: add enableEdgeToEdge() and adjust controls top margin
  to account for status bar insets
- Remove android:fitsSystemWindows from all plugin fragment root layouts
  (datastore, exceptions, logger, network, rooms-database, shared-prefs,
  selector dialog) — insets are now handled at the activity level

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ViewHierarchyFragment: add WindowCompat.setDecorFitsSystemWindows(false)
  in onStart and apply insets to appBarContent top padding and list bottom
  padding; add @id/appBarContent to the layout
- ViewInfoFragment: remove obsolete manual insets listener (bottom-sheet
  padding is now handled by the activity-level inset logic)
- Remove android:fitsSystemWindows from view_info, view_hierarchy and
  view_attr layouts

Fix InspectOverlay coordinate mismatch under edge-to-edge:
  enableEdgeToEdge() + paddingTop on the Pluto root view shifts the
  InspectOverlay down by statusBarHeight in screen space. Previously
  InspectedView.reset() stored rects in screen-absolute coordinates while
  canvas drawing and MotionEvent coordinates are overlay-local, causing
  hit-testing and selection highlights to be offset by ~statusBarHeight.

  - InspectedView now stores an overlay View reference and calls
    overlay.getLocationOnScreen() inside every reset(), subtracting the
    overlay's screen offset so all rects are in overlay-local space.
    This works correctly for both edge-to-edge and non-edge-to-edge
    inspected apps.
  - InspectOverlay.tryGetFrontView() wraps the traversal in doOnLayout{}
    so getLocationOnScreen() is called only after the overlay has
    completed its first layout pass (before layout it always returns 0,0).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- MainActivity: add enableEdgeToEdge(), pad appBar top and actionsView
  bottom using WindowInsetsCompat; add @id/appBar to layout
- DemoLayoutInspectorActivity: add enableEdgeToEdge(), pad appBar top and
  root left/right/bottom; add @id/appBar to layout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@argahutama
Copy link
Copy Markdown
Author

@srtvprateek please kindly help to review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant