feat: BookInfo button mapping, ManageBook integration, cover regen fix
- Fix BookInfo buttons: Left/Right front = scroll down/up, Confirm = no-op, side buttons retained. Separate Up/Down hints on btn3/btn4. - Fallback load: try epub.load(true, true) when cache-only load fails, so Book Info works for unopened books. - Add "Book Info" to ManageBook menu (BOOK_INFO action) with handlers in all 4 result sites (Home, Recent, FileBrowser, Reader). - Fix HomeActivity cover regen: call generateCoverBmp(false) + validate with isValidThumbnailBmp before falling to placeholder, matching the reader's multi-tier fallback pipeline. Same for XTC branch. Made-with: Cursor
This commit is contained in:
@@ -63,7 +63,10 @@ void BookInfoActivity::onEnter() {
|
||||
|
||||
if (FsHelpers::hasEpubExtension(fileName)) {
|
||||
Epub epub(filePath, "/.crosspoint");
|
||||
if (epub.load(false, true)) {
|
||||
if (!epub.load(false, true)) {
|
||||
epub.load(true, true);
|
||||
}
|
||||
{
|
||||
title = epub.getTitle();
|
||||
author = epub.getAuthor();
|
||||
series = epub.getSeries();
|
||||
@@ -177,8 +180,7 @@ void BookInfoActivity::buildLayout(const std::string& title, const std::string&
|
||||
}
|
||||
|
||||
void BookInfoActivity::loop() {
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Back) ||
|
||||
mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Back)) {
|
||||
ActivityResult r;
|
||||
r.isCancelled = true;
|
||||
setResult(std::move(r));
|
||||
@@ -189,14 +191,18 @@ void BookInfoActivity::loop() {
|
||||
const int pageH = renderer.getScreenHeight();
|
||||
const int scrollStep = pageH / 3;
|
||||
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Down)) {
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Down) ||
|
||||
mappedInput.wasReleased(MappedInputManager::Button::PageForward) ||
|
||||
mappedInput.wasReleased(MappedInputManager::Button::Left)) {
|
||||
if (scrollOffset + pageH < contentHeight) {
|
||||
scrollOffset += scrollStep;
|
||||
requestUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Up)) {
|
||||
if (mappedInput.wasReleased(MappedInputManager::Button::Up) ||
|
||||
mappedInput.wasReleased(MappedInputManager::Button::PageBack) ||
|
||||
mappedInput.wasReleased(MappedInputManager::Button::Right)) {
|
||||
if (scrollOffset > 0) {
|
||||
scrollOffset -= scrollStep;
|
||||
if (scrollOffset < 0) scrollOffset = 0;
|
||||
@@ -252,8 +258,9 @@ void BookInfoActivity::render(RenderLock&&) {
|
||||
|
||||
const bool canScrollDown = scrollOffset + pageH < contentHeight;
|
||||
const bool canScrollUp = scrollOffset > 0;
|
||||
const char* scrollHint = canScrollDown ? tr(STR_DIR_DOWN) : (canScrollUp ? tr(STR_DIR_UP) : "");
|
||||
const auto labels = mappedInput.mapLabels(tr(STR_BACK), "", scrollHint, "");
|
||||
const char* downHint = canScrollDown ? tr(STR_DIR_DOWN) : "";
|
||||
const char* upHint = canScrollUp ? tr(STR_DIR_UP) : "";
|
||||
const auto labels = mappedInput.mapLabels(tr(STR_BACK), "", downHint, upHint);
|
||||
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
||||
|
||||
renderer.displayBuffer();
|
||||
|
||||
Reference in New Issue
Block a user