Add end of book actions screen
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "CrossPointSettings.h"
|
||||
#include "CrossPointState.h"
|
||||
#include "FinishedBookActivity.h"
|
||||
#include "MappedInputManager.h"
|
||||
#include "MdReaderTocSelectionActivity.h"
|
||||
#include "ReaderActivity.h"
|
||||
@@ -276,7 +277,44 @@ void MdReaderActivity::loop() {
|
||||
currentHeadingIndex = getHeadingIndexForOffset(pageOffsets[currentPage]);
|
||||
requestUpdate();
|
||||
} else {
|
||||
onGoHome();
|
||||
saveProgress();
|
||||
const std::string currentBookPath = txt ? txt->getPath() : std::string();
|
||||
const std::string nextBookPath =
|
||||
BookFinished::findNextBookInDirectory(currentBookPath, std::string(), std::string());
|
||||
startActivityForResult(
|
||||
std::make_unique<FinishedBookActivity>(renderer, mappedInput, currentBookPath, nextBookPath,
|
||||
SETTINGS.moveFinishedBooksToCompleted),
|
||||
[this, currentBookPath, nextBookPath](const ActivityResult& result) {
|
||||
if (result.isCancelled) {
|
||||
requestUpdate();
|
||||
return;
|
||||
}
|
||||
const auto& menuResult = std::get<MenuResult>(result.data);
|
||||
if (menuResult.action == static_cast<int>(BookFinished::FinishedBookAction::GoHome)) {
|
||||
if (SETTINGS.moveFinishedBooksToCompleted) {
|
||||
std::string movedPath;
|
||||
BookFinished::moveFinishedBookToCompleted(currentBookPath, movedPath);
|
||||
}
|
||||
if (SETTINGS.removeFinishedBooksFromRecents) {
|
||||
RECENT_BOOKS.removeBook(currentBookPath);
|
||||
}
|
||||
activityManager.goHome();
|
||||
return;
|
||||
}
|
||||
if (menuResult.action == static_cast<int>(BookFinished::FinishedBookAction::OpenNextBook) &&
|
||||
!nextBookPath.empty()) {
|
||||
if (SETTINGS.moveFinishedBooksToCompleted) {
|
||||
std::string movedPath;
|
||||
BookFinished::moveFinishedBookToCompleted(currentBookPath, movedPath);
|
||||
}
|
||||
if (SETTINGS.removeFinishedBooksFromRecents) {
|
||||
RECENT_BOOKS.removeBook(currentBookPath);
|
||||
}
|
||||
activityManager.goToReader(nextBookPath);
|
||||
return;
|
||||
}
|
||||
requestUpdate();
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user