fix(CustomDialog): 🐛 修复 EpubSize可能会溢出
新增 无章节错误信息
This commit is contained in:
@@ -270,7 +270,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
}
|
}
|
||||||
val left = v[0].toInt()
|
val left = v[0].toInt()
|
||||||
val right = v[1].toInt()
|
val right = v[1].toInt()
|
||||||
if (left > right){
|
if (left > right) {
|
||||||
AppLog.put("Error expression : $s; left > right")
|
AppLog.put("Error expression : $s; left > right")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -735,6 +735,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
val useReplace = AppConfig.exportUseReplace && book.getUseReplaceRule()
|
val useReplace = AppConfig.exportUseReplace && book.getUseReplaceRule()
|
||||||
val contentProcessor = ContentProcessor.get(book.name, book.origin)
|
val contentProcessor = ContentProcessor.get(book.name, book.origin)
|
||||||
var chapterList: MutableList<BookChapter> = ArrayList()
|
var chapterList: MutableList<BookChapter> = ArrayList()
|
||||||
|
appDb.bookChapterDao.getChapterList(book.bookUrl)
|
||||||
appDb.bookChapterDao.getChapterList(book.bookUrl).forEachIndexed { index, chapter ->
|
appDb.bookChapterDao.getChapterList(book.bookUrl).forEachIndexed { index, chapter ->
|
||||||
if (scope.indexOf(index) >= 0) {
|
if (scope.indexOf(index) >= 0) {
|
||||||
chapterList.add(chapter)
|
chapterList.add(chapter)
|
||||||
@@ -744,7 +745,13 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val totalChapterNum = book.totalChapterNum / scope.size
|
val totalChapterNum = book.totalChapterNum / scope.size
|
||||||
chapterList = chapterList.subList(epubBookIndex * size, if((epubBookIndex + 1) * size > scope.size) scope.size else (epubBookIndex + 1) * size)
|
if (chapterList.size == 0) {
|
||||||
|
throw RuntimeException("书籍<${book.name}>(${epubBookIndex + 1})未找到章节信息")
|
||||||
|
}
|
||||||
|
chapterList = chapterList.subList(
|
||||||
|
epubBookIndex * size,
|
||||||
|
if ((epubBookIndex + 1) * size > scope.size) scope.size else (epubBookIndex + 1) * size
|
||||||
|
)
|
||||||
chapterList.forEachIndexed { index, chapter ->
|
chapterList.forEachIndexed { index, chapter ->
|
||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
context.upAdapterLiveData.postValue(book.bookUrl)
|
context.upAdapterLiveData.postValue(book.bookUrl)
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
android:id="@+id/et_epub_size"
|
android:id="@+id/et_epub_size"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLength="6"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user