pull/32/head
kunfei 5 years ago
parent 9b27244fee
commit 370301ed64
  1. 2
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt
  2. 17
      app/src/main/java/io/legado/app/ui/readbook/ReadMenu.kt

@ -107,12 +107,10 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
} }
override fun showReadStyle() { override fun showReadStyle() {
fl_menu.runMenuOut()
ReadStyleDialog().show(supportFragmentManager, "readStyle") ReadStyleDialog().show(supportFragmentManager, "readStyle")
} }
override fun showMoreSetting() { override fun showMoreSetting() {
fl_menu.runMenuOut()
MoreConfigDialog().show(supportFragmentManager, "moreConfig") MoreConfigDialog().show(supportFragmentManager, "moreConfig")
} }
}) })

@ -22,6 +22,7 @@ class ReadMenu : FrameLayout {
private lateinit var menuTopOut: Animation private lateinit var menuTopOut: Animation
private lateinit var menuBottomIn: Animation private lateinit var menuBottomIn: Animation
private lateinit var menuBottomOut: Animation private lateinit var menuBottomOut: Animation
private var onMenuOutEnd: (() -> Unit)? = null
constructor(context: Context) : super(context) constructor(context: Context) : super(context)
@ -80,6 +81,7 @@ class ReadMenu : FrameLayout {
title_bar.invisible() title_bar.invisible()
bottom_menu.invisible() bottom_menu.invisible()
menuBarShow = false menuBarShow = false
onMenuOutEnd?.invoke()
} }
override fun onAnimationRepeat(animation: Animation) { override fun onAnimationRepeat(animation: Animation) {
@ -96,7 +98,8 @@ class ReadMenu : FrameLayout {
bottom_menu.startAnimation(menuBottomIn) bottom_menu.startAnimation(menuBottomIn)
} }
fun runMenuOut() { fun runMenuOut(onMenuOutEnd: (() -> Unit)? = null) {
this.onMenuOutEnd = onMenuOutEnd
if (this.isVisible) { if (this.isVisible) {
if (bottom_menu.isVisible) { if (bottom_menu.isVisible) {
title_bar.startAnimation(menuTopOut) title_bar.startAnimation(menuTopOut)
@ -154,10 +157,18 @@ class ReadMenu : FrameLayout {
ll_adjust.onClick { callback?.openAdjust() } 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) { fun setAutoPage(autoPage: Boolean) {

Loading…
Cancel
Save