mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 05:27:28 +01:00
Use elevated overlay on reader menu (#6347)
This commit is contained in:
@@ -13,7 +13,7 @@ import android.graphics.Color
|
||||
import android.graphics.ColorMatrix
|
||||
import android.graphics.ColorMatrixColorFilter
|
||||
import android.graphics.Paint
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.RippleDrawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
@@ -76,6 +76,7 @@ import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
||||
import eu.kanade.tachiyomi.util.system.isNightMode
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.view.copy
|
||||
import eu.kanade.tachiyomi.util.view.popupMenu
|
||||
import eu.kanade.tachiyomi.util.view.setTooltip
|
||||
import eu.kanade.tachiyomi.widget.listener.SimpleAnimationListener
|
||||
@@ -389,23 +390,32 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
|
||||
initBottomShortcuts()
|
||||
|
||||
val alpha = if (isNightMode()) 230 else 242 // 90% dark 95% light
|
||||
val toolbarColor = ColorUtils.setAlphaComponent(getThemeColor(R.attr.colorToolbar), alpha)
|
||||
listOf(
|
||||
binding.toolbarBottom,
|
||||
binding.leftChapter,
|
||||
binding.readerSeekbar,
|
||||
binding.rightChapter
|
||||
).forEach {
|
||||
it.backgroundTintMode = PorterDuff.Mode.DST_IN
|
||||
it.backgroundTintList = ColorStateList.valueOf(toolbarColor)
|
||||
val toolbarBackground = (binding.toolbar.background as MaterialShapeDrawable).apply {
|
||||
elevation = resources.getDimension(R.dimen.m3_sys_elevation_level2)
|
||||
alpha = if (isNightMode()) 230 else 242 // 90% dark 95% light
|
||||
}
|
||||
binding.toolbarBottom.background = toolbarBackground.copy(this@ReaderActivity)
|
||||
|
||||
binding.readerSeekbar.background = toolbarBackground.copy(this@ReaderActivity)?.apply {
|
||||
setCornerSize(999F)
|
||||
}
|
||||
listOf(binding.leftChapter, binding.rightChapter).forEach {
|
||||
it.background = binding.readerSeekbar.background.copy(this)
|
||||
it.foreground = RippleDrawable(
|
||||
ColorStateList.valueOf(getThemeColor(android.R.attr.colorControlHighlight)),
|
||||
null,
|
||||
it.background
|
||||
)
|
||||
}
|
||||
|
||||
val toolbarColor = ColorUtils.setAlphaComponent(
|
||||
toolbarBackground.resolvedTintColor,
|
||||
toolbarBackground.alpha
|
||||
)
|
||||
window.statusBarColor = toolbarColor
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
window.navigationBarColor = toolbarColor
|
||||
}
|
||||
(binding.toolbar.background as MaterialShapeDrawable).fillColor = ColorStateList.valueOf(toolbarColor)
|
||||
|
||||
// Set initial visibility
|
||||
setMenuVisibility(menuVisible)
|
||||
|
||||
Reference in New Issue
Block a user