MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / getNumberOfItemsPerPage

Method getNumberOfItemsPerPage

src/components/UITheme.cpp:53–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53int UITheme::getNumberOfItemsPerPage(const GfxRenderer& renderer, bool hasHeader, bool hasTabBar, bool hasButtonHints,
54 bool hasSubtitle, int extraReservedHeight) {
55 const ThemeMetrics& metrics = UITheme::getInstance().getMetrics();
56 auto orientation = renderer.getOrientation();
57 int reservedHeight = metrics.topPadding;
58 if (hasHeader) {
59 reservedHeight += metrics.headerHeight + metrics.verticalSpacing;
60 }
61 if (hasTabBar) {
62 reservedHeight += metrics.tabBarHeight;
63 }
64 if (hasButtonHints && orientation != GfxRenderer::Orientation::LandscapeClockwise &&
65 orientation != GfxRenderer::Orientation::LandscapeCounterClockwise) {
66 reservedHeight += metrics.verticalSpacing + metrics.buttonHintsHeight;
67 }
68 const int availableHeight = renderer.getScreenHeight() - reservedHeight - extraReservedHeight;
69 int rowHeight = hasSubtitle ? metrics.listWithSubtitleRowHeight : metrics.listRowHeight;
70 return availableHeight / rowHeight;
71}
72
73// Screen area excluding the button hints
74Rect UITheme::getScreenSafeArea(const GfxRenderer& renderer, bool hasFrontButtonHints, bool hasSideButtonHints) {

Callers 2

loopMethod · 0.80
loopMethod · 0.80

Calls 2

getOrientationMethod · 0.80
getScreenHeightMethod · 0.80

Tested by

no test coverage detected