- text no showing if clipping out of screen
- inner child dimensions setting 0 for height
- navigation to home menus was skipping transfer
This commit is contained in:
Brackyt 2026-01-25 14:32:28 +01:00
parent 374f1a1106
commit d54f3c5143
5 changed files with 224 additions and 63 deletions

View File

@ -232,12 +232,6 @@ public:
drawX = absX + absW - textWidth; drawX = absX + absW - textWidth;
} }
// Bounds check
if (drawX + textWidth > renderer.getScreenWidth()) {
markClean();
return;
}
renderer.drawText(fontId, drawX, drawY, finalText.c_str(), black); renderer.drawText(fontId, drawX, drawY, finalText.c_str(), black);
markClean(); markClean();
} }

View File

@ -30,23 +30,47 @@ Y = 10
Width = 100% Width = 100%
Height = 24 Height = 24
[BatteryIcon] [BatteryContainer]
Parent = StatusBar Parent = StatusBar
Type = Container
X = 400
Y = 3
Width = 28
Height = 18
[BatteryIcon]
Parent = BatteryContainer
Type = Icon Type = Icon
Src = battery Src = battery
X = 400 X = 0
Y = 0
Width = 28 Width = 28
Height = 18 Height = 18
Color = black 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] [BatteryLabel]
Parent = StatusBar Parent = StatusBar
Type = Label Type = Label
Font = UI_10 Font = UI_10
Text = {BatteryPercent}% Text = {BatteryPercent}%
X = 432 X = 432
Y = 3
Width = 48 Width = 48
Height = 20 Height = 18
; --- Recent Books Section --- ; --- Recent Books Section ---
[RecentBooksSection] [RecentBooksSection]
@ -184,37 +208,94 @@ Width = 150
Height = 40 Height = 40
Color = black Color = black
; --- Bottom Hint Bar --- ; --- Bottom Navigation Bar ---
[HintBar] ; Positioned at the very bottom of screen, buttons align with physical buttons
[NavBar]
Parent = Home Parent = Home
Type = HStack Type = Container
X = 60 X = 0
Y = 760 Y = 776
Width = 360 Width = 100%
Height = 30 Height = 24
Spacing = 80
CenterVertical = true
[HintSelect] ; Left button group (OK and Back) - aligned with left physical buttons
Parent = HintBar [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 Type = Icon
Src = check Src = check
Width = 24 X = 30
Height = 24 Y = 6
Width = 20
Height = 12
[HintUp] ; Right button group (Up and Down) - aligned with right physical buttons
Parent = HintBar [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 Type = Icon
Src = up Src = up
Width = 24 X = 30
Height = 24 Y = 6
Width = 20
Height = 12
[HintDown] [NavBtnDown]
Parent = HintBar Parent = NavRightGroup
Type = Container
Width = 80
Height = 24
Border = true
BorderRadius = 8
[NavBtnDownIcon]
Parent = NavBtnDown
Type = Icon Type = Icon
Src = down Src = down
Width = 24 X = 30
Height = 24 Y = 6
Width = 20
Height = 12
; ============================================ ; ============================================
; SETTINGS SCREEN ; SETTINGS SCREEN

View File

@ -134,9 +134,10 @@ public:
// Layout self first (bounds) // Layout self first (bounds)
UIElement::layout(context, parentX, parentY, parentW, parentH); 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) { if (itemTemplate && itemHeight == 0) {
itemTemplate->layout(context, absX, absY, absW, 0); itemTemplate->layout(context, absX, absY, absW, absH);
} }
} }

View File

@ -25,7 +25,7 @@ void HomeActivity::taskTrampoline(void *param) {
} }
int HomeActivity::getMenuItemCount() const { int HomeActivity::getMenuItemCount() const {
int count = 3; // My Library, File transfer, Settings int count = 4; // My Library, Files, Transfer, Settings
if (hasContinueReading) if (hasContinueReading)
count++; count++;
if (hasOpdsUrl) if (hasOpdsUrl)
@ -268,7 +268,8 @@ void HomeActivity::loop() {
const int continueIdx = hasContinueReading ? idx++ : -1; const int continueIdx = hasContinueReading ? idx++ : -1;
const int myLibraryIdx = idx++; const int myLibraryIdx = idx++;
const int opdsLibraryIdx = hasOpdsUrl ? idx++ : -1; const int opdsLibraryIdx = hasOpdsUrl ? idx++ : -1;
const int fileTransferIdx = idx++; const int filesIdx = idx++;
const int transferIdx = idx++;
const int settingsIdx = idx; const int settingsIdx = idx;
if (selectorIndex == continueIdx) { if (selectorIndex == continueIdx) {
@ -277,8 +278,10 @@ void HomeActivity::loop() {
onMyLibraryOpen(); onMyLibraryOpen();
} else if (selectorIndex == opdsLibraryIdx) { } else if (selectorIndex == opdsLibraryIdx) {
onOpdsBrowserOpen(); onOpdsBrowserOpen();
} else if (selectorIndex == fileTransferIdx) { } else if (selectorIndex == filesIdx) {
onFileTransferOpen(); onMyLibraryOpen(); // Files = file browser
} else if (selectorIndex == transferIdx) {
onFileTransferOpen(); // Transfer = web transfer
} else if (selectorIndex == settingsIdx) { } else if (selectorIndex == settingsIdx) {
onSettingsOpen(); onSettingsOpen();
} }
@ -362,7 +365,8 @@ void HomeActivity::render() {
const int continueIdx = hasContinueReading ? idx++ : -1; const int continueIdx = hasContinueReading ? idx++ : -1;
const int myLibraryIdx = idx++; const int myLibraryIdx = idx++;
const int opdsLibraryIdx = hasOpdsUrl ? idx++ : -1; const int opdsLibraryIdx = hasOpdsUrl ? idx++ : -1;
const int fileTransferIdx = idx++; const int filesIdx = idx++;
const int transferIdx = idx++;
const int settingsIdx = idx; const int settingsIdx = idx;
context.setBool("IsBookSelected", selectorIndex == continueIdx); context.setBool("IsBookSelected", selectorIndex == continueIdx);
@ -384,11 +388,11 @@ void HomeActivity::render() {
menuLabels.push_back("Files"); menuLabels.push_back("Files");
menuIcons.push_back("folder"); menuIcons.push_back("folder");
menuSelected.push_back(selectorIndex == fileTransferIdx); menuSelected.push_back(selectorIndex == filesIdx);
menuLabels.push_back("Transfer"); menuLabels.push_back("Transfer");
menuIcons.push_back("transfer"); menuIcons.push_back("transfer");
menuSelected.push_back(false); // Separate from file transfer menuSelected.push_back(selectorIndex == transferIdx);
menuLabels.push_back("Settings"); menuLabels.push_back("Settings");
menuIcons.push_back("settings"); menuIcons.push_back("settings");

View File

@ -67,23 +67,47 @@ Y = 10
Width = 100% Width = 100%
Height = 24 Height = 24
[BatteryIcon] [BatteryContainer]
Parent = StatusBar Parent = StatusBar
Type = Container
X = 400
Y = 3
Width = 28
Height = 18
[BatteryIcon]
Parent = BatteryContainer
Type = Icon Type = Icon
Src = battery Src = battery
X = 400 X = 0
Y = 0
Width = 28 Width = 28
Height = 18 Height = 18
Color = black 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] [BatteryLabel]
Parent = StatusBar Parent = StatusBar
Type = Label Type = Label
Font = UI_10 Font = UI_10
Text = {BatteryPercent}% Text = {BatteryPercent}%
X = 432 X = 432
Y = 3
Width = 48 Width = 48
Height = 20 Height = 18
; --- Recent Books Section --- ; --- Recent Books Section ---
[RecentBooksSection] [RecentBooksSection]
@ -221,34 +245,91 @@ Width = 150
Height = 40 Height = 40
Color = black Color = black
; --- Bottom Hint Bar --- ; --- Bottom Navigation Bar ---
[HintBar] ; Positioned at the very bottom of screen, buttons align with physical buttons
[NavBar]
Parent = Home Parent = Home
Type = HStack Type = Container
X = 60 X = 0
Y = 760 Y = 776
Width = 360 Width = 100%
Height = 30 Height = 24
Spacing = 80
CenterVertical = true
[HintSelect] ; Left button group (OK and Back) - aligned with left physical buttons
Parent = HintBar [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 Type = Icon
Src = check Src = check
Width = 24 X = 30
Height = 24 Y = 6
Width = 20
Height = 12
[HintUp] ; Right button group (Up and Down) - aligned with right physical buttons
Parent = HintBar [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 Type = Icon
Src = up Src = up
Width = 24 X = 30
Height = 24 Y = 6
Width = 20
Height = 12
[HintDown] [NavBtnDown]
Parent = HintBar Parent = NavRightGroup
Type = Container
Width = 80
Height = 24
Border = true
BorderRadius = 8
[NavBtnDownIcon]
Parent = NavBtnDown
Type = Icon Type = Icon
Src = down Src = down
Width = 24 X = 30
Height = 24 Y = 6
Width = 20
Height = 12