优化
This commit is contained in:
@@ -92,7 +92,6 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
|||||||
upBottomMenu()
|
upBottomMenu()
|
||||||
initView()
|
initView()
|
||||||
upHomePage()
|
upHomePage()
|
||||||
viewModel.deleteNotShelfBook()
|
|
||||||
onBackPressedDispatcher.addCallback(this) {
|
onBackPressedDispatcher.addCallback(this) {
|
||||||
if (pagePosition != 0) {
|
if (pagePosition != 0) {
|
||||||
binding.viewPagerMain.currentItem = 0
|
binding.viewPagerMain.currentItem = 0
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
setMaxRecycledViews(0, 100)
|
setMaxRecycledViews(0, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
deleteNotShelfBook()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCleared() {
|
override fun onCleared() {
|
||||||
super.onCleared()
|
super.onCleared()
|
||||||
upTocPool.close()
|
upTocPool.close()
|
||||||
@@ -247,7 +251,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteNotShelfBook() {
|
private fun deleteNotShelfBook() {
|
||||||
execute {
|
execute {
|
||||||
appDb.bookDao.deleteNotShelfBook()
|
appDb.bookDao.deleteNotShelfBook()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user