Support png and jpg in Image Viewer
This commit is contained in:
@@ -31,7 +31,9 @@ bool ReaderActivity::isTxtFile(const std::string& path) {
|
||||
FsHelpers::hasMarkdownExtension(path); // Treat .md as txt files (until we have a markdown reader)
|
||||
}
|
||||
|
||||
bool ReaderActivity::isBmpFile(const std::string& path) { return FsHelpers::hasBmpExtension(path); }
|
||||
bool ReaderActivity::isImageFile(const std::string& path) {
|
||||
return FsHelpers::hasBmpExtension(path) || FsHelpers::hasJpgExtension(path) || FsHelpers::hasPngExtension(path);
|
||||
}
|
||||
|
||||
std::unique_ptr<Epub> ReaderActivity::loadEpub(const std::string& path) {
|
||||
if (!Storage.exists(path.c_str())) {
|
||||
@@ -120,7 +122,7 @@ void ReaderActivity::onEnter() {
|
||||
}
|
||||
|
||||
currentBookPath = initialBookPath;
|
||||
if (isBmpFile(initialBookPath)) {
|
||||
if (isImageFile(initialBookPath)) {
|
||||
onGoToBmpViewer(initialBookPath);
|
||||
} else if (isXtcFile(initialBookPath)) {
|
||||
renderer.clearScreen();
|
||||
|
||||
@@ -16,7 +16,7 @@ class ReaderActivity final : public Activity {
|
||||
static std::unique_ptr<Txt> loadTxt(const std::string& path);
|
||||
static bool isXtcFile(const std::string& path);
|
||||
static bool isTxtFile(const std::string& path);
|
||||
static bool isBmpFile(const std::string& path);
|
||||
static bool isImageFile(const std::string& path);
|
||||
|
||||
static std::string extractFolderPath(const std::string& filePath);
|
||||
void goToLibrary(const std::string& fromBookPath = "");
|
||||
|
||||
Reference in New Issue
Block a user