|
@@ -2,7 +2,6 @@ package io.legado.app.ui.book.read
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
-import android.graphics.Color
|
|
|
|
|
import android.graphics.drawable.GradientDrawable
|
|
import android.graphics.drawable.GradientDrawable
|
|
|
import android.util.AttributeSet
|
|
import android.util.AttributeSet
|
|
|
import android.view.LayoutInflater
|
|
import android.view.LayoutInflater
|
|
@@ -15,12 +14,8 @@ import io.legado.app.R
|
|
|
import io.legado.app.databinding.ViewMangaMenuBinding
|
|
import io.legado.app.databinding.ViewMangaMenuBinding
|
|
|
import io.legado.app.help.IntentData
|
|
import io.legado.app.help.IntentData
|
|
|
import io.legado.app.help.config.AppConfig
|
|
import io.legado.app.help.config.AppConfig
|
|
|
-import io.legado.app.help.config.ReadBookConfig
|
|
|
|
|
import io.legado.app.lib.dialogs.alert
|
|
import io.legado.app.lib.dialogs.alert
|
|
|
import io.legado.app.lib.theme.bottomBackground
|
|
import io.legado.app.lib.theme.bottomBackground
|
|
|
-import io.legado.app.lib.theme.getPrimaryTextColor
|
|
|
|
|
-import io.legado.app.lib.theme.primaryColor
|
|
|
|
|
-import io.legado.app.lib.theme.primaryTextColor
|
|
|
|
|
import io.legado.app.model.ReadManga
|
|
import io.legado.app.model.ReadManga
|
|
|
import io.legado.app.ui.browser.WebViewActivity
|
|
import io.legado.app.ui.browser.WebViewActivity
|
|
|
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
|
|
import io.legado.app.ui.widget.seekbar.SeekBarChangeListener
|
|
@@ -57,22 +52,7 @@ class MangaMenu @JvmOverloads constructor(
|
|
|
loadAnimation(context, R.anim.anim_readbook_bottom_out)
|
|
loadAnimation(context, R.anim.anim_readbook_bottom_out)
|
|
|
}
|
|
}
|
|
|
private var isMenuOutAnimating = false
|
|
private var isMenuOutAnimating = false
|
|
|
- private val immersiveMenu: Boolean
|
|
|
|
|
- get() = AppConfig.readBarStyleFollowPage && ReadBookConfig.durConfig.curBgType() == 0
|
|
|
|
|
-
|
|
|
|
|
- private var bgColor: Int = if (immersiveMenu) {
|
|
|
|
|
- kotlin.runCatching {
|
|
|
|
|
- Color.parseColor(ReadBookConfig.durConfig.curBgStr())
|
|
|
|
|
- }.getOrDefault(context.bottomBackground)
|
|
|
|
|
- } else {
|
|
|
|
|
- context.bottomBackground
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private var textColor: Int = if (immersiveMenu) {
|
|
|
|
|
- ReadBookConfig.durConfig.curTextColor()
|
|
|
|
|
- } else {
|
|
|
|
|
- context.getPrimaryTextColor(ColorUtils.isColorLight(bgColor))
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ private var bgColor = context.bottomBackground
|
|
|
|
|
|
|
|
private val menuOutListener = object : Animation.AnimationListener {
|
|
private val menuOutListener = object : Animation.AnimationListener {
|
|
|
override fun onAnimationStart(animation: Animation) {
|
|
override fun onAnimationStart(animation: Animation) {
|
|
@@ -110,28 +90,12 @@ class MangaMenu @JvmOverloads constructor(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
init {
|
|
init {
|
|
|
- initView(true)
|
|
|
|
|
|
|
+ initView()
|
|
|
bindEvent()
|
|
bindEvent()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private fun initView(reset: Boolean = false) = binding.run {
|
|
|
|
|
|
|
+ private fun initView() = binding.run {
|
|
|
initAnimation()
|
|
initAnimation()
|
|
|
- if (immersiveMenu) {
|
|
|
|
|
- val lightTextColor = ColorUtils.withAlpha(ColorUtils.lightenColor(textColor), 0.75f)
|
|
|
|
|
- titleBar.setTextColor(textColor)
|
|
|
|
|
- titleBar.setBackgroundColor(bgColor)
|
|
|
|
|
- titleBar.setColorFilter(textColor)
|
|
|
|
|
- tvChapterName.setTextColor(lightTextColor)
|
|
|
|
|
- tvChapterUrl.setTextColor(lightTextColor)
|
|
|
|
|
- } else if (reset) {
|
|
|
|
|
- val bgColor = context.primaryColor
|
|
|
|
|
- val textColor = context.primaryTextColor
|
|
|
|
|
- titleBar.setTextColor(textColor)
|
|
|
|
|
- titleBar.setBackgroundColor(bgColor)
|
|
|
|
|
- titleBar.setColorFilter(textColor)
|
|
|
|
|
- tvChapterName.setTextColor(textColor)
|
|
|
|
|
- tvChapterUrl.setTextColor(textColor)
|
|
|
|
|
- }
|
|
|
|
|
val brightnessBackground = GradientDrawable()
|
|
val brightnessBackground = GradientDrawable()
|
|
|
brightnessBackground.cornerRadius = 5F.dpToPx()
|
|
brightnessBackground.cornerRadius = 5F.dpToPx()
|
|
|
brightnessBackground.setColor(ColorUtils.adjustAlpha(bgColor, 0.5f))
|
|
brightnessBackground.setColor(ColorUtils.adjustAlpha(bgColor, 0.5f))
|