public class CPDFSingleLayoutManager extends CPDFLayoutManager
This layout manager is used when the reader presents one logical screen at a time. It supports vertical and horizontal paging, single-page mode, double-page mode, and double-page mode with a separate cover page. Unlike the continuous manager, most branches size each page or pair against the viewport so that page snapping can use stable screen-sized steps.
The manager only produces geometry. Page drawing, scrolling, snapping, and user interaction
are handled elsewhere by ReaderView. Calculated page rectangles are stored in
pageLocations; aggregate bounds are stored in contentWidth and
contentHeight.
| Constructor and Description |
|---|
CPDFSingleLayoutManager()
Creates a single-page layout manager without binding it to a reader view.
|
CPDFSingleLayoutManager(ReaderView readerView)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
float |
getContentHeight()
Returns the total content height calculated by the last
refresh() call. |
float |
getContentWidth()
Returns the total content width calculated by the last
refresh() call. |
android.graphics.RectF |
getPageLocationRect(int pageNum)
Returns the calculated page rectangle for the given page index.
|
void |
refresh()
Recalculates all page rectangles and total content bounds.
|
CPDFLayoutManager |
setPageSizes(java.util.List<android.graphics.RectF> pageSizes)
Sets source PDF page sizes used by legacy call sites.
|
CPDFLayoutManager |
setScale(float scale)
Sets the zoom scale used by subsequent layout calculations.
|
CPDFLayoutManager |
setScreenVertical(boolean screenVertical)
Sets whether the current screen is treated as portrait for legacy call sites.
|
getPageSpacing, getReaderHeight, getReaderWidth, setPageSpacingpublic CPDFSingleLayoutManager()
The layout inputs should be supplied through CPDFLayoutConfig before
refresh() is called.
@Deprecated public CPDFSingleLayoutManager(ReaderView readerView)
The reader view argument is intentionally ignored. New code should use
CPDFSingleLayoutManager() and pass all layout inputs through
CPDFLayoutConfig.
readerView - ignored legacy reader view referencepublic CPDFLayoutManager setScale(float scale)
scale - zoom multiplier applied to source page sizespublic android.graphics.RectF getPageLocationRect(int pageNum)
The rectangle is expressed in the paged content coordinate system, not in screen coordinates. An empty rectangle is returned for invalid indexes or before layout is ready.
pageNum - zero-based page indexpublic float getContentWidth()
refresh() call.public float getContentHeight()
refresh() call.public CPDFLayoutManager setPageSizes(java.util.List<android.graphics.RectF> pageSizes)
When CPDFLayoutConfig is provided, config page sizes take precedence during
refresh().
pageSizes - original PDF page sizespublic CPDFLayoutManager setScreenVertical(boolean screenVertical)
When CPDFLayoutConfig is provided, config orientation takes precedence during
refresh().
screenVertical - true when the reader screen should use portrait formulaspublic void refresh()
The method copies values from CPDFLayoutConfig, resets cached metrics, prepares
page metrics and page pairs, then dispatches to the mode-specific layout method. It updates
pageLocations, contentWidth, contentHeight, and the inherited
CPDFLayoutResult.