pull/32/head
kunfei 5 years ago
parent 56671dab43
commit f1d5d0330d
  1. 16
      app/src/main/java/io/legado/app/data/entities/Book.kt
  2. 26
      app/src/main/java/io/legado/app/data/entities/SearchBook.kt
  3. 3
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt

@ -89,4 +89,20 @@ data class Book(
}
return kindList
}
fun toSearchBook(): SearchBook {
return SearchBook(
name = name,
author = author,
kind = kind,
bookUrl = bookUrl,
origin = origin,
originName = originName,
wordCount = wordCount,
latestChapterTitle = latestChapterTitle,
coverUrl = coverUrl,
intro = intro,
tocUrl = tocUrl
)
}
}

@ -57,18 +57,18 @@ data class SearchBook(
}
fun toBook(): Book {
val book = Book()
book.name = name
book.author = author
book.kind = kind
book.bookUrl = bookUrl
book.origin = origin
book.originName = originName
book.wordCount = wordCount
book.latestChapterTitle = latestChapterTitle
book.coverUrl = coverUrl
book.intro = intro
book.tocUrl = tocUrl
return book
return Book(
name = name,
author = author,
kind = kind,
bookUrl = bookUrl,
origin = origin,
originName = originName,
wordCount = wordCount,
latestChapterTitle = latestChapterTitle,
coverUrl = coverUrl,
intro = intro,
tocUrl = tocUrl
)
}
}

@ -67,7 +67,8 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
.onSuccess(Dispatchers.IO) {
it?.let {
if (it.isNotEmpty()) {
book.latestChapterTitle = it.last().title
searchBooks.add(book.toSearchBook())
}
}
}.onError {

Loading…
Cancel
Save