Skip to content

7.0.211

Choose a tag to compare

@shai-almog shai-almog released this 07 Nov 08:40
· 240 commits to master since this release
d00c465
Fix screenshot API in Android implementation (#4107)

* Fix Android screenshot API to include PeerComponents

The screenshot() method in AndroidImplementation was missing PeerComponents
(native Android views like BrowserComponent, MapView, etc.) in the captured
image on devices running Android < API 26 (Oreo).

The issue was in the AndroidScreenshotTask.tryFallbackDraw() method, which
only drew the CodenameOneSurface view itself. PeerComponents are added as
siblings to the CodenameOneSurface within the parent RelativeLayout container,
so they were not being captured.

The fix:
- Draw the parent container (RelativeLayout) instead of just the view
- Calculate and apply proper canvas translation to align the content
- Maintain backward compatibility by falling back to view-only drawing
  if no parent is found

Note: The PixelCopy method (API 26+) already worked correctly as it captures
the entire window, so this only affects older Android versions.

* Fixed Android screenshot test

---------

Co-authored-by: Claude <[email protected]>