pull/433/head
gedoor 4 years ago
parent 9f63cff7f4
commit 4eab3b92a0
  1. 12
      app/src/main/java/io/legado/app/ui/book/cache/CacheActivity.kt
  2. 16
      app/src/main/res/menu/download.xml

@ -95,16 +95,6 @@ class CacheActivity : VMBaseActivity<CacheViewModel>(R.layout.activity_download)
R.id.menu_log -> {
TextListDialog.show(supportFragmentManager, getString(R.string.log), CacheBook.logs)
}
R.id.menu_no_group -> {
title_bar.subtitle = getString(R.string.no_group)
groupId = AppConst.bookGroupNoneId
initBookData()
}
R.id.menu_all -> {
title_bar.subtitle = item.title
groupId = AppConst.bookGroupAllId
initBookData()
}
else -> if (item.groupId == R.id.menu_group) {
title_bar.subtitle = item.title
groupId = App.db.bookGroupDao().getByName(item.title.toString())?.groupId ?: 0
@ -124,6 +114,8 @@ class CacheActivity : VMBaseActivity<CacheViewModel>(R.layout.activity_download)
booksLiveData?.removeObservers(this)
booksLiveData = when (groupId) {
AppConst.bookGroupAllId -> App.db.bookDao().observeAll()
AppConst.bookGroupLocalId -> App.db.bookDao().observeLocal()
AppConst.bookGroupAudioId -> App.db.bookDao().observeAudio()
AppConst.bookGroupNoneId -> App.db.bookDao().observeNoGroup()
else -> App.db.bookDao().observeByGroup(groupId)
}

@ -14,21 +14,7 @@
android:id="@+id/menu_book_group"
android:title="@string/group"
android:icon="@drawable/ic_groups"
app:showAsAction="always">
<menu>
<item
android:id="@+id/menu_no_group"
android:title="@string/no_group" />
<item
android:id="@+id/menu_all"
android:title="@string/all" />
</menu>
</item>
app:showAsAction="always" />
<item
android:id="@+id/menu_log"

Loading…
Cancel
Save