|
|
@ -13,6 +13,7 @@ import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
|
|
|
|
import io.legado.app.help.LocalConfig |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.help.ReadBookConfig |
|
|
|
import io.legado.app.lib.theme.* |
|
|
|
import io.legado.app.lib.theme.* |
|
|
|
import io.legado.app.service.help.ReadBook |
|
|
|
import io.legado.app.service.help.ReadBook |
|
|
@ -29,7 +30,7 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
attrs: AttributeSet? = null |
|
|
|
attrs: AttributeSet? = null |
|
|
|
) : FrameLayout(context, attrs) { |
|
|
|
) : FrameLayout(context, attrs) { |
|
|
|
var cnaShowMenu: Boolean = false |
|
|
|
var cnaShowMenu: Boolean = false |
|
|
|
private val callBack: CallBack? get() = activity as? CallBack |
|
|
|
private val callBack: CallBack get() = activity as CallBack |
|
|
|
private lateinit var menuTopIn: Animation |
|
|
|
private lateinit var menuTopIn: Animation |
|
|
|
private lateinit var menuTopOut: Animation |
|
|
|
private lateinit var menuTopOut: Animation |
|
|
|
private lateinit var menuBottomIn: Animation |
|
|
|
private lateinit var menuBottomIn: Animation |
|
|
@ -166,19 +167,19 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
//搜索 |
|
|
|
//搜索 |
|
|
|
fabSearch.onClick { |
|
|
|
fabSearch.onClick { |
|
|
|
runMenuOut { |
|
|
|
runMenuOut { |
|
|
|
callBack?.openSearchActivity(null) |
|
|
|
callBack.openSearchActivity(null) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//自动翻页 |
|
|
|
//自动翻页 |
|
|
|
fabAutoPage.onClick { |
|
|
|
fabAutoPage.onClick { |
|
|
|
runMenuOut { |
|
|
|
runMenuOut { |
|
|
|
callBack?.autoPage() |
|
|
|
callBack.autoPage() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//替换 |
|
|
|
//替换 |
|
|
|
fabReplaceRule.onClick { callBack?.openReplaceRule() } |
|
|
|
fabReplaceRule.onClick { callBack.openReplaceRule() } |
|
|
|
|
|
|
|
|
|
|
|
//夜间模式 |
|
|
|
//夜间模式 |
|
|
|
fabNightTheme.onClick { |
|
|
|
fabNightTheme.onClick { |
|
|
@ -195,31 +196,31 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
//目录 |
|
|
|
//目录 |
|
|
|
ll_catalog.onClick { |
|
|
|
ll_catalog.onClick { |
|
|
|
runMenuOut { |
|
|
|
runMenuOut { |
|
|
|
callBack?.openChapterList() |
|
|
|
callBack.openChapterList() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//朗读 |
|
|
|
//朗读 |
|
|
|
ll_read_aloud.onClick { |
|
|
|
ll_read_aloud.onClick { |
|
|
|
runMenuOut { |
|
|
|
runMenuOut { |
|
|
|
callBack?.onClickReadAloud() |
|
|
|
callBack.onClickReadAloud() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ll_read_aloud.onLongClick { |
|
|
|
ll_read_aloud.onLongClick { |
|
|
|
runMenuOut { callBack?.showReadAloudDialog() } |
|
|
|
runMenuOut { callBack.showReadAloudDialog() } |
|
|
|
true |
|
|
|
true |
|
|
|
} |
|
|
|
} |
|
|
|
//界面 |
|
|
|
//界面 |
|
|
|
ll_font.onClick { |
|
|
|
ll_font.onClick { |
|
|
|
runMenuOut { |
|
|
|
runMenuOut { |
|
|
|
callBack?.showReadStyle() |
|
|
|
callBack.showReadStyle() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//设置 |
|
|
|
//设置 |
|
|
|
ll_setting.onClick { |
|
|
|
ll_setting.onClick { |
|
|
|
runMenuOut { |
|
|
|
runMenuOut { |
|
|
|
callBack?.showMoreSetting() |
|
|
|
callBack.showMoreSetting() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -230,19 +231,19 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
menuBottomIn = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_in) |
|
|
|
menuBottomIn = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_in) |
|
|
|
menuTopIn.setAnimationListener(object : Animation.AnimationListener { |
|
|
|
menuTopIn.setAnimationListener(object : Animation.AnimationListener { |
|
|
|
override fun onAnimationStart(animation: Animation) { |
|
|
|
override fun onAnimationStart(animation: Animation) { |
|
|
|
callBack?.upSystemUiVisibility() |
|
|
|
callBack.upSystemUiVisibility() |
|
|
|
ll_brightness.visible(showBrightnessView) |
|
|
|
ll_brightness.visible(showBrightnessView) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onAnimationEnd(animation: Animation) { |
|
|
|
override fun onAnimationEnd(animation: Animation) { |
|
|
|
vw_menu_bg.onClick { runMenuOut() } |
|
|
|
vw_menu_bg.onClick { runMenuOut() } |
|
|
|
|
|
|
|
val hasNavigationBar = ReadBookConfig.hideNavigationBar |
|
|
|
|
|
|
|
&& SystemUtils.isNavigationBarExist(activity) |
|
|
|
vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply { |
|
|
|
vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply { |
|
|
|
height = |
|
|
|
height = if (hasNavigationBar) context.navigationBarHeight else 0 |
|
|
|
if (ReadBookConfig.hideNavigationBar |
|
|
|
} |
|
|
|
&& SystemUtils.isNavigationBarExist(activity) |
|
|
|
if (LocalConfig.isFirstReadMenuShow) { |
|
|
|
) |
|
|
|
callBack.showReadMenuHelp() |
|
|
|
context.navigationBarHeight |
|
|
|
|
|
|
|
else 0 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -264,7 +265,7 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
bottom_menu.invisible() |
|
|
|
bottom_menu.invisible() |
|
|
|
cnaShowMenu = false |
|
|
|
cnaShowMenu = false |
|
|
|
onMenuOutEnd?.invoke() |
|
|
|
onMenuOutEnd?.invoke() |
|
|
|
callBack?.upSystemUiVisibility() |
|
|
|
callBack.upSystemUiVisibility() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onAnimationRepeat(animation: Animation) = Unit |
|
|
|
override fun onAnimationRepeat(animation: Animation) = Unit |
|
|
@ -292,6 +293,7 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
fun showReadAloudDialog() |
|
|
|
fun showReadAloudDialog() |
|
|
|
fun upSystemUiVisibility() |
|
|
|
fun upSystemUiVisibility() |
|
|
|
fun onClickReadAloud() |
|
|
|
fun onClickReadAloud() |
|
|
|
|
|
|
|
fun showReadMenuHelp() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|