Add common layout components for PDF#3782
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3782 +/- ##
============================================
+ Coverage 66.14% 66.43% +0.29%
- Complexity 1660 1683 +23
============================================
Files 386 391 +5
Lines 10039 10129 +90
Branches 1288 1292 +4
============================================
+ Hits 6640 6729 +89
- Misses 2722 2723 +1
Partials 677 677
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Regarding the package structure, right now PageHeaderLayout, TableLayout, etc live in components package. Since components usually implies actual UI rendering code (like @Composable functions), and these classes are purely math models, would it make more sense to move these classes one level up (or maybe org.groundplatform.feature.pdf.render.layout or model)?
| return maxOf(leftTextHeight, rightTextHeight + imageHeight + imageSpacing) + 2 * CELL_PADDING | ||
| } | ||
|
|
||
| fun getRow( |
There was a problem hiding this comment.
Since this includes both the top and bottom borders for every row, would it cause rendering of a line twice? Would it be safer to only draw the bottom border per row or does the rendering would take care of deduplication?
| * | ||
| * All measurements are in PDF points (1/72 inch). | ||
| */ | ||
| internal object PdfConfig { |
There was a problem hiding this comment.
Please consider adding ktdoc for these constants. Also, there is a mix of Int and Float in here. Would converting them to Float be easier down the line?
Towards #3715
(Split from #3774)
This PR focuses on adding the building blocks for the PDF document:
PageHeaderLayout(to display the survey name, job and date+time at the top),PageFooterLayout(to display the data collector information and the page number at the bottom),QrBlockLayout(to display the QR code embedding the geometry),TableLayout(with all the submission data) and their unit tests.It also adds the following helpers:
PdfConfigfor dimensions and marginsPdfGeometryfor utilities and classes which handle calculations and measurements@shobhitagarwal1612 PTAL?