diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 3e6210bd6..08f5e71fe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -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() 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)