Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] View cuts off on Android #540

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yooasd11
Copy link

@yooasd11 yooasd11 commented Aug 27, 2024

Improve View Capture Implementation

This PR addresses several issues in the current view capture implementation, enhancing its accuracy, reliability, and performance across various view types.

Summary of Changes

  • Improved ScrollView height calculation
  • Implemented forced layout measurement before capture
  • Enhanced view hierarchy capture logic
  • Optimized handling of TextureView and SurfaceView
  • Refined bitmap scaling logic
  • Added detailed logging for debugging
  • Strengthened exception handling

Detailed Changes

  1. ScrollView Height Calculation: Accurately calculates the full content height of ScrollViews, ensuring complete capture of scrollable content.

  2. Forced Layout Measurement: Implements a pre-capture layout measurement to guarantee accurate view dimensions.

  3. View Hierarchy Capture: Introduced a new captureViewHierarchy method for recursive processing of all view types, ensuring comprehensive capture of complex view structures.

  4. TextureView and SurfaceView Handling: Implemented dedicated capture methods for TextureView and SurfaceView, addressing their unique rendering characteristics.

  5. Bitmap Scaling: Improved the scaling logic to maintain aspect ratio when resizing captured bitmaps.

  6. Enhanced Logging: Added detailed logging throughout the capture process for easier debugging and issue identification.

  7. Exception Handling: Strengthened exception handling, particularly for PixelCopy operations, improving the robustness of the capture process.

Testing Notes

  • Thoroughly test with various view hierarchies, especially those containing ScrollViews, TextureViews, and SurfaceViews.
  • Verify capture accuracy on different screen sizes and densities.
  • Check log output for any warnings or errors during the capture process.
  • Ensure that scaled captures maintain the correct aspect ratio.

Potential Impacts

  • This update may slightly increase memory usage due to more comprehensive view processing.
  • Capture time might be marginally longer for complex view hierarchies, but with improved accuracy.
  • Existing integrations should be thoroughly tested to ensure compatibility with the new capture logic.

Please review and test thoroughly. Any feedback or suggestions for further improvements are welcome.

@yooasd11 yooasd11 marked this pull request as draft August 27, 2024 09:53
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