properly handle actionbar overflow button color at White and B&W themes

This commit is contained in:
tibbi 2022-03-29 15:18:31 +02:00
parent 1b2a7ce9eb
commit 11bb9a6377
2 changed files with 20 additions and 2 deletions

View file

@ -1,12 +1,22 @@
package com.simplemobiletools.commons.extensions
import android.app.Activity
import android.graphics.Color
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.helpers.DARK_GREY
fun Activity.getThemeId(color: Int = baseConfig.primaryColor, showTransparentTop: Boolean = false) = when {
baseConfig.isUsingSystemTheme -> if (isUsingSystemDarkTheme()) R.style.AppTheme_Base_System else R.style.AppTheme_Base_System_Light
isBlackAndWhiteTheme() -> if (showTransparentTop) R.style.AppTheme_BlackAndWhite_NoActionBar else R.style.AppTheme_BlackAndWhite
isWhiteTheme() -> if (showTransparentTop) R.style.AppTheme_White_NoActionBar else R.style.AppTheme_White
isBlackAndWhiteTheme() -> when {
showTransparentTop -> R.style.AppTheme_BlackAndWhite_NoActionBar
baseConfig.accentColor.getContrastColor() == DARK_GREY -> R.style.AppTheme_BlackAndWhite_DarkTextColor
else -> R.style.AppTheme_BlackAndWhite
}
isWhiteTheme() -> when {
showTransparentTop -> R.style.AppTheme_White_NoActionBar
baseConfig.accentColor.getContrastColor() == Color.WHITE -> R.style.AppTheme_White_LightTextColor
else -> R.style.AppTheme_White
}
showTransparentTop -> {
when (color) {
-12846 -> R.style.AppTheme_Red_100_core

View file

@ -242,6 +242,10 @@
<item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
</style>
<style name="AppTheme.White.LightTextColor" parent="AppTheme.White">
<item name="android:textColorPrimary">@color/theme_light_background_color</item>
</style>
<style name="AppTheme.White.TextStyle">
<item name="android:textColor">@color/dark_grey</item>
</style>
@ -271,6 +275,10 @@
<item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
</style>
<style name="AppTheme.BlackAndWhite.DarkTextColor" parent="AppTheme.BlackAndWhite">
<item name="android:textColorPrimary">@color/theme_dark_background_color</item>
</style>
<style name="AppTheme.BlackAndWhite.TextStyle">
<item name="android:textColor">@color/md_grey_white</item>
</style>