From 28c925e70e81224e451b5b1a10c6a9635a36d77d Mon Sep 17 00:00:00 2001 From: Brackyt <60280126+Brackyt@users.noreply.github.com> Date: Sun, 25 Jan 2026 14:32:28 +0100 Subject: [PATCH] fix: - text no showing if clipping out of screen - inner child dimensions setting 0 for height - navigation to home menus was skipping transfer --- lib/ThemeEngine/include/BasicElements.h | 6 -- lib/ThemeEngine/include/DefaultTheme.h | 129 +++++++++++++++++++----- lib/ThemeEngine/include/ListElement.h | 5 +- src/activities/home/HomeActivity.cpp | 18 ++-- src/activities/home/default.ini | 129 +++++++++++++++++++----- 5 files changed, 224 insertions(+), 63 deletions(-) diff --git a/lib/ThemeEngine/include/BasicElements.h b/lib/ThemeEngine/include/BasicElements.h index fe1784f2..c7b23448 100644 --- a/lib/ThemeEngine/include/BasicElements.h +++ b/lib/ThemeEngine/include/BasicElements.h @@ -232,12 +232,6 @@ public: drawX = absX + absW - textWidth; } - // Bounds check - if (drawX + textWidth > renderer.getScreenWidth()) { - markClean(); - return; - } - renderer.drawText(fontId, drawX, drawY, finalText.c_str(), black); markClean(); } diff --git a/lib/ThemeEngine/include/DefaultTheme.h b/lib/ThemeEngine/include/DefaultTheme.h index fe4d820d..da59424b 100644 --- a/lib/ThemeEngine/include/DefaultTheme.h +++ b/lib/ThemeEngine/include/DefaultTheme.h @@ -30,23 +30,47 @@ Y = 10 Width = 100% Height = 24 -[BatteryIcon] +[BatteryContainer] Parent = StatusBar +Type = Container +X = 400 +Y = 3 +Width = 28 +Height = 18 + +[BatteryIcon] +Parent = BatteryContainer Type = Icon Src = battery -X = 400 +X = 0 +Y = 0 Width = 28 Height = 18 Color = black +; Fill bar inside the battery (positioned inside the battery outline) +[BatteryFill] +Parent = BatteryContainer +Type = ProgressBar +X = 2 +Y = 4 +Width = 20 +Height = 10 +Value = {BatteryPercent} +Max = 100 +FgColor = black +BgColor = white +ShowBorder = false + [BatteryLabel] Parent = StatusBar Type = Label Font = UI_10 Text = {BatteryPercent}% X = 432 +Y = 3 Width = 48 -Height = 20 +Height = 18 ; --- Recent Books Section --- [RecentBooksSection] @@ -184,37 +208,94 @@ Width = 150 Height = 40 Color = black -; --- Bottom Hint Bar --- -[HintBar] +; --- Bottom Navigation Bar --- +; Positioned at the very bottom of screen, buttons align with physical buttons +[NavBar] Parent = Home -Type = HStack -X = 60 -Y = 760 -Width = 360 -Height = 30 -Spacing = 80 -CenterVertical = true +Type = Container +X = 0 +Y = 776 +Width = 100% +Height = 24 -[HintSelect] -Parent = HintBar +; Left button group (OK and Back) - aligned with left physical buttons +[NavLeftGroup] +Parent = NavBar +Type = HStack +X = 120 +Y = 0 +Width = 168 +Height = 24 +Spacing = 8 + +[NavBtnBack] +Parent = NavLeftGroup +Type = Container +Width = 80 +Height = 8 +Border = true +BorderRadius = 8 + +[NavBtnOK] +Parent = NavLeftGroup +Type = Container +Width = 80 +Height = 24 +Border = true +BorderRadius = 8 + +[NavBtnOKIcon] +Parent = NavBtnOK Type = Icon Src = check -Width = 24 -Height = 24 +X = 30 +Y = 6 +Width = 20 +Height = 12 -[HintUp] -Parent = HintBar +; Right button group (Up and Down) - aligned with right physical buttons +[NavRightGroup] +Parent = NavBar +Type = HStack +X = 292 +Y = 0 +Width = 168 +Height = 24 +Spacing = 8 + +[NavBtnUp] +Parent = NavRightGroup +Type = Container +Width = 80 +Height = 24 +Border = true +BorderRadius = 8 + +[NavBtnUpIcon] +Parent = NavBtnUp Type = Icon Src = up -Width = 24 -Height = 24 +X = 30 +Y = 6 +Width = 20 +Height = 12 -[HintDown] -Parent = HintBar +[NavBtnDown] +Parent = NavRightGroup +Type = Container +Width = 80 +Height = 24 +Border = true +BorderRadius = 8 + +[NavBtnDownIcon] +Parent = NavBtnDown Type = Icon Src = down -Width = 24 -Height = 24 +X = 30 +Y = 6 +Width = 20 +Height = 12 ; ============================================ ; SETTINGS SCREEN diff --git a/lib/ThemeEngine/include/ListElement.h b/lib/ThemeEngine/include/ListElement.h index 2bb9e42e..2e9ea4cd 100644 --- a/lib/ThemeEngine/include/ListElement.h +++ b/lib/ThemeEngine/include/ListElement.h @@ -134,9 +134,10 @@ public: // Layout self first (bounds) UIElement::layout(context, parentX, parentY, parentW, parentH); - // Pre-layout the template once with parent dimensions to get its height + // Pre-layout the template once with list's dimensions to get item sizes + // Pass absH so percentage heights in the template work correctly if (itemTemplate && itemHeight == 0) { - itemTemplate->layout(context, absX, absY, absW, 0); + itemTemplate->layout(context, absX, absY, absW, absH); } } diff --git a/src/activities/home/HomeActivity.cpp b/src/activities/home/HomeActivity.cpp index d46ed0d5..dd432c76 100644 --- a/src/activities/home/HomeActivity.cpp +++ b/src/activities/home/HomeActivity.cpp @@ -25,7 +25,7 @@ void HomeActivity::taskTrampoline(void *param) { } int HomeActivity::getMenuItemCount() const { - int count = 3; // My Library, File transfer, Settings + int count = 4; // My Library, Files, Transfer, Settings if (hasContinueReading) count++; if (hasOpdsUrl) @@ -265,7 +265,8 @@ void HomeActivity::loop() { const int continueIdx = hasContinueReading ? idx++ : -1; const int myLibraryIdx = idx++; const int opdsLibraryIdx = hasOpdsUrl ? idx++ : -1; - const int fileTransferIdx = idx++; + const int filesIdx = idx++; + const int transferIdx = idx++; const int settingsIdx = idx; if (selectorIndex == continueIdx) { @@ -274,8 +275,10 @@ void HomeActivity::loop() { onMyLibraryOpen(); } else if (selectorIndex == opdsLibraryIdx) { onOpdsBrowserOpen(); - } else if (selectorIndex == fileTransferIdx) { - onFileTransferOpen(); + } else if (selectorIndex == filesIdx) { + onMyLibraryOpen(); // Files = file browser + } else if (selectorIndex == transferIdx) { + onFileTransferOpen(); // Transfer = web transfer } else if (selectorIndex == settingsIdx) { onSettingsOpen(); } @@ -359,7 +362,8 @@ void HomeActivity::render() { const int continueIdx = hasContinueReading ? idx++ : -1; const int myLibraryIdx = idx++; const int opdsLibraryIdx = hasOpdsUrl ? idx++ : -1; - const int fileTransferIdx = idx++; + const int filesIdx = idx++; + const int transferIdx = idx++; const int settingsIdx = idx; context.setBool("IsBookSelected", selectorIndex == continueIdx); @@ -381,11 +385,11 @@ void HomeActivity::render() { menuLabels.push_back("Files"); menuIcons.push_back("folder"); - menuSelected.push_back(selectorIndex == fileTransferIdx); + menuSelected.push_back(selectorIndex == filesIdx); menuLabels.push_back("Transfer"); menuIcons.push_back("transfer"); - menuSelected.push_back(false); // Separate from file transfer + menuSelected.push_back(selectorIndex == transferIdx); menuLabels.push_back("Settings"); menuIcons.push_back("settings"); diff --git a/src/activities/home/default.ini b/src/activities/home/default.ini index 43bd1a48..4dd27819 100644 --- a/src/activities/home/default.ini +++ b/src/activities/home/default.ini @@ -67,23 +67,47 @@ Y = 10 Width = 100% Height = 24 -[BatteryIcon] +[BatteryContainer] Parent = StatusBar +Type = Container +X = 400 +Y = 3 +Width = 28 +Height = 18 + +[BatteryIcon] +Parent = BatteryContainer Type = Icon Src = battery -X = 400 +X = 0 +Y = 0 Width = 28 Height = 18 Color = black +; Fill bar inside the battery (positioned inside the battery outline) +[BatteryFill] +Parent = BatteryContainer +Type = ProgressBar +X = 2 +Y = 4 +Width = 20 +Height = 10 +Value = {BatteryPercent} +Max = 100 +FgColor = black +BgColor = white +ShowBorder = false + [BatteryLabel] Parent = StatusBar Type = Label Font = UI_10 Text = {BatteryPercent}% X = 432 +Y = 3 Width = 48 -Height = 20 +Height = 18 ; --- Recent Books Section --- [RecentBooksSection] @@ -221,34 +245,91 @@ Width = 150 Height = 40 Color = black -; --- Bottom Hint Bar --- -[HintBar] +; --- Bottom Navigation Bar --- +; Positioned at the very bottom of screen, buttons align with physical buttons +[NavBar] Parent = Home -Type = HStack -X = 60 -Y = 760 -Width = 360 -Height = 30 -Spacing = 80 -CenterVertical = true +Type = Container +X = 0 +Y = 776 +Width = 100% +Height = 24 -[HintSelect] -Parent = HintBar +; Left button group (OK and Back) - aligned with left physical buttons +[NavLeftGroup] +Parent = NavBar +Type = HStack +X = 120 +Y = 0 +Width = 168 +Height = 24 +Spacing = 8 + +[NavBtnBack] +Parent = NavLeftGroup +Type = Container +Width = 80 +Height = 8 +Border = true +BorderRadius = 8 + +[NavBtnOK] +Parent = NavLeftGroup +Type = Container +Width = 80 +Height = 24 +Border = true +BorderRadius = 8 + +[NavBtnOKIcon] +Parent = NavBtnOK Type = Icon Src = check -Width = 24 -Height = 24 +X = 30 +Y = 6 +Width = 20 +Height = 12 -[HintUp] -Parent = HintBar +; Right button group (Up and Down) - aligned with right physical buttons +[NavRightGroup] +Parent = NavBar +Type = HStack +X = 292 +Y = 0 +Width = 168 +Height = 24 +Spacing = 8 + +[NavBtnUp] +Parent = NavRightGroup +Type = Container +Width = 80 +Height = 24 +Border = true +BorderRadius = 8 + +[NavBtnUpIcon] +Parent = NavBtnUp Type = Icon Src = up -Width = 24 -Height = 24 +X = 30 +Y = 6 +Width = 20 +Height = 12 -[HintDown] -Parent = HintBar +[NavBtnDown] +Parent = NavRightGroup +Type = Container +Width = 80 +Height = 24 +Border = true +BorderRadius = 8 + +[NavBtnDownIcon] +Parent = NavBtnDown Type = Icon Src = down -Width = 24 -Height = 24 +X = 30 +Y = 6 +Width = 20 +Height = 12