Fixed the toolbar color with a light theme and AMOLED mode enabled

This commit is contained in:
Zakhar Timoshenko
2021-09-12 17:38:16 +03:00
committed by Koitharu
parent 93998e460c
commit cd8e256364
2 changed files with 2 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
package org.koitharu.kotatsu.base.ui
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.view.KeyEvent
@@ -58,9 +57,6 @@ abstract class BaseActivity<B : ViewBinding> : AppCompatActivity(), OnApplyWindo
this.binding = binding
super.setContentView(binding.root)
val toolbar = (binding.root.findViewById<View>(R.id.toolbar) as? Toolbar)
if (get<AppSettings>().isAmoledTheme) {
toolbar?.setBackgroundColor(Color.BLACK)
}
toolbar?.let(this::setSupportActionBar)
ViewCompat.setOnApplyWindowInsetsListener(binding.root, this)

View File

@@ -11,6 +11,7 @@ import android.view.View
import android.view.ViewGroup.MarginLayoutParams
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import androidx.core.graphics.Insets
import androidx.core.view.*
@@ -87,7 +88,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(),
binding.drawer.addDrawerListener(drawerToggle)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
if (get<AppSettings>().isAmoledTheme) {
if (get<AppSettings>().isAmoledTheme && get<AppSettings>().theme == AppCompatDelegate.MODE_NIGHT_YES) {
binding.appbar.setBackgroundColor(Color.BLACK)
binding.toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.color_background))
} else {