|
|
@ -44,19 +44,30 @@ class BookshelfActivity : BaseActivity<BookshelfViewModel>() { |
|
|
|
|
|
|
|
|
|
|
|
private fun upRecyclerData() { |
|
|
|
private fun upRecyclerData() { |
|
|
|
viewModel.bookGroup?.let { |
|
|
|
viewModel.bookGroup?.let { |
|
|
|
|
|
|
|
bookshelfLiveData?.removeObservers(this) |
|
|
|
when (it.groupId) { |
|
|
|
when (it.groupId) { |
|
|
|
-1 -> { |
|
|
|
-1 -> { |
|
|
|
bookshelfLiveData?.removeObservers(this) |
|
|
|
|
|
|
|
bookshelfLiveData = |
|
|
|
bookshelfLiveData = |
|
|
|
LivePagedListBuilder(App.db.bookDao().observeAll(), 10).build() |
|
|
|
LivePagedListBuilder(App.db.bookDao().observeAll(), 10).build() |
|
|
|
bookshelfLiveData?.observe( |
|
|
|
|
|
|
|
this, |
|
|
|
|
|
|
|
Observer { pageList -> bookshelfAdapter.submitList(pageList) }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else -> { |
|
|
|
-2 -> { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
-3 -> { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
|
|
|
|
bookshelfLiveData = |
|
|
|
|
|
|
|
LivePagedListBuilder( |
|
|
|
|
|
|
|
App.db.bookDao().observeByGroup(it.groupId), |
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
).build() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
bookshelfLiveData?.observe( |
|
|
|
|
|
|
|
this, |
|
|
|
|
|
|
|
Observer { pageList -> bookshelfAdapter.submitList(pageList) }) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|