|
|
@ -16,7 +16,8 @@ import io.legado.app.lib.theme.ATH |
|
|
|
import kotlinx.android.synthetic.main.fragment_find_book.* |
|
|
|
import kotlinx.android.synthetic.main.fragment_find_book.* |
|
|
|
import kotlinx.android.synthetic.main.view_title_bar.* |
|
|
|
import kotlinx.android.synthetic.main.view_title_bar.* |
|
|
|
|
|
|
|
|
|
|
|
class FindBookFragment : BaseFragment(R.layout.fragment_find_book) { |
|
|
|
class FindBookFragment : BaseFragment(R.layout.fragment_find_book), |
|
|
|
|
|
|
|
FindBookAdapter.CallBack { |
|
|
|
|
|
|
|
|
|
|
|
private lateinit var adapter: FindBookAdapter |
|
|
|
private lateinit var adapter: FindBookAdapter |
|
|
|
private var findLiveData: LiveData<PagedList<BookSource>>? = null |
|
|
|
private var findLiveData: LiveData<PagedList<BookSource>>? = null |
|
|
@ -34,7 +35,7 @@ class FindBookFragment : BaseFragment(R.layout.fragment_find_book) { |
|
|
|
private fun initRecyclerView() { |
|
|
|
private fun initRecyclerView() { |
|
|
|
ATH.applyEdgeEffectColor(rv_find) |
|
|
|
ATH.applyEdgeEffectColor(rv_find) |
|
|
|
rv_find.layoutManager = LinearLayoutManager(context) |
|
|
|
rv_find.layoutManager = LinearLayoutManager(context) |
|
|
|
adapter = FindBookAdapter(this) |
|
|
|
adapter = FindBookAdapter(this, this) |
|
|
|
rv_find.adapter = adapter |
|
|
|
rv_find.adapter = adapter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -43,4 +44,8 @@ class FindBookFragment : BaseFragment(R.layout.fragment_find_book) { |
|
|
|
findLiveData = LivePagedListBuilder(App.db.bookSourceDao().observeFind(), 2000).build() |
|
|
|
findLiveData = LivePagedListBuilder(App.db.bookSourceDao().observeFind(), 2000).build() |
|
|
|
findLiveData?.observe(viewLifecycleOwner, Observer { adapter.submitList(it) }) |
|
|
|
findLiveData?.observe(viewLifecycleOwner, Observer { adapter.submitList(it) }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun scrollTo(pos: Int) { |
|
|
|
|
|
|
|
rv_find.scrollToPosition(pos) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |