|
|
@@ -8,6 +8,7 @@ import android.view.ViewGroup
|
|
|
import android.widget.ImageView
|
|
|
import android.widget.PopupMenu
|
|
|
import androidx.core.os.bundleOf
|
|
|
+import androidx.core.view.doOnLayout
|
|
|
import androidx.recyclerview.widget.DiffUtil
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import io.legado.app.R
|
|
|
@@ -29,8 +30,11 @@ import io.legado.app.utils.visible
|
|
|
import java.util.Collections
|
|
|
|
|
|
|
|
|
-class BookSourceAdapter(context: Context, val callBack: CallBack) :
|
|
|
- RecyclerAdapter<BookSourcePart, ItemBookSourceBinding>(context),
|
|
|
+class BookSourceAdapter(
|
|
|
+ context: Context,
|
|
|
+ private val callBack: CallBack,
|
|
|
+ private val recyclerView: RecyclerView
|
|
|
+) : RecyclerAdapter<BookSourcePart, ItemBookSourceBinding>(context),
|
|
|
ItemTouchCallback.Callback {
|
|
|
|
|
|
private val selected = linkedSetOf<BookSourcePart>()
|
|
|
@@ -154,10 +158,8 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) :
|
|
|
|
|
|
override fun onCurrentListChanged() {
|
|
|
callBack.upCountView()
|
|
|
- if (showSourceHost) {
|
|
|
- handler.post {
|
|
|
- notifyItemRangeChanged(0, itemCount, bundleOf("upSourceHost" to null))
|
|
|
- }
|
|
|
+ recyclerView.doOnLayout {
|
|
|
+ notifyItemRangeChanged(0, itemCount, bundleOf("upSourceHost" to null))
|
|
|
}
|
|
|
}
|
|
|
|