From 1abced992bc09deef0f1c82c9a02e518a521984d Mon Sep 17 00:00:00 2001 From: Stypox Date: Thu, 21 Nov 2024 12:07:03 +0100 Subject: [PATCH] Use normal colors for empty state view --- .../ui/emptystate/EmptyStateComposable.kt | 35 ++++++++----------- .../newpipe/ui/emptystate/EmptyStateUtil.kt | 3 -- .../newpipe/ui/theme/ColorExtensions.kt | 19 ---------- 3 files changed, 14 insertions(+), 43 deletions(-) delete mode 100644 app/src/main/java/org/schabi/newpipe/ui/theme/ColorExtensions.kt diff --git a/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateComposable.kt b/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateComposable.kt index d67aed898..797b2cd66 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateComposable.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateComposable.kt @@ -7,12 +7,10 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding -import androidx.compose.material3.LocalContentColor import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -23,7 +21,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import org.schabi.newpipe.R import org.schabi.newpipe.ui.theme.AppTheme -import org.schabi.newpipe.ui.theme.errorHint @Composable fun EmptyStateComposable( @@ -49,26 +46,22 @@ private fun EmptyStateComposable( descriptionText: String, descriptionTextStyle: TextStyle, ) { - CompositionLocalProvider( - LocalContentColor provides MaterialTheme.colorScheme.errorHint + Column( + modifier = modifier, + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center ) { - Column( - modifier = modifier, - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center - ) { - Text( - modifier = emojiModifier, - text = emojiText, - style = emojiTextStyle, - ) + Text( + modifier = emojiModifier, + text = emojiText, + style = emojiTextStyle, + ) - Text( - modifier = descriptionModifier, - text = descriptionText, - style = descriptionTextStyle, - ) - } + Text( + modifier = descriptionModifier, + text = descriptionText, + style = descriptionTextStyle, + ) } } diff --git a/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateUtil.kt b/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateUtil.kt index 526a33850..85ed3697e 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateUtil.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/emptystate/EmptyStateUtil.kt @@ -3,7 +3,6 @@ package org.schabi.newpipe.ui.emptystate import androidx.annotation.StringRes -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.MutableState import androidx.compose.runtime.State @@ -11,7 +10,6 @@ import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.res.stringResource import org.schabi.newpipe.ui.theme.AppTheme -import org.schabi.newpipe.ui.theme.errorHint import androidx.compose.runtime.mutableStateOf as composeRuntimeMutableStateOf @JvmOverloads @@ -24,7 +22,6 @@ fun ComposeView.setEmptyStateText( AppTheme { Text( text = stringResource(id = stringRes), - color = MaterialTheme.colorScheme.errorHint, ) } } diff --git a/app/src/main/java/org/schabi/newpipe/ui/theme/ColorExtensions.kt b/app/src/main/java/org/schabi/newpipe/ui/theme/ColorExtensions.kt deleted file mode 100644 index 3c057b16a..000000000 --- a/app/src/main/java/org/schabi/newpipe/ui/theme/ColorExtensions.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.schabi.newpipe.ui.theme - -import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.ColorScheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color - -/** - * Extended color for error hint. - */ -val md_theme_light_error_hint = Color(0xCC000000) -val md_theme_dark_error_hint = Color(0xCCFFFFFF) - -val ColorScheme.errorHint: Color - @Composable get() = if (isSystemInDarkTheme()) { - md_theme_dark_error_hint - } else { - md_theme_light_error_hint - }