|
|
@ -56,21 +56,20 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
private val menuBottomOut: Animation by lazy { |
|
|
|
private val menuBottomOut: Animation by lazy { |
|
|
|
loadAnimation(context, R.anim.anim_readbook_bottom_out) |
|
|
|
loadAnimation(context, R.anim.anim_readbook_bottom_out) |
|
|
|
} |
|
|
|
} |
|
|
|
private val bgColor: Int |
|
|
|
private val immersiveMenu: Boolean |
|
|
|
get() = if(AppConfig.readBarStyleFollowPage && ReadBookConfig.durConfig.curBgType() == 0){ |
|
|
|
get() = AppConfig.readBarStyleFollowPage && ReadBookConfig.durConfig.curBgType() == 0 |
|
|
|
|
|
|
|
private var bgColor: Int = if (immersiveMenu) { |
|
|
|
Color.parseColor(ReadBookConfig.durConfig.curBgStr()) |
|
|
|
Color.parseColor(ReadBookConfig.durConfig.curBgStr()) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
context.bottomBackground |
|
|
|
context.bottomBackground |
|
|
|
} |
|
|
|
} |
|
|
|
private val textColor: Int |
|
|
|
private var textColor: Int = if (immersiveMenu) { |
|
|
|
get() = if(AppConfig.readBarStyleFollowPage && ReadBookConfig.durConfig.curBgType() == 0){ |
|
|
|
|
|
|
|
ReadBookConfig.durConfig.curTextColor() |
|
|
|
ReadBookConfig.durConfig.curTextColor() |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
context.getPrimaryTextColor(ColorUtils.isColorLight(bgColor)) |
|
|
|
context.getPrimaryTextColor(ColorUtils.isColorLight(bgColor)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private val bottomBackgroundList: ColorStateList |
|
|
|
private var bottomBackgroundList: ColorStateList = Selector.colorBuild() |
|
|
|
get() = Selector.colorBuild() |
|
|
|
|
|
|
|
.setDefaultColor(bgColor) |
|
|
|
.setDefaultColor(bgColor) |
|
|
|
.setPressedColor(ColorUtils.darkenColor(bgColor)) |
|
|
|
.setPressedColor(ColorUtils.darkenColor(bgColor)) |
|
|
|
.create() |
|
|
|
.create() |
|
|
@ -158,15 +157,22 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
fabNightTheme.setImageResource(R.drawable.ic_brightness) |
|
|
|
fabNightTheme.setImageResource(R.drawable.ic_brightness) |
|
|
|
} |
|
|
|
} |
|
|
|
initAnimation() |
|
|
|
initAnimation() |
|
|
|
val bgColor = this@ReadMenu.bgColor |
|
|
|
if (immersiveMenu) { |
|
|
|
val textColor = this@ReadMenu.textColor |
|
|
|
val lightTextColor = ColorUtils.withAlpha(ColorUtils.lightenColor(textColor), 0.75f) |
|
|
|
val bottomBackgroundList = this@ReadMenu.bottomBackgroundList |
|
|
|
|
|
|
|
val lightTextColor = ColorUtils.withAlpha(ColorUtils.lightenColor(textColor),0.75f) |
|
|
|
|
|
|
|
titleBar.setTextColor(textColor) |
|
|
|
titleBar.setTextColor(textColor) |
|
|
|
titleBar.setBackgroundColor(bgColor) |
|
|
|
titleBar.setBackgroundColor(bgColor) |
|
|
|
titleBar.setColorFilter(textColor) |
|
|
|
titleBar.setColorFilter(textColor) |
|
|
|
tvChapterName.setTextColor(lightTextColor) |
|
|
|
tvChapterName.setTextColor(lightTextColor) |
|
|
|
tvChapterUrl.setTextColor(lightTextColor) |
|
|
|
tvChapterUrl.setTextColor(lightTextColor) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
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)) |
|
|
@ -195,20 +201,40 @@ class ReadMenu @JvmOverloads constructor( |
|
|
|
seekBrightness.post { |
|
|
|
seekBrightness.post { |
|
|
|
seekBrightness.progress = AppConfig.readBrightness |
|
|
|
seekBrightness.progress = AppConfig.readBrightness |
|
|
|
} |
|
|
|
} |
|
|
|
if(AppConfig.showReadTitleBarAddition){ |
|
|
|
if (AppConfig.showReadTitleBarAddition) { |
|
|
|
titleBarAddition.visible() |
|
|
|
titleBarAddition.visible() |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
titleBarAddition.gone() |
|
|
|
titleBarAddition.gone() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun reset(){ |
|
|
|
fun reset() { |
|
|
|
|
|
|
|
upColorConfig() |
|
|
|
initView() |
|
|
|
initView() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun refreshMenuColorFilter(){ |
|
|
|
fun refreshMenuColorFilter() { |
|
|
|
|
|
|
|
if (immersiveMenu) { |
|
|
|
binding.titleBar.setColorFilter(textColor) |
|
|
|
binding.titleBar.setColorFilter(textColor) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun upColorConfig() { |
|
|
|
|
|
|
|
bgColor = if (immersiveMenu) { |
|
|
|
|
|
|
|
Color.parseColor(ReadBookConfig.durConfig.curBgStr()) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
context.bottomBackground |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
textColor = if (immersiveMenu) { |
|
|
|
|
|
|
|
ReadBookConfig.durConfig.curTextColor() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
context.getPrimaryTextColor(ColorUtils.isColorLight(bgColor)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
bottomBackgroundList = Selector.colorBuild() |
|
|
|
|
|
|
|
.setDefaultColor(bgColor) |
|
|
|
|
|
|
|
.setPressedColor(ColorUtils.darkenColor(bgColor)) |
|
|
|
|
|
|
|
.create() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun upBrightnessState() { |
|
|
|
fun upBrightnessState() { |
|
|
|
if (brightnessAuto()) { |
|
|
|
if (brightnessAuto()) { |
|
|
|