Skip to content

Investigate OnHierarchyChangeListener as readiness indicator for screenshot#112

Draft
EmilioBejasa wants to merge 2 commits into
mainfrom
investigate-addview-hook
Draft

Investigate OnHierarchyChangeListener as readiness indicator for screenshot#112
EmilioBejasa wants to merge 2 commits into
mainfrom
investigate-addview-hook

Conversation

@EmilioBejasa
Copy link
Copy Markdown
Collaborator

Summary

Companion to #111. Investigates ViewGroup.setOnHierarchyChangeListener as an event-driven alternative to polling childCount > 0.

  • hierarchyListenerTest: asserts the listener fires when Fabric mounts its first child — no screenshot, just the indicator
  • addViewHookTest: same setup, then re-layouts and snaps a screenshot

Why

The onChildViewAdded callback fires synchronously the moment Fabric calls addView on the surface root — no polling loop needed. Uses a public Android API without subclassing.

Test plan

  • hierarchyListenerTest passes — confirms the signal is reachable
  • addViewHookTest passes with non-blank screenshot ("Hello" visible)

🤖 Generated with Claude Code

EmilioBejasa and others added 2 commits April 9, 2026 15:25
…enshot

Uses ViewGroup.setOnHierarchyChangeListener on the surface root view to
get a direct, non-polling callback the moment Fabric mounts its first
child. Followed by a re-layout pass before snapping the screenshot.

Produces a non-blank screenshot without polling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dicator

Adds a test that asserts the listener fires without taking a screenshot,
mirroring the childCountTest structure on the predraw-listener branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@EmilioBejasa EmilioBejasa requested a review from tdrhq April 9, 2026 19:44
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