diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index 9da05ab78..8d88c3baf 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -107,12 +107,10 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea } override fun showReadStyle() { - fl_menu.runMenuOut() ReadStyleDialog().show(supportFragmentManager, "readStyle") } override fun showMoreSetting() { - fl_menu.runMenuOut() MoreConfigDialog().show(supportFragmentManager, "moreConfig") } }) diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt index c48fbb159..7ee55318c 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt @@ -22,6 +22,7 @@ class ReadMenu : FrameLayout { private lateinit var menuTopOut: Animation private lateinit var menuBottomIn: Animation private lateinit var menuBottomOut: Animation + private var onMenuOutEnd: (() -> Unit)? = null constructor(context: Context) : super(context) @@ -80,6 +81,7 @@ class ReadMenu : FrameLayout { title_bar.invisible() bottom_menu.invisible() menuBarShow = false + onMenuOutEnd?.invoke() } override fun onAnimationRepeat(animation: Animation) { @@ -96,7 +98,8 @@ class ReadMenu : FrameLayout { bottom_menu.startAnimation(menuBottomIn) } - fun runMenuOut() { + fun runMenuOut(onMenuOutEnd: (() -> Unit)? = null) { + this.onMenuOutEnd = onMenuOutEnd if (this.isVisible) { if (bottom_menu.isVisible) { title_bar.startAnimation(menuTopOut) @@ -154,10 +157,18 @@ class ReadMenu : FrameLayout { ll_adjust.onClick { callback?.openAdjust() } //界面 - ll_font.onClick { callback?.showReadStyle() } + ll_font.onClick { + runMenuOut { + callback?.showReadStyle() + } + } //设置 - ll_setting.onClick { callback?.showMoreSetting() } + ll_setting.onClick { + runMenuOut { + callback?.showMoreSetting() + } + } } fun setAutoPage(autoPage: Boolean) {