pull/1125/head
gedoor 4 years ago
parent bf7aa99e25
commit cffb2ff740
  1. 20
      app/src/main/java/io/legado/app/model/localBook/LocalBook.kt

@ -26,24 +26,32 @@ object LocalBook {
} }
fun getChapterList(book: Book): ArrayList<BookChapter> { fun getChapterList(book: Book): ArrayList<BookChapter> {
return if (book.isEpub()) { return when {
book.isEpub() -> {
EpubFile.getChapterList(book) EpubFile.getChapterList(book)
}else if(book.isUmd()){ }
book.isUmd() -> {
UmdFile.getChapterList(book) UmdFile.getChapterList(book)
} else { }
else -> {
AnalyzeTxtFile().analyze(book) AnalyzeTxtFile().analyze(book)
} }
} }
}
fun getContext(book: Book, chapter: BookChapter): String? { fun getContext(book: Book, chapter: BookChapter): String? {
return if (book.isEpub()) { return when {
book.isEpub() -> {
EpubFile.getContent(book, chapter) EpubFile.getContent(book, chapter)
}else if (book.isUmd()){ }
book.isUmd() -> {
UmdFile.getContent(book, chapter) UmdFile.getContent(book, chapter)
} else { }
else -> {
AnalyzeTxtFile.getContent(book, chapter) AnalyzeTxtFile.getContent(book, chapter)
} }
} }
}
fun importFile(uri: Uri): Book { fun importFile(uri: Uri): Book {
val path: String val path: String

Loading…
Cancel
Save