[优化] 修复阅读界面应用栏取色 #490

This commit is contained in:
HapeLee
2025-12-24 01:11:06 +08:00
parent cf5f9c6674
commit e2e980269c
@@ -18,6 +18,7 @@ import androidx.appcompat.widget.PopupMenu
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import androidx.core.graphics.toColorInt import androidx.core.graphics.toColorInt
import androidx.core.view.doOnAttach import androidx.core.view.doOnAttach
import androidx.core.view.forEach
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.google.android.material.badge.BadgeDrawable import com.google.android.material.badge.BadgeDrawable
@@ -242,6 +243,10 @@ class ReadMenu @JvmOverloads constructor(
seekReadPage.tickInactiveTintList = ColorStateList.valueOf(acColor) seekReadPage.tickInactiveTintList = ColorStateList.valueOf(acColor)
tvPre.iconTint = ColorStateList.valueOf(acColor) tvPre.iconTint = ColorStateList.valueOf(acColor)
tvNext.iconTint = ColorStateList.valueOf(acColor) tvNext.iconTint = ColorStateList.valueOf(acColor)
tvBookName.setTextColor(acColor)
tvChapterName.setTextColor(acColor)
tvChapterUrl.setTextColor(acColor)
tvSourceAction.setTextColor(acColor)
tvPre.backgroundTintList = ColorStateList.valueOf(bgColor) tvPre.backgroundTintList = ColorStateList.valueOf(bgColor)
tvNext.backgroundTintList = ColorStateList.valueOf(bgColor) tvNext.backgroundTintList = ColorStateList.valueOf(bgColor)
tvPre.alpha = AppConfig.menuAlpha / 100f * 255 tvPre.alpha = AppConfig.menuAlpha / 100f * 255
@@ -258,6 +263,18 @@ class ReadMenu @JvmOverloads constructor(
} }
} }
fun updateToolBarColor(){
binding.titleBar.toolbar.navigationIcon?.setTint(acColor)
binding.titleBar.toolbar.apply {
setTitleTextColor(acColor)
setSubtitleTextColor(acColor)
}
binding.titleBar.toolbar.menu.forEach { item ->
item.icon?.setTint(acColor)
}
binding.titleBar.toolbar.overflowIcon?.setTint(acColor)
}
fun reset() { fun reset() {
upColorConfig() upColorConfig()
initView() initView()
@@ -322,6 +339,7 @@ class ReadMenu @JvmOverloads constructor(
this.visible() this.visible()
binding.titleBar.visible() binding.titleBar.visible()
binding.bottomMenu.visible() binding.bottomMenu.visible()
updateToolBarColor()
changeReplace(ReadBook.book?.getUseReplaceRule() ?: false) changeReplace(ReadBook.book?.getUseReplaceRule() ?: false)
updateBadge("replace_badge", ReadBook.curTextChapter?.effectiveReplaceRules?.size ?: 0) updateBadge("replace_badge", ReadBook.curTextChapter?.effectiveReplaceRules?.size ?: 0)
if (anim) { if (anim) {