mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-28 10:38:48 +03:00
Fix reader toolbar alpha applied to other components outside its activity (#5483)
This commit is contained in:
parent
70ed49e478
commit
82f3677168
1 changed files with 9 additions and 6 deletions
|
@ -12,7 +12,7 @@ import android.graphics.Color
|
|||
import android.graphics.ColorMatrix
|
||||
import android.graphics.ColorMatrixColorFilter
|
||||
import android.graphics.Paint
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
|
@ -25,6 +25,7 @@ import android.view.animation.Animation
|
|||
import android.view.animation.AnimationUtils
|
||||
import android.widget.SeekBar
|
||||
import android.widget.Toast
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
|
@ -32,6 +33,7 @@ import androidx.core.view.isVisible
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
import com.mikepenz.aboutlibraries.util.getThemeColor
|
||||
import dev.chrisbanes.insetter.applyInsetter
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
|
@ -352,21 +354,22 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||
initBottomShortcuts()
|
||||
|
||||
val alpha = if (preferences.isDarkMode()) 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.background.alpha = alpha
|
||||
it.backgroundTintMode = PorterDuff.Mode.DST_IN
|
||||
it.backgroundTintList = ColorStateList.valueOf(toolbarColor)
|
||||
}
|
||||
|
||||
val systemBarsColor = (binding.toolbarBottom.background as ColorDrawable).color
|
||||
window.statusBarColor = systemBarsColor
|
||||
window.statusBarColor = toolbarColor
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
window.navigationBarColor = systemBarsColor
|
||||
window.navigationBarColor = toolbarColor
|
||||
}
|
||||
(binding.toolbar.background as MaterialShapeDrawable).fillColor = ColorStateList.valueOf(systemBarsColor)
|
||||
(binding.toolbar.background as MaterialShapeDrawable).fillColor = ColorStateList.valueOf(toolbarColor)
|
||||
|
||||
// Set initial visibility
|
||||
setMenuVisibility(menuVisible)
|
||||
|
|
Loading…
Reference in a new issue