|
|
@ -95,10 +95,11 @@ class ArrangeBookActivity : VMBaseActivity<ArrangeBookViewModel>(R.layout.activi |
|
|
|
private fun initBookData() { |
|
|
|
private fun initBookData() { |
|
|
|
booksLiveData?.removeObservers(this) |
|
|
|
booksLiveData?.removeObservers(this) |
|
|
|
booksLiveData = |
|
|
|
booksLiveData = |
|
|
|
if (groupId == -1) { |
|
|
|
when (groupId) { |
|
|
|
App.db.bookDao().observeAll() |
|
|
|
-1 -> App.db.bookDao().observeAll() |
|
|
|
} else { |
|
|
|
-2 -> App.db.bookDao().observeLocal() |
|
|
|
App.db.bookDao().observeByGroup(groupId) |
|
|
|
-3 -> App.db.bookDao().observeAudio() |
|
|
|
|
|
|
|
else -> App.db.bookDao().observeByGroup(groupId) |
|
|
|
} |
|
|
|
} |
|
|
|
booksLiveData?.observe(this, Observer { |
|
|
|
booksLiveData?.observe(this, Observer { |
|
|
|
adapter.selectedBooks.clear() |
|
|
|
adapter.selectedBooks.clear() |
|
|
|