Przeglądaj źródła

天是天禄的天

HapeLee 1 rok temu
rodzic
commit
ba4f8e23a2

+ 2 - 2
app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt

@@ -184,8 +184,8 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
     }
 
     fun upBookSort(sort: Int) {
-        if (!isAdded || view == null) return
         binding.root.post {
+            if (!isAdded || view == null) return@post
             arguments?.putInt("bookSort", sort)
             bookSort = sort
             upRecyclerData()
@@ -246,7 +246,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
                 binding.emptyView.isGone = list.isNotEmpty()
                 binding.refreshLayout.isEnabled = enableRefresh && list.isNotEmpty()
                 booksAdapter.setItems(list)
-                delay(100)
+                delay(500)
             }
         }
     }

+ 2 - 0
app/src/main/java/io/legado/app/ui/main/bookshelf/books/BookshelfFragment2.kt

@@ -51,6 +51,7 @@ import io.legado.app.utils.showDialogFragment
 import io.legado.app.utils.viewbindingdelegate.viewBinding
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
+import kotlinx.coroutines.delay
 import kotlinx.coroutines.flow.catch
 import kotlinx.coroutines.flow.conflate
 import kotlinx.coroutines.flow.flowOn
@@ -303,6 +304,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
                 booksAdapter.updateItems()
                 binding.emptyView.isGone = getItemCount() > 0
                 binding.refreshLayout.isEnabled = enableRefresh && getItemCount() > 0
+                delay(500)
             }
         }
     }