diff --git a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt index a11941d97..8a809e701 100644 --- a/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt +++ b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt @@ -120,7 +120,7 @@ class EpubFile(var book: Book) { } resources.add(resource) } while (zipEntry != null) - if (resources.size() > 0) return EpubReader().readEpub(resources) + if (resources.size() > 0) return EpubReader().readEpubBook(resources) } catch (e: Exception) { e.printStackTrace() } diff --git a/epublib/src/main/java/me/ag2s/epublib/domain/EpubBook.java b/epublib/src/main/java/me/ag2s/epublib/domain/EpubBook.java index e21cb0fa5..a0feb3f98 100644 --- a/epublib/src/main/java/me/ag2s/epublib/domain/EpubBook.java +++ b/epublib/src/main/java/me/ag2s/epublib/domain/EpubBook.java @@ -5,4 +5,5 @@ package me.ag2s.epublib.domain; */ @SuppressWarnings("unused declaration") public class EpubBook extends Book { + } diff --git a/epublib/src/main/java/me/ag2s/epublib/epub/EpubReader.java b/epublib/src/main/java/me/ag2s/epublib/epub/EpubReader.java index fe9411d09..361fe8527 100644 --- a/epublib/src/main/java/me/ag2s/epublib/epub/EpubReader.java +++ b/epublib/src/main/java/me/ag2s/epublib/epub/EpubReader.java @@ -14,6 +14,7 @@ import java.util.zip.ZipInputStream; import me.ag2s.epublib.Constants; import me.ag2s.epublib.domain.Book; +import me.ag2s.epublib.domain.EpubBook; import me.ag2s.epublib.domain.MediaType; import me.ag2s.epublib.domain.MediaTypes; import me.ag2s.epublib.domain.Resource; @@ -30,7 +31,7 @@ public class EpubReader { private static final String TAG = EpubReader.class.getName(); private final BookProcessor bookProcessor = BookProcessor.IDENTITY_BOOKPROCESSOR; - + @SuppressWarnings("unused") public Book readEpub(InputStream in) throws IOException { return readEpub(in, Constants.CHARACTER_ENCODING); } @@ -97,9 +98,13 @@ public class EpubReader { return readEpub(resources); } + @SuppressWarnings("unused") public Book readEpub(Resources resources) { return readEpub(resources, new Book()); } + public EpubBook readEpubBook(Resources resources) { + return (EpubBook) readEpub(resources, new Book()); + } public Book readEpub(Resources resources, Book result) { if (result == null) {