pull/32/head
kunfei 5 years ago
parent 4a34a78816
commit b58d9de224
  1. 8
      app/src/main/java/io/legado/app/ui/main/explore/FindBookAdapter.kt
  2. 4
      app/src/main/java/io/legado/app/ui/main/explore/FindBookFragment.kt

@ -28,13 +28,11 @@ class FindBookAdapter(context: Context, private val scope: CoroutineScope, val c
tv_name.text = item.bookSourceName
ll_title.onClick {
val oldEx = exIndex
if (exIndex == holder.layoutPosition) {
exIndex = -1
} else {
exIndex = holder.layoutPosition
exIndex = if (exIndex == holder.layoutPosition) -1 else holder.layoutPosition
notifyItemChanged(oldEx, false)
if (exIndex != -1) {
notifyItemChanged(holder.layoutPosition, false)
}
notifyItemChanged(oldEx, false)
callBack.scrollTo(holder.layoutPosition)
}
}

@ -18,6 +18,7 @@ class FindBookFragment : BaseFragment(R.layout.fragment_find_book),
FindBookAdapter.CallBack {
private lateinit var adapter: FindBookAdapter
private lateinit var linearLayoutManager: LinearLayoutManager
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
setSupportToolbar(toolbar)
@ -31,7 +32,8 @@ class FindBookFragment : BaseFragment(R.layout.fragment_find_book),
private fun initRecyclerView() {
ATH.applyEdgeEffectColor(rv_find)
rv_find.layoutManager = LinearLayoutManager(context)
linearLayoutManager = LinearLayoutManager(context)
rv_find.layoutManager = linearLayoutManager
adapter = FindBookAdapter(requireContext(), this, this)
rv_find.adapter = adapter
}

Loading…
Cancel
Save