pull/737/head
Robot 4 years ago
commit 883f8fdf31
  1. 3
      app/src/main/java/io/legado/app/base/adapter/CommonRecyclerAdapter.kt
  2. 9
      app/src/main/java/io/legado/app/service/help/ReadBook.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@ -174,8 +174,7 @@ abstract class CommonRecyclerAdapter<ITEM, VB : ViewBinding>(protected val conte
val srcPosition = oldPosition + getHeaderCount() val srcPosition = oldPosition + getHeaderCount()
val targetPosition = newPosition + getHeaderCount() val targetPosition = newPosition + getHeaderCount()
Collections.swap(this.items, srcPosition, targetPosition) Collections.swap(this.items, srcPosition, targetPosition)
notifyItemChanged(srcPosition) notifyItemMoved(srcPosition, targetPosition)
notifyItemChanged(targetPosition)
} }
} }
} }

@ -90,10 +90,11 @@ object ReadBook {
nextTextChapter = null nextTextChapter = null
} }
fun uploadProgress() { fun uploadProgress(syncBookProgress: Boolean = AppConfig.syncBookProgress) {
if (!AppConfig.syncBookProgress) return if (syncBookProgress) {
book?.let { book?.let {
BookWebDav.uploadBookProgress(it) BookWebDav.uploadBookProgress(it)
}
} }
} }

@ -162,8 +162,8 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
} }
} }
fun syncBookProgress(book: Book) { fun syncBookProgress(book: Book, syncBookProgress: Boolean = AppConfig.syncBookProgress) {
if (!AppConfig.syncBookProgress) if (syncBookProgress)
execute { execute {
BookWebDav.getBookProgress(book)?.let { progress -> BookWebDav.getBookProgress(book)?.let { progress ->
if (progress.durChapterIndex < book.durChapterIndex || if (progress.durChapterIndex < book.durChapterIndex ||

Loading…
Cancel
Save