adds bezel compensation settings
This commit is contained in:
@@ -12,15 +12,15 @@
|
||||
#include "util/StringUtils.h"
|
||||
|
||||
namespace {
|
||||
// Layout constants (matching MyLibraryActivity's Recent tab)
|
||||
constexpr int HEADER_Y = 15;
|
||||
constexpr int CONTENT_START_Y = 60;
|
||||
// Base layout constants (bezel offsets added at render time)
|
||||
constexpr int BASE_HEADER_Y = 15;
|
||||
constexpr int BASE_CONTENT_START_Y = 60;
|
||||
constexpr int LINE_HEIGHT = 65; // Two-line items (title + author)
|
||||
constexpr int LEFT_MARGIN = 20;
|
||||
constexpr int RIGHT_MARGIN = 40;
|
||||
constexpr int BASE_LEFT_MARGIN = 20;
|
||||
constexpr int BASE_RIGHT_MARGIN = 40;
|
||||
constexpr int MICRO_THUMB_WIDTH = 45;
|
||||
constexpr int MICRO_THUMB_HEIGHT = 60;
|
||||
constexpr int THUMB_RIGHT_MARGIN = 50;
|
||||
constexpr int BASE_THUMB_RIGHT_MARGIN = 50;
|
||||
|
||||
// Timing thresholds
|
||||
constexpr int SKIP_PAGE_MS = 700;
|
||||
@@ -41,7 +41,9 @@ std::string getMicroThumbPathForBook(const std::string& bookPath) {
|
||||
int ListViewActivity::getPageItems() const {
|
||||
const int screenHeight = renderer.getScreenHeight();
|
||||
const int bottomBarHeight = 60;
|
||||
const int availableHeight = screenHeight - CONTENT_START_Y - bottomBarHeight;
|
||||
const int bezelTop = renderer.getBezelOffsetTop();
|
||||
const int bezelBottom = renderer.getBezelOffsetBottom();
|
||||
const int availableHeight = screenHeight - (BASE_CONTENT_START_Y + bezelTop) - bottomBarHeight - bezelBottom;
|
||||
int items = availableHeight / LINE_HEIGHT;
|
||||
if (items < 1) {
|
||||
items = 1;
|
||||
@@ -172,6 +174,16 @@ void ListViewActivity::render() const {
|
||||
const int pageItems = getPageItems();
|
||||
const int bookCount = static_cast<int>(bookList.books.size());
|
||||
|
||||
// Calculate bezel-adjusted margins
|
||||
const int bezelTop = renderer.getBezelOffsetTop();
|
||||
const int bezelLeft = renderer.getBezelOffsetLeft();
|
||||
const int bezelRight = renderer.getBezelOffsetRight();
|
||||
const int HEADER_Y = BASE_HEADER_Y + bezelTop;
|
||||
const int CONTENT_START_Y = BASE_CONTENT_START_Y + bezelTop;
|
||||
const int LEFT_MARGIN = BASE_LEFT_MARGIN + bezelLeft;
|
||||
const int RIGHT_MARGIN = BASE_RIGHT_MARGIN + bezelRight;
|
||||
const int THUMB_RIGHT_MARGIN = BASE_THUMB_RIGHT_MARGIN + bezelRight;
|
||||
|
||||
// Draw header with list name
|
||||
auto truncatedTitle = renderer.truncatedText(UI_12_FONT_ID, listName.c_str(), pageWidth - LEFT_MARGIN - RIGHT_MARGIN);
|
||||
renderer.drawText(UI_12_FONT_ID, LEFT_MARGIN, HEADER_Y, truncatedTitle.c_str(), true, EpdFontFamily::BOLD);
|
||||
@@ -190,7 +202,7 @@ void ListViewActivity::render() const {
|
||||
const auto pageStartIndex = selectorIndex / pageItems * pageItems;
|
||||
|
||||
// Draw selection highlight
|
||||
renderer.fillRect(0, CONTENT_START_Y + (selectorIndex % pageItems) * LINE_HEIGHT - 2, pageWidth - RIGHT_MARGIN,
|
||||
renderer.fillRect(bezelLeft, CONTENT_START_Y + (selectorIndex % pageItems) * LINE_HEIGHT - 2, pageWidth - RIGHT_MARGIN - bezelLeft,
|
||||
LINE_HEIGHT);
|
||||
|
||||
// Calculate available text width
|
||||
|
||||
Reference in New Issue
Block a user