Long-pressing Confirm on a book file in MyLibraryActivity or RecentBooksActivity opens the BookManageMenuActivity popup with Archive/Delete/Delete Cache/Reindex options. Actions are executed via BookManager and the file list is refreshed afterward. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#pragma once
|
|
#include <I18n.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "../ActivityWithSubactivity.h"
|
|
#include "RecentBooksStore.h"
|
|
#include "util/ButtonNavigator.h"
|
|
|
|
class RecentBooksActivity final : public ActivityWithSubactivity {
|
|
private:
|
|
ButtonNavigator buttonNavigator;
|
|
|
|
size_t selectorIndex = 0;
|
|
|
|
// Recent tab state
|
|
std::vector<RecentBook> recentBooks;
|
|
|
|
// Long-press state
|
|
bool ignoreNextConfirmRelease = false;
|
|
static constexpr unsigned long LONG_PRESS_MS = 700;
|
|
|
|
// Callbacks
|
|
const std::function<void(const std::string& path)> onSelectBook;
|
|
const std::function<void()> onGoHome;
|
|
|
|
// Data loading
|
|
void loadRecentBooks();
|
|
void openManageMenu(const std::string& bookPath);
|
|
|
|
public:
|
|
explicit RecentBooksActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
|
|
const std::function<void()>& onGoHome,
|
|
const std::function<void(const std::string& path)>& onSelectBook)
|
|
: ActivityWithSubactivity("RecentBooks", renderer, mappedInput), onSelectBook(onSelectBook), onGoHome(onGoHome) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
void render(Activity::RenderLock&&) override;
|
|
};
|