pull/1013/head
gedoor 4 years ago
parent 6e69efb34e
commit 971dc3f2c5
  1. 2
      app/build.gradle
  2. 8
      app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt

@ -181,7 +181,7 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.9.1' implementation 'com.squareup.okhttp3:okhttp:4.9.1'
//Glide //Glide
implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'com.github.bumptech.glide:glide:4.12.0'
//webServer //webServer
implementation 'org.nanohttpd:nanohttpd:2.3.1' implementation 'org.nanohttpd:nanohttpd:2.3.1'

@ -107,10 +107,12 @@ object BookChapterList {
} }
val lh = LinkedHashSet(chapterList) val lh = LinkedHashSet(chapterList)
val list = ArrayList(lh) val list = ArrayList(lh)
list.reverse() if (!book.getReverseToc()) {
list.reverse()
}
Debug.log(book.origin, "◇目录总数:${list.size}") Debug.log(book.origin, "◇目录总数:${list.size}")
for ((index, item) in list.withIndex()) { list.forEachIndexed { index, bookChapter ->
item.index = index bookChapter.index = index
} }
book.latestChapterTitle = list.last().title book.latestChapterTitle = list.last().title
book.durChapterTitle = book.durChapterTitle =

@ -25,7 +25,7 @@ class TocViewModel(application: Application) : BaseViewModel(application) {
fun reverseToc() { fun reverseToc() {
execute { execute {
bookData.value?.let { bookData.value?.let {
it.setReverseToc(it.getReverseToc()) it.setReverseToc(!it.getReverseToc())
val toc = appDb.bookChapterDao.getChapterList(bookUrl) val toc = appDb.bookChapterDao.getChapterList(bookUrl)
val newToc = toc.reversed() val newToc = toc.reversed()
newToc.forEachIndexed { index, bookChapter -> newToc.forEachIndexed { index, bookChapter ->

Loading…
Cancel
Save