feat: 优化代码

pull/190/head
kunfei 5 years ago
parent 8f88574fb3
commit af95e19788
  1. 4
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt
  2. 10
      app/src/main/res/menu/book_group_manage.xml

@ -110,8 +110,10 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
}
var noGroupSize = 0
withContext(IO) {
if (AppConfig.bookGroupNoneShow) {
noGroupSize = App.db.bookDao().noGroupSize
}
}
synchronized(this@BookshelfFragment) {
bookGroups.clear()
if (AppConfig.bookGroupAllShow) {
@ -162,8 +164,10 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
launch {
var noGroupSize = 0
withContext(IO) {
if (AppConfig.bookGroupNoneShow) {
noGroupSize = App.db.bookDao().noGroupSize
}
}
synchronized(this@BookshelfFragment) {
bookGroups.remove(AppConst.bookGroupAll)
bookGroups.remove(AppConst.bookGroupLocal)

@ -10,6 +10,8 @@
app:showAsAction="always"
tools:ignore="AlwaysShowAction" />
<group android:id="@+id/menu_groups">
<item
android:id="@+id/menu_group_all"
android:title="@string/all"
@ -21,21 +23,23 @@
android:id="@+id/menu_group_local"
android:title="@string/local"
android:checkable="true"
android:checked="true"
android:checked="false"
app:showAsAction="never" />
<item
android:id="@+id/menu_group_audio"
android:title="@string/audio"
android:checkable="true"
android:checked="true"
android:checked="false"
app:showAsAction="never" />
<item
android:id="@+id/menu_group_none"
android:title="@string/no_group"
android:checkable="true"
android:checked="true"
android:checked="false"
app:showAsAction="never" />
</group>
</menu>
Loading…
Cancel
Save