Horis 3 lat temu
rodzic
commit
d5ade4d1fb

+ 7 - 6
app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BaseBooksAdapter.kt

@@ -56,6 +56,9 @@ abstract class BaseBooksAdapter<VB : ViewBinding>(context: Context) :
                 ) {
                     bundle.putBoolean("refresh", true)
                 }
+                if (oldItem.latestChapterTime != newItem.latestChapterTime) {
+                    bundle.putBoolean("lastUpdateTime", true)
+                }
                 if (bundle.isEmpty) return null
                 return bundle
             }
@@ -63,12 +66,10 @@ abstract class BaseBooksAdapter<VB : ViewBinding>(context: Context) :
         }
 
     fun notification(bookUrl: String) {
-        for (i in 0 until itemCount) {
-            getItem(i)?.let {
-                if (it.bookUrl == bookUrl) {
-                    notifyItemChanged(i, bundleOf(Pair("refresh", null), Pair("lastUpdateTime", null)))
-                    return
-                }
+        getItems().forEachIndexed { i, it ->
+            if (it.bookUrl == bookUrl) {
+                notifyItemChanged(i, bundleOf(Pair("refresh", null), Pair("lastUpdateTime", null)))
+                return
             }
         }
     }