mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
99a8cc807f
commit
cae5ea4eae
@ -28,33 +28,24 @@ class RemoteBookActivity : VMBaseActivity<ActivityRemoteBookBinding,RemoteBookVi
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
initView()
|
||||
// initEvent()
|
||||
initData()
|
||||
// toastOnUi("远程书籍")
|
||||
onFinally()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private fun initView() {
|
||||
binding.recyclerView.layoutManager = LinearLayoutManager(this)
|
||||
binding.recyclerView.adapter = adapter
|
||||
}
|
||||
private fun initData() {
|
||||
binding.refreshProgressBar.isAutoLoading = true
|
||||
viewModel.loadRemoteBookList()
|
||||
launch {
|
||||
viewModel.dataFlow.conflate().collect { remoteBooks ->
|
||||
adapter.setItems(remoteBooks)
|
||||
}
|
||||
binding.refreshProgressBar.isAutoLoading = false
|
||||
}
|
||||
viewModel.loadRemoteBookList()
|
||||
}
|
||||
|
||||
private fun onFinally() {
|
||||
|
||||
}
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun addToBookshelf(remoteBook: RemoteBook) {
|
||||
viewModel.addToBookshelf(remoteBook){
|
||||
|
Loading…
Reference in New Issue
Block a user