pull/1319/head
gedoor 3 years ago
parent 1f01d3ced4
commit 7c55b6addb
  1. 4
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt
  2. 18
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  3. 3
      app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt

@ -26,6 +26,7 @@ import io.legado.app.ui.widget.recycler.ItemTouchCallback
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.cnCompare
import io.legado.app.utils.getPrefInt
import io.legado.app.utils.showDialog
import io.legado.app.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Job
@ -143,8 +144,7 @@ class ArrangeBookActivity : VMBaseActivity<ActivityArrangeBookBinding, ArrangeBo
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_group_manage -> GroupManageDialog()
.show(supportFragmentManager, "groupManage")
R.id.menu_group_manage -> supportFragmentManager.showDialog<GroupManageDialog>()
else -> if (item.groupId == R.id.menu_group) {
binding.titleBar.subtitle = item.title
groupId = appDb.bookGroupDao.getByName(item.title.toString())?.groupId ?: 0

@ -649,15 +649,9 @@ class ReadBookActivity : ReadBookBaseActivity(),
override fun showActionMenu() {
when {
BaseReadAloudService.isRun -> {
showReadAloudDialog()
}
isAutoPage -> {
AutoReadDialog().show(supportFragmentManager, "autoRead")
}
else -> {
binding.readMenu.runMenuIn()
}
BaseReadAloudService.isRun -> showReadAloudDialog()
isAutoPage -> supportFragmentManager.showDialog<AutoReadDialog>()
else -> binding.readMenu.runMenuIn()
}
}
@ -670,7 +664,7 @@ class ReadBookActivity : ReadBookBaseActivity(),
* 显示朗读菜单
*/
override fun showReadAloudDialog() {
ReadAloudDialog().show(supportFragmentManager, "readAloud")
supportFragmentManager.showDialog<ReadAloudDialog>()
}
/**
@ -771,14 +765,14 @@ class ReadBookActivity : ReadBookBaseActivity(),
* 显示阅读样式配置
*/
override fun showReadStyle() {
ReadStyleDialog().show(supportFragmentManager, "readStyle")
supportFragmentManager.showDialog<ReadStyleDialog>()
}
/**
* 显示更多设置
*/
override fun showMoreSetting() {
MoreConfigDialog().show(supportFragmentManager, "moreConfig")
supportFragmentManager.showDialog<MoreConfigDialog>()
}
/**

@ -69,8 +69,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
R.id.menu_search -> startActivity<SearchActivity>()
R.id.menu_update_toc -> activityViewModel.upToc(books)
R.id.menu_bookshelf_layout -> configBookshelf()
R.id.menu_group_manage -> GroupManageDialog()
.show(childFragmentManager, "groupManageDialog")
R.id.menu_group_manage -> childFragmentManager.showDialog<GroupManageDialog>()
R.id.menu_add_local -> startActivity<ImportBookActivity>()
R.id.menu_add_url -> addBookByUrl()
R.id.menu_arrange_bookshelf -> startActivity<ArrangeBookActivity> {

Loading…
Cancel
Save