|
|
@ -18,27 +18,27 @@ import java.util.ArrayList |
|
|
|
|
|
|
|
|
|
|
|
class UmdFile(var book: Book) { |
|
|
|
class UmdFile(var book: Book) { |
|
|
|
companion object { |
|
|
|
companion object { |
|
|
|
private var eFile: UmdFile? = null |
|
|
|
private var uFile: UmdFile? = null |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
private fun getEFile(book: Book): UmdFile { |
|
|
|
private fun getUFile(book: Book): UmdFile { |
|
|
|
|
|
|
|
|
|
|
|
if (eFile == null || eFile?.book?.bookUrl != book.bookUrl) { |
|
|
|
if (uFile == null || uFile?.book?.bookUrl != book.bookUrl) { |
|
|
|
eFile = UmdFile(book) |
|
|
|
uFile = UmdFile(book) |
|
|
|
return eFile!! |
|
|
|
return uFile!! |
|
|
|
} |
|
|
|
} |
|
|
|
eFile?.book = book |
|
|
|
uFile?.book = book |
|
|
|
return eFile!! |
|
|
|
return uFile!! |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
fun getChapterList(book: Book): ArrayList<BookChapter> { |
|
|
|
fun getChapterList(book: Book): ArrayList<BookChapter> { |
|
|
|
return getEFile(book).getChapterList() |
|
|
|
return getUFile(book).getChapterList() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
fun getContent(book: Book, chapter: BookChapter): String? { |
|
|
|
fun getContent(book: Book, chapter: BookChapter): String? { |
|
|
|
return getEFile(book).getContent(chapter) |
|
|
|
return getUFile(book).getContent(chapter) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
@ -46,13 +46,13 @@ class UmdFile(var book: Book) { |
|
|
|
book: Book, |
|
|
|
book: Book, |
|
|
|
href: String |
|
|
|
href: String |
|
|
|
): InputStream? { |
|
|
|
): InputStream? { |
|
|
|
return getEFile(book).getImage(href) |
|
|
|
return getUFile(book).getImage(href) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
fun upBookInfo(book: Book) { |
|
|
|
fun upBookInfo(book: Book) { |
|
|
|
return getEFile(book).upBookInfo() |
|
|
|
return getUFile(book).upBookInfo() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -100,7 +100,7 @@ class UmdFile(var book: Book) { |
|
|
|
|
|
|
|
|
|
|
|
private fun upBookInfo() { |
|
|
|
private fun upBookInfo() { |
|
|
|
if(umdBook==null){ |
|
|
|
if(umdBook==null){ |
|
|
|
eFile = null |
|
|
|
uFile = null |
|
|
|
book.intro = "书籍导入异常" |
|
|
|
book.intro = "书籍导入异常" |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
val hd= umdBook!!.header |
|
|
|
val hd= umdBook!!.header |
|
|
@ -115,7 +115,7 @@ class UmdFile(var book: Book) { |
|
|
|
|
|
|
|
|
|
|
|
private fun getChapterList(): ArrayList<BookChapter> { |
|
|
|
private fun getChapterList(): ArrayList<BookChapter> { |
|
|
|
val chapterList = ArrayList<BookChapter>() |
|
|
|
val chapterList = ArrayList<BookChapter>() |
|
|
|
umdBook?.chapters?.titles?.forEachIndexed { index, bytes -> |
|
|
|
umdBook?.chapters?.titles?.forEachIndexed { index, _ -> |
|
|
|
val title = umdBook!!.chapters.getTitle(index) |
|
|
|
val title = umdBook!!.chapters.getTitle(index) |
|
|
|
val chapter = BookChapter() |
|
|
|
val chapter = BookChapter() |
|
|
|
chapter.title=title; |
|
|
|
chapter.title=title; |
|
|
|