A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Invert colors on home screen cover overlay when recent book is selected (#390)

## Summary

* Fixes #388

## Additional Context

* Tested on my own device
* See images at #388 for what home screen looked like before.
* With this PR the home screen shows the following (selected and
unselected recent book × cover image rendered or not)


![Picsew_20260115153419](https://github.com/user-attachments/assets/44193f9d-76b7-4c77-b890-72b0dbae01c4)


---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? **YES**

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

authored by

Luke Stein
copilot-swe-agent[bot]
and committed by
GitHub
7a792a53 f69cddf2

+15 -11
+15 -11
src/activities/home/HomeActivity.cpp
··· 325 325 } 326 326 327 327 if (hasContinueReading) { 328 + // Invert text colors based on selection state: 329 + // - With cover: selected = white text on black box, unselected = black text on white box 330 + // - Without cover: selected = white text on black card, unselected = black text on white card 331 + 328 332 // Split into words (avoid stringstream to keep this light on the MCU) 329 333 std::vector<std::string> words; 330 334 words.reserve(8); ··· 407 411 // Vertically center the title block within the card 408 412 int titleYStart = bookY + (bookHeight - totalTextHeight) / 2; 409 413 410 - // If cover image was rendered, draw white box behind title and author 414 + // If cover image was rendered, draw box behind title and author 411 415 if (coverRendered) { 412 416 constexpr int boxPadding = 8; 413 417 // Calculate the max text width for the box ··· 438 442 const int boxX = (pageWidth - boxWidth) / 2; 439 443 const int boxY = titleYStart - boxPadding; 440 444 441 - // Draw white filled box 442 - renderer.fillRect(boxX, boxY, boxWidth, boxHeight, false); 443 - // Draw black border around the box 444 - renderer.drawRect(boxX, boxY, boxWidth, boxHeight, true); 445 + // Draw box (inverted when selected: black box instead of white) 446 + renderer.fillRect(boxX, boxY, boxWidth, boxHeight, bookSelected); 447 + // Draw border around the box (inverted when selected: white border instead of black) 448 + renderer.drawRect(boxX, boxY, boxWidth, boxHeight, !bookSelected); 445 449 } 446 450 447 451 for (const auto& line : lines) { 448 - renderer.drawCenteredText(UI_12_FONT_ID, titleYStart, line.c_str(), !bookSelected || coverRendered); 452 + renderer.drawCenteredText(UI_12_FONT_ID, titleYStart, line.c_str(), !bookSelected); 449 453 titleYStart += renderer.getLineHeight(UI_12_FONT_ID); 450 454 } 451 455 ··· 466 470 } 467 471 trimmedAuthor.append("..."); 468 472 } 469 - renderer.drawCenteredText(UI_10_FONT_ID, titleYStart, trimmedAuthor.c_str(), !bookSelected || coverRendered); 473 + renderer.drawCenteredText(UI_10_FONT_ID, titleYStart, trimmedAuthor.c_str(), !bookSelected); 470 474 } 471 475 472 476 // "Continue Reading" label at the bottom 473 477 const int continueY = bookY + bookHeight - renderer.getLineHeight(UI_10_FONT_ID) * 3 / 2; 474 478 if (coverRendered) { 475 - // Draw white box behind "Continue Reading" text 479 + // Draw box behind "Continue Reading" text (inverted when selected: black box instead of white) 476 480 const char* continueText = "Continue Reading"; 477 481 const int continueTextWidth = renderer.getTextWidth(UI_10_FONT_ID, continueText); 478 482 constexpr int continuePadding = 6; ··· 480 484 const int continueBoxHeight = renderer.getLineHeight(UI_10_FONT_ID) + continuePadding; 481 485 const int continueBoxX = (pageWidth - continueBoxWidth) / 2; 482 486 const int continueBoxY = continueY - continuePadding / 2; 483 - renderer.fillRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, false); 484 - renderer.drawRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, true); 485 - renderer.drawCenteredText(UI_10_FONT_ID, continueY, continueText, true); 487 + renderer.fillRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, bookSelected); 488 + renderer.drawRect(continueBoxX, continueBoxY, continueBoxWidth, continueBoxHeight, !bookSelected); 489 + renderer.drawCenteredText(UI_10_FONT_ID, continueY, continueText, !bookSelected); 486 490 } else { 487 491 renderer.drawCenteredText(UI_10_FONT_ID, continueY, "Continue Reading", !bookSelected); 488 492 }