feat: 优化代码

pull/182/head
kunfei 5 years ago
parent e890564a9a
commit a6937bd434
  1. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt

@ -120,7 +120,7 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
if (AppConfig.bookGroupAudioShow) { if (AppConfig.bookGroupAudioShow) {
bookGroups.add(AppConst.bookGroupAudio) bookGroups.add(AppConst.bookGroupAudio)
} }
showGroupNone = if (App.db.bookDao().noGroupSize > 0) { showGroupNone = if (App.db.bookDao().noGroupSize > 0 && it.isNotEmpty()) {
bookGroups.add(AppConst.bookGroupNone) bookGroups.add(AppConst.bookGroupNone)
true true
} else { } else {
@ -166,7 +166,8 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
bookGroups.remove(AppConst.bookGroupLocal) bookGroups.remove(AppConst.bookGroupLocal)
bookGroups.remove(AppConst.bookGroupAudio) bookGroups.remove(AppConst.bookGroupAudio)
bookGroups.remove(AppConst.bookGroupNone) bookGroups.remove(AppConst.bookGroupNone)
showGroupNone = if (App.db.bookDao().noGroupSize > 0) { showGroupNone =
if (App.db.bookDao().noGroupSize > 0 && bookGroups.isNotEmpty()) {
bookGroups.add(0, AppConst.bookGroupNone) bookGroups.add(0, AppConst.bookGroupNone)
true true
} else { } else {

Loading…
Cancel
Save