优化
This commit is contained in:
@@ -180,9 +180,11 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
|
|||||||
customView { alertBinding.root }
|
customView { alertBinding.root }
|
||||||
okButton {
|
okButton {
|
||||||
alertBinding.apply {
|
alertBinding.apply {
|
||||||
|
var notifyMain = false
|
||||||
|
var recreate = false
|
||||||
if (AppConfig.bookGroupStyle != spGroupStyle.selectedItemPosition) {
|
if (AppConfig.bookGroupStyle != spGroupStyle.selectedItemPosition) {
|
||||||
AppConfig.bookGroupStyle = spGroupStyle.selectedItemPosition
|
AppConfig.bookGroupStyle = spGroupStyle.selectedItemPosition
|
||||||
postEvent(EventBus.NOTIFY_MAIN, false)
|
notifyMain = true
|
||||||
}
|
}
|
||||||
if (AppConfig.showUnread != swShowUnread.isChecked) {
|
if (AppConfig.showUnread != swShowUnread.isChecked) {
|
||||||
AppConfig.showUnread = swShowUnread.isChecked
|
AppConfig.showUnread = swShowUnread.isChecked
|
||||||
@@ -211,7 +213,12 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
|
|||||||
} else {
|
} else {
|
||||||
activityViewModel.booksListRecycledViewPool.clear()
|
activityViewModel.booksListRecycledViewPool.clear()
|
||||||
}
|
}
|
||||||
|
recreate = true
|
||||||
|
}
|
||||||
|
if (recreate) {
|
||||||
postEvent(EventBus.RECREATE, "")
|
postEvent(EventBus.RECREATE, "")
|
||||||
|
} else if (notifyMain) {
|
||||||
|
postEvent(EventBus.NOTIFY_MAIN, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user