mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-09 11:48:43 +01:00
feat(settings, ui): generate palette based on seed color
This commit is contained in:
parent
d42d94ff40
commit
31f34b03a3
@ -30,6 +30,9 @@ kotlin {
|
||||
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
|
||||
implementation(compose.components.resources)
|
||||
implementation(compose.materialIconsExtended)
|
||||
|
||||
implementation(libs.materialKolor)
|
||||
|
||||
implementation(projects.resources)
|
||||
}
|
||||
}
|
||||
|
@ -11,21 +11,8 @@ import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.BlackColor
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.ColorSchemeProvider
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.DarkColors
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.LightColors
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.applyCustom
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_background
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_errorContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_onBackground
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_onErrorContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_onPrimaryContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_onSecondaryContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_onSurface
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_onSurfaceVariant
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_onTertiaryContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_primaryContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_secondaryContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_surface
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_surfaceVariant
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.md_theme_black_tertiaryContainer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.blackify
|
||||
import com.materialkolor.dynamicColorScheme
|
||||
|
||||
internal class DefaultColorSchemeProvider(private val context: Context) : ColorSchemeProvider {
|
||||
|
||||
@ -37,32 +24,54 @@ internal class DefaultColorSchemeProvider(private val context: Context) : ColorS
|
||||
override fun getColorScheme(
|
||||
theme: ThemeState,
|
||||
dynamic: Boolean,
|
||||
customPrimary: Color?,
|
||||
customSecondary: Color?,
|
||||
customTertiary: Color?,
|
||||
customSeed: Color?,
|
||||
): ColorScheme = when (theme) {
|
||||
ThemeState.Dark -> if (dynamic) dynamicDarkColorScheme(context) else DarkColors
|
||||
ThemeState.Black -> if (dynamic) dynamicDarkColorScheme(context).copy(
|
||||
primaryContainer = md_theme_black_primaryContainer,
|
||||
onPrimaryContainer = md_theme_black_onPrimaryContainer,
|
||||
secondaryContainer = md_theme_black_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_black_onSecondaryContainer,
|
||||
tertiaryContainer = md_theme_black_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_black_onTertiaryContainer,
|
||||
errorContainer = md_theme_black_errorContainer,
|
||||
onErrorContainer = md_theme_black_onErrorContainer,
|
||||
background = md_theme_black_background,
|
||||
onBackground = md_theme_black_onBackground,
|
||||
surface = md_theme_black_surface,
|
||||
onSurface = md_theme_black_onSurface,
|
||||
surfaceVariant = md_theme_black_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_black_onSurfaceVariant,
|
||||
) else BlackColors
|
||||
ThemeState.Dark -> {
|
||||
when {
|
||||
dynamic -> {
|
||||
dynamicDarkColorScheme(context)
|
||||
}
|
||||
|
||||
else -> if (dynamic) dynamicLightColorScheme(context) else LightColors
|
||||
}.applyCustom(
|
||||
customPrimary,
|
||||
customSecondary,
|
||||
customTertiary
|
||||
)
|
||||
customSeed != null -> {
|
||||
dynamicColorScheme(customSeed, true)
|
||||
}
|
||||
|
||||
else -> {
|
||||
DarkColors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ThemeState.Black -> {
|
||||
when {
|
||||
dynamic -> {
|
||||
dynamicDarkColorScheme(context).blackify()
|
||||
}
|
||||
|
||||
customSeed != null -> {
|
||||
dynamicColorScheme(customSeed, true).blackify()
|
||||
}
|
||||
|
||||
else -> {
|
||||
BlackColors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
when {
|
||||
dynamic -> {
|
||||
dynamicLightColorScheme(context)
|
||||
}
|
||||
|
||||
customSeed != null -> {
|
||||
dynamicColorScheme(customSeed, false)
|
||||
}
|
||||
|
||||
else -> {
|
||||
LightColors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,9 +12,7 @@ internal class DefaultThemeRepository : ThemeRepository {
|
||||
override val contentFontScale = MutableStateFlow(1f)
|
||||
override val navItemTitles = MutableStateFlow(false)
|
||||
override val dynamicColors = MutableStateFlow(false)
|
||||
override val customPrimaryColor = MutableStateFlow<Color?>(null)
|
||||
override val customSecondaryColor = MutableStateFlow<Color?>(null)
|
||||
override val customTertiaryColor = MutableStateFlow<Color?>(null)
|
||||
override val customSeedColor = MutableStateFlow<Color?>(null)
|
||||
override val postLayout = MutableStateFlow<PostLayout>(PostLayout.Card)
|
||||
|
||||
override fun changeTheme(value: ThemeState) {
|
||||
@ -62,16 +60,8 @@ internal class DefaultThemeRepository : ThemeRepository {
|
||||
)
|
||||
}
|
||||
|
||||
override fun changeCustomPrimaryColor(color: Color?) {
|
||||
customPrimaryColor.value = color
|
||||
}
|
||||
|
||||
override fun changeCustomSecondaryColor(color: Color?) {
|
||||
customSecondaryColor.value = color
|
||||
}
|
||||
|
||||
override fun changeCustomTertiaryColor(color: Color?) {
|
||||
customTertiaryColor.value = color
|
||||
override fun changeCustomSeedColor(color: Color?) {
|
||||
customSeedColor.value = color
|
||||
}
|
||||
|
||||
override fun changePostLayout(value: PostLayout) {
|
||||
|
@ -15,11 +15,7 @@ interface ThemeRepository {
|
||||
|
||||
val dynamicColors: StateFlow<Boolean>
|
||||
|
||||
val customPrimaryColor: StateFlow<Color?>
|
||||
|
||||
val customSecondaryColor: StateFlow<Color?>
|
||||
|
||||
val customTertiaryColor: StateFlow<Color?>
|
||||
val customSeedColor: StateFlow<Color?>
|
||||
|
||||
val postLayout: StateFlow<PostLayout>
|
||||
|
||||
@ -38,11 +34,7 @@ interface ThemeRepository {
|
||||
endColor: Color,
|
||||
): Color
|
||||
|
||||
fun changeCustomPrimaryColor(color: Color?)
|
||||
|
||||
fun changeCustomSecondaryColor(color: Color?)
|
||||
|
||||
fun changeCustomTertiaryColor(color: Color?)
|
||||
fun changeCustomSeedColor(color: Color?)
|
||||
|
||||
fun changePostLayout(value: PostLayout)
|
||||
}
|
||||
|
@ -24,17 +24,13 @@ fun AppTheme(
|
||||
}
|
||||
|
||||
val themeState by repository.state.collectAsState()
|
||||
val customPrimaryColor by repository.customPrimaryColor.collectAsState()
|
||||
val customSecondaryColor by repository.customSecondaryColor.collectAsState()
|
||||
val customTertiaryColor by repository.customTertiaryColor.collectAsState()
|
||||
val customSeedColor by repository.customSeedColor.collectAsState()
|
||||
|
||||
val colorSchemeProvider = remember { getColorSchemeProvider() }
|
||||
val colorScheme = colorSchemeProvider.getColorScheme(
|
||||
theme = themeState,
|
||||
dynamic = useDynamicColors,
|
||||
customPrimary = customPrimaryColor,
|
||||
customSecondary = customSecondaryColor,
|
||||
customTertiary = customTertiaryColor,
|
||||
customSeed = customSeedColor,
|
||||
)
|
||||
|
||||
MaterialTheme(
|
||||
|
@ -11,18 +11,23 @@ interface ColorSchemeProvider {
|
||||
fun getColorScheme(
|
||||
theme: ThemeState,
|
||||
dynamic: Boolean,
|
||||
customPrimary: Color? = null,
|
||||
customSecondary: Color? = null,
|
||||
customTertiary: Color? = null,
|
||||
customSeed: Color? = null,
|
||||
): ColorScheme
|
||||
}
|
||||
|
||||
internal fun ColorScheme.applyCustom(
|
||||
customPrimary: Color? = null,
|
||||
customSecondary: Color? = null,
|
||||
customTertiary: Color? = null,
|
||||
): ColorScheme = copy(
|
||||
primary = customPrimary ?: primary,
|
||||
secondary = customSecondary ?: secondary,
|
||||
tertiary = customTertiary ?: tertiary,
|
||||
)
|
||||
fun ColorScheme.blackify(): ColorScheme = copy(
|
||||
primaryContainer = md_theme_black_primaryContainer,
|
||||
onPrimaryContainer = md_theme_black_onPrimaryContainer,
|
||||
secondaryContainer = md_theme_black_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_black_onSecondaryContainer,
|
||||
tertiaryContainer = md_theme_black_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_black_onTertiaryContainer,
|
||||
errorContainer = md_theme_black_errorContainer,
|
||||
onErrorContainer = md_theme_black_onErrorContainer,
|
||||
background = md_theme_black_background,
|
||||
onBackground = md_theme_black_onBackground,
|
||||
surface = md_theme_black_surface,
|
||||
onSurface = md_theme_black_onSurface,
|
||||
surfaceVariant = md_theme_black_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_black_onSurfaceVariant,
|
||||
)
|
||||
|
@ -7,7 +7,8 @@ import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.BlackColor
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.ColorSchemeProvider
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.DarkColors
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.LightColors
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.applyCustom
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.blackify
|
||||
import com.materialkolor.dynamicColorScheme
|
||||
|
||||
internal class DefaultColorSchemeProvider : ColorSchemeProvider {
|
||||
|
||||
@ -16,16 +17,30 @@ internal class DefaultColorSchemeProvider : ColorSchemeProvider {
|
||||
override fun getColorScheme(
|
||||
theme: ThemeState,
|
||||
dynamic: Boolean,
|
||||
customPrimary: Color?,
|
||||
customSecondary: Color?,
|
||||
customTertiary: Color?,
|
||||
customSeed: Color?,
|
||||
): ColorScheme = when (theme) {
|
||||
ThemeState.Dark -> DarkColors
|
||||
ThemeState.Black -> BlackColors
|
||||
else -> LightColors
|
||||
}.applyCustom(
|
||||
customPrimary,
|
||||
customSecondary,
|
||||
customTertiary
|
||||
)
|
||||
ThemeState.Dark -> {
|
||||
if (customSeed != null) {
|
||||
dynamicColorScheme(customSeed, true)
|
||||
} else {
|
||||
DarkColors
|
||||
}
|
||||
}
|
||||
|
||||
ThemeState.Black -> {
|
||||
if (customSeed != null) {
|
||||
dynamicColorScheme(customSeed, true).blackify()
|
||||
} else {
|
||||
BlackColors
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (customSeed != null) {
|
||||
dynamicColorScheme(customSeed, false)
|
||||
} else {
|
||||
LightColors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ fun BottomSheetHandle(
|
||||
.height(3.dp)
|
||||
.padding(vertical = Spacing.xxxs)
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
shape = RoundedCornerShape(1.dp),
|
||||
),
|
||||
)
|
||||
|
@ -12,7 +12,7 @@ import androidx.compose.ui.graphics.Color
|
||||
|
||||
@Composable
|
||||
fun ProgressHud(
|
||||
overlayColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.05f),
|
||||
overlayColor: Color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.05f),
|
||||
color: Color = MaterialTheme.colorScheme.primary,
|
||||
) {
|
||||
Box(
|
||||
|
@ -25,7 +25,7 @@ fun SectionSelector(
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
|
@ -71,7 +71,8 @@ class InboxChatScreen(
|
||||
val navigator = remember { getNavigationCoordinator().getRootNavigator() }
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surface).padding(Spacing.xs),
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background)
|
||||
.padding(Spacing.xs),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = {
|
||||
@ -106,7 +107,7 @@ class InboxChatScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -172,7 +173,7 @@ class InboxChatScreen(
|
||||
val focusManager = LocalFocusManager.current
|
||||
Box(
|
||||
modifier = Modifier.weight(1f).background(
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.1f),
|
||||
color = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.1f),
|
||||
shape = RoundedCornerShape(CornerSize.l)
|
||||
).padding(Spacing.s)
|
||||
) {
|
||||
@ -181,9 +182,9 @@ class InboxChatScreen(
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 20.dp, max = 200.dp),
|
||||
textStyle = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
),
|
||||
cursorBrush = SolidColor(MaterialTheme.colorScheme.onSurface),
|
||||
cursorBrush = SolidColor(MaterialTheme.colorScheme.onPrimaryContainer),
|
||||
value = uiState.newMessageContent,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = KeyboardType.Ascii,
|
||||
|
@ -126,8 +126,9 @@ class CommunityDetailScreen(
|
||||
}
|
||||
|
||||
val stateCommunity = uiState.community
|
||||
Scaffold(modifier = Modifier.background(MaterialTheme.colorScheme.surface)
|
||||
.padding(Spacing.xs),
|
||||
Scaffold(
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background)
|
||||
.padding(Spacing.xs),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
scrollBehavior = scrollBehavior,
|
||||
@ -190,7 +191,7 @@ class CommunityDetailScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -435,8 +436,8 @@ class CommunityDetailScreen(
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ fun CommentCard(
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surface)
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background)
|
||||
) {
|
||||
var commentHeight by remember { mutableStateOf(0f) }
|
||||
val barWidth = 2.dp
|
||||
@ -61,7 +61,7 @@ fun CommentCard(
|
||||
depth = comment.depth,
|
||||
maxDepth = CommentRepository.MAX_COMMENT_DEPTH,
|
||||
startColor = MaterialTheme.colorScheme.primary,
|
||||
endColor = MaterialTheme.colorScheme.surface,
|
||||
endColor = MaterialTheme.colorScheme.background,
|
||||
)
|
||||
Box(
|
||||
modifier = modifier.padding(
|
||||
@ -113,7 +113,7 @@ fun CommentCard(
|
||||
modifier = Modifier
|
||||
.height(Dp.Hairline)
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ fun CommunityAndCreatorInfo(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
if (creator != null) {
|
||||
@ -107,7 +107,7 @@ fun CommunityAndCreatorInfo(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ fun CommunityHeader(
|
||||
Text(
|
||||
text = community.name.firstOrNull()?.toString().orEmpty().uppercase(),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ fun CommunityHeader(
|
||||
Text(
|
||||
text = community.name,
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
|
||||
Text(
|
||||
@ -157,7 +157,7 @@ fun CommunityHeader(
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ fun CommunityItem(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -48,11 +48,11 @@ fun InboxMentionCard(
|
||||
modifier = Modifier.let {
|
||||
if (postLayout == PostLayout.Card) {
|
||||
it.background(
|
||||
color = MaterialTheme.colorScheme.surfaceVariant,
|
||||
color = MaterialTheme.colorScheme.primaryContainer,
|
||||
shape = RoundedCornerShape(CornerSize.l),
|
||||
).padding(Spacing.s)
|
||||
} else {
|
||||
it.background(MaterialTheme.colorScheme.surface)
|
||||
it.background(MaterialTheme.colorScheme.background)
|
||||
}
|
||||
}.onClick {
|
||||
onOpenPost(mention.post)
|
||||
|
@ -94,7 +94,7 @@ fun InboxReplySubtitle(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ fun InboxReplySubtitle(
|
||||
modifier = buttonModifier,
|
||||
imageVector = Icons.Default.Schedule,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
tint = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
Text(
|
||||
text = date?.let {
|
||||
@ -187,7 +187,7 @@ fun InboxReplySubtitle(
|
||||
.let {
|
||||
if (upVoted) {
|
||||
it.background(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
shape = CircleShape,
|
||||
)
|
||||
} else {
|
||||
@ -204,9 +204,9 @@ fun InboxReplySubtitle(
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(
|
||||
color = if (upVoted) {
|
||||
MaterialTheme.colorScheme.surface
|
||||
MaterialTheme.colorScheme.background
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onSurface
|
||||
MaterialTheme.colorScheme.onBackground
|
||||
},
|
||||
),
|
||||
)
|
||||
@ -218,7 +218,7 @@ fun InboxReplySubtitle(
|
||||
.let {
|
||||
if (downVoted) {
|
||||
it.background(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
shape = CircleShape,
|
||||
)
|
||||
} else {
|
||||
@ -236,9 +236,9 @@ fun InboxReplySubtitle(
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(
|
||||
color = if (downVoted) {
|
||||
MaterialTheme.colorScheme.surface
|
||||
MaterialTheme.colorScheme.background
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onSurface
|
||||
MaterialTheme.colorScheme.onBackground
|
||||
},
|
||||
),
|
||||
)
|
||||
|
@ -63,7 +63,7 @@ fun PostCard(
|
||||
modifier = modifier.let {
|
||||
if (postLayout == PostLayout.Card) {
|
||||
it.background(
|
||||
color = MaterialTheme.colorScheme.surfaceVariant,
|
||||
color = MaterialTheme.colorScheme.primaryContainer,
|
||||
shape = RoundedCornerShape(CornerSize.l),
|
||||
).padding(Spacing.s)
|
||||
} else {
|
||||
@ -76,8 +76,8 @@ fun PostCard(
|
||||
post = post,
|
||||
hideAuthor = hideAuthor,
|
||||
backgroundColor = when (postLayout) {
|
||||
PostLayout.Card -> MaterialTheme.colorScheme.surfaceVariant
|
||||
else -> MaterialTheme.colorScheme.surface
|
||||
PostLayout.Card -> MaterialTheme.colorScheme.primaryContainer
|
||||
else -> MaterialTheme.colorScheme.background
|
||||
},
|
||||
withOverflowBlurred = withOverflowBlurred,
|
||||
blurNsfw = blurNsfw,
|
||||
@ -128,7 +128,7 @@ private fun CompactPost(
|
||||
onOptionSelected: ((Int) -> Unit)? = null,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier.background(MaterialTheme.colorScheme.surface),
|
||||
modifier = modifier.background(MaterialTheme.colorScheme.background),
|
||||
verticalArrangement = Arrangement.spacedBy(Spacing.xxxs),
|
||||
) {
|
||||
CommunityAndCreatorInfo(
|
||||
|
@ -37,8 +37,8 @@ fun PostCardBody(
|
||||
paragraph = MaterialTheme.typography.bodyMedium,
|
||||
),
|
||||
colors = markdownColor(
|
||||
text = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
backgroundCode = MaterialTheme.colorScheme.surfaceVariant,
|
||||
text = MaterialTheme.colorScheme.onBackground,
|
||||
backgroundCode = MaterialTheme.colorScheme.background,
|
||||
),
|
||||
onOpenUrl = { url ->
|
||||
val openExternal = keyStore[KeyStoreKeys.OpenUrlsInExternalBrowser, false]
|
||||
|
@ -72,13 +72,13 @@ fun PostCardFooter(
|
||||
},
|
||||
imageVector = Icons.Default.Chat,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
Text(
|
||||
modifier = Modifier.padding(end = Spacing.s),
|
||||
text = "$comments",
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
if (date != null) {
|
||||
@ -86,7 +86,7 @@ fun PostCardFooter(
|
||||
modifier = buttonModifier.padding(1.dp),
|
||||
imageVector = Icons.Default.Schedule,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
tint = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
Text(
|
||||
text = date.let {
|
||||
@ -118,7 +118,7 @@ fun PostCardFooter(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
if (options.isNotEmpty()) {
|
||||
@ -149,7 +149,7 @@ fun PostCardFooter(
|
||||
color = if (saved) {
|
||||
MaterialTheme.colorScheme.secondary
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onSurface
|
||||
MaterialTheme.colorScheme.onBackground
|
||||
},
|
||||
),
|
||||
)
|
||||
@ -158,7 +158,7 @@ fun PostCardFooter(
|
||||
.let {
|
||||
if (upVoted) {
|
||||
it.background(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
shape = CircleShape,
|
||||
)
|
||||
} else {
|
||||
@ -175,23 +175,23 @@ fun PostCardFooter(
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(
|
||||
color = if (upVoted) {
|
||||
MaterialTheme.colorScheme.surface
|
||||
MaterialTheme.colorScheme.background
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onSurface
|
||||
MaterialTheme.colorScheme.onBackground
|
||||
},
|
||||
),
|
||||
)
|
||||
Text(
|
||||
text = "$score",
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
Image(
|
||||
modifier = buttonModifier
|
||||
.let {
|
||||
if (downVoted) {
|
||||
it.background(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
shape = CircleShape,
|
||||
)
|
||||
} else {
|
||||
@ -209,9 +209,9 @@ fun PostCardFooter(
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(
|
||||
color = if (downVoted) {
|
||||
MaterialTheme.colorScheme.surface
|
||||
MaterialTheme.colorScheme.background
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onSurface
|
||||
MaterialTheme.colorScheme.onBackground
|
||||
},
|
||||
),
|
||||
)
|
||||
|
@ -36,8 +36,8 @@ fun PostCardTitle(
|
||||
paragraph = MaterialTheme.typography.bodyMedium,
|
||||
),
|
||||
colors = markdownColor(
|
||||
text = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
backgroundCode = MaterialTheme.colorScheme.surfaceVariant,
|
||||
text = MaterialTheme.colorScheme.onBackground,
|
||||
backgroundCode = MaterialTheme.colorScheme.background,
|
||||
),
|
||||
onOpenUrl = { url ->
|
||||
val openExternal = keyStore[KeyStoreKeys.OpenUrlsInExternalBrowser, false]
|
||||
|
@ -109,7 +109,7 @@ fun UserHeader(
|
||||
.orEmpty()
|
||||
.uppercase(),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -127,7 +127,7 @@ fun UserHeader(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
Text(
|
||||
text = buildString {
|
||||
@ -138,7 +138,7 @@ fun UserHeader(
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
|
||||
// stats and age
|
||||
@ -158,7 +158,7 @@ fun UserHeader(
|
||||
Text(
|
||||
text = postScore.toString(),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
if (commentScore != null) {
|
||||
@ -173,7 +173,7 @@ fun UserHeader(
|
||||
Text(
|
||||
text = commentScore.toString(),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ fun UserHeader(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ fun UserItem(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ class CreateCommentScreen(
|
||||
Box(
|
||||
modifier = Modifier.padding(vertical = Spacing.s).fillMaxWidth().height(1.dp)
|
||||
.background(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
shape = RoundedCornerShape(1.dp),
|
||||
),
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ class ZoomableImageScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
tint = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
},
|
||||
actions = {
|
||||
@ -65,7 +65,7 @@ class ZoomableImageScreen(
|
||||
},
|
||||
imageVector = Icons.Default.Download,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
tint = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
Spacer(Modifier.width(Spacing.s))
|
||||
Icon(
|
||||
@ -74,7 +74,7 @@ class ZoomableImageScreen(
|
||||
},
|
||||
imageVector = Icons.Default.Share,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
tint = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -68,7 +68,8 @@ class InstanceInfoScreen(
|
||||
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surface).padding(Spacing.xs),
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background)
|
||||
.padding(Spacing.xs),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
scrollBehavior = scrollBehavior,
|
||||
@ -79,7 +80,7 @@ class InstanceInfoScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
title = {
|
||||
@ -177,8 +178,8 @@ class InstanceInfoScreen(
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -52,21 +52,20 @@ class ColorBottomSheet : Screen {
|
||||
BottomSheetHandle()
|
||||
Text(
|
||||
modifier = Modifier.padding(start = Spacing.s, top = Spacing.s),
|
||||
text = stringResource(MR.strings.settings_ui_theme),
|
||||
text = stringResource(MR.strings.settings_custom_seed_color),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
val values: List<Pair<Color?, String>> = listOf(
|
||||
Color.Red to "Red",
|
||||
Color.Green to "Green",
|
||||
Color.Blue to "Blue",
|
||||
Color.Cyan to "Cyan",
|
||||
Color.Magenta to "Magenta",
|
||||
Color.Yellow to "Yellow",
|
||||
Color.Gray to "Gray",
|
||||
Color.DarkGray to "Dark gray",
|
||||
Color.LightGray to "Light gray",
|
||||
Color(0xFF001F7D) to stringResource(MR.strings.settings_color_blue),
|
||||
Color(0xFF36B3B3) to stringResource(MR.strings.settings_color_aquamarine),
|
||||
Color(0xFF884DFF) to stringResource(MR.strings.settings_color_purple),
|
||||
Color(0xFF00B300) to stringResource(MR.strings.settings_color_green),
|
||||
Color(0xFFFF0000) to stringResource(MR.strings.settings_color_red),
|
||||
Color(0xFFFF66600) to stringResource(MR.strings.settings_color_orange),
|
||||
Color(0xFFFC0FC0) to stringResource(MR.strings.settings_color_pink),
|
||||
Color(0xFF303B47) to stringResource(MR.strings.settings_color_gray),
|
||||
null to stringResource(MR.strings.button_reset),
|
||||
)
|
||||
Column(
|
||||
|
@ -131,7 +131,7 @@ class PostDetailScreen(
|
||||
|
||||
val statePost = uiState.post
|
||||
Scaffold(
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surface)
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background)
|
||||
.padding(Spacing.xs),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
@ -174,7 +174,7 @@ class PostDetailScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -486,8 +486,8 @@ class PostDetailScreen(
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,8 @@ class UserDetailScreen(
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surface).padding(Spacing.xs),
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.background)
|
||||
.padding(Spacing.xs),
|
||||
topBar =
|
||||
{
|
||||
val userName = user.name
|
||||
@ -163,7 +164,7 @@ class UserDetailScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -468,8 +469,8 @@ class UserDetailScreen(
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class WebViewScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
)
|
||||
|
@ -15,8 +15,6 @@ object KeyStoreKeys {
|
||||
const val DynamicColors = "dynamicColors"
|
||||
const val OpenUrlsInExternalBrowser = "openUrlsInExternalBrowser"
|
||||
const val EnableSwipeActions = "enableSwipeActions"
|
||||
const val CustomPrimaryColor = "customPrimaryColor"
|
||||
const val CustomSecondaryColor = "customSecondaryColor"
|
||||
const val CustomTertiaryColor = "customTertiaryColor"
|
||||
const val CustomSeedColor = "customPrimaryColor"
|
||||
const val PostLayout = "postLayout"
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ class PostListScreen : Screen {
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ internal fun PostsTopBar(
|
||||
TopAppBar(
|
||||
scrollBehavior = scrollBehavior,
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
scrolledContainerColor = MaterialTheme.colorScheme.surface,
|
||||
scrolledContainerColor = MaterialTheme.colorScheme.background,
|
||||
),
|
||||
navigationIcon = {
|
||||
if (listingType != null) {
|
||||
|
@ -185,8 +185,8 @@ class InboxMentionsScreen : Tab {
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ internal fun ChatCard(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
)
|
||||
// last message text
|
||||
Text(
|
||||
@ -111,7 +111,7 @@ internal fun ChatCard(
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.9f),
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.9f),
|
||||
)
|
||||
|
||||
// last message date
|
||||
@ -125,7 +125,7 @@ internal fun ChatCard(
|
||||
modifier = buttonModifier.padding(1.dp),
|
||||
imageVector = Icons.Default.Schedule,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface,
|
||||
tint = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
Text(
|
||||
text = lastMessageDate.let {
|
||||
@ -157,7 +157,7 @@ internal fun ChatCard(
|
||||
}
|
||||
},
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ class InboxMessagesScreen : Tab {
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ class InboxRepliesScreen : Tab {
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -57,18 +57,14 @@ class ProfileContentViewModel(
|
||||
remove(KeyStoreKeys.DynamicColors)
|
||||
remove(KeyStoreKeys.OpenUrlsInExternalBrowser)
|
||||
remove(KeyStoreKeys.EnableSwipeActions)
|
||||
remove(KeyStoreKeys.CustomPrimaryColor)
|
||||
remove(KeyStoreKeys.CustomSecondaryColor)
|
||||
remove(KeyStoreKeys.CustomTertiaryColor)
|
||||
remove(KeyStoreKeys.CustomSeedColor)
|
||||
remove(KeyStoreKeys.PostLayout)
|
||||
}
|
||||
|
||||
identityRepository.clearToken()
|
||||
themeRepository.apply {
|
||||
changePostLayout(PostLayout.Card)
|
||||
changeCustomPrimaryColor(null)
|
||||
changeCustomSecondaryColor(null)
|
||||
changeCustomTertiaryColor(null)
|
||||
changeCustomSeedColor(null)
|
||||
changeDynamicColors(false)
|
||||
changeNavItemTitles(true)
|
||||
}
|
||||
|
@ -257,8 +257,8 @@ internal object ProfileLoggedScreen : Tab {
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ internal class ProfileSavedScreen(
|
||||
},
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -284,8 +284,8 @@ internal class ProfileSavedScreen(
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class LoginBottomSheet : Screen {
|
||||
Scaffold(
|
||||
modifier = Modifier
|
||||
.fillMaxHeight(0.65f)
|
||||
.background(MaterialTheme.colorScheme.surface),
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = {
|
||||
@ -225,7 +225,7 @@ class LoginBottomSheet : Screen {
|
||||
Icons.Default.Visibility
|
||||
},
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onSurface),
|
||||
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onBackground),
|
||||
)
|
||||
},
|
||||
supportingText = {
|
||||
|
@ -46,7 +46,6 @@ import androidx.compose.ui.unit.dp
|
||||
import cafe.adriel.voyager.core.model.rememberScreenModel
|
||||
import cafe.adriel.voyager.core.screen.Screen
|
||||
import cafe.adriel.voyager.navigator.bottomSheet.LocalBottomSheetNavigator
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.utils.onClick
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.PostLayout
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing
|
||||
@ -65,6 +64,7 @@ import com.github.diegoberaldin.raccoonforlemmy.core.commonui.postdetail.PostDet
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.commonui.userdetail.UserDetailScreen
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.notifications.NotificationCenterContractKeys
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.notifications.di.getNotificationCenter
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.utils.onClick
|
||||
import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.CommentModel
|
||||
import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.CommunityModel
|
||||
import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.ListingType
|
||||
@ -186,7 +186,7 @@ class ExploreScreen : Screen {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
@ -410,8 +410,8 @@ class ExploreScreen : Screen {
|
||||
refreshing = uiState.refreshing,
|
||||
state = pullRefreshState,
|
||||
modifier = Modifier.align(Alignment.TopCenter),
|
||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||
backgroundColor = MaterialTheme.colorScheme.background,
|
||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ import androidx.compose.material3.TopAppBarScrollBehavior
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.utils.onClick
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.utils.onClick
|
||||
import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.ListingType
|
||||
import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.SortType
|
||||
import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.toIcon
|
||||
@ -35,7 +35,7 @@ internal fun CommunityTopBar(
|
||||
TopAppBar(
|
||||
scrollBehavior = scrollBehavior,
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
scrolledContainerColor = MaterialTheme.colorScheme.surface,
|
||||
scrolledContainerColor = MaterialTheme.colorScheme.background,
|
||||
),
|
||||
navigationIcon = {
|
||||
Image(
|
||||
|
@ -135,10 +135,10 @@ class SettingsScreen : Screen {
|
||||
}
|
||||
|
||||
val colorSchemeProvider = remember { getColorSchemeProvider() }
|
||||
// custom primary color
|
||||
// custom scheme seed color
|
||||
SettingsColorRow(
|
||||
title = stringResource(MR.strings.settings_primary_color),
|
||||
value = uiState.customPrimaryColor ?: colorSchemeProvider.getColorScheme(
|
||||
title = stringResource(MR.strings.settings_custom_seed_color),
|
||||
value = uiState.customSeedColor ?: colorSchemeProvider.getColorScheme(
|
||||
theme = uiState.currentTheme,
|
||||
dynamic = uiState.dynamicColors,
|
||||
).primary,
|
||||
@ -146,47 +146,7 @@ class SettingsScreen : Screen {
|
||||
val sheet = ColorBottomSheet()
|
||||
notificationCenter.addObserver({ result ->
|
||||
model.reduce(
|
||||
SettingsScreenMviModel.Intent.ChangeCustomPrimaryColor(
|
||||
result as? Color?
|
||||
)
|
||||
)
|
||||
}, key, NotificationCenterContractKeys.ChangeColor)
|
||||
bottomSheetNavigator.show(sheet)
|
||||
},
|
||||
)
|
||||
|
||||
// custom secondary color
|
||||
SettingsColorRow(
|
||||
title = stringResource(MR.strings.settings_secondary_color),
|
||||
value = uiState.customSecondaryColor ?: colorSchemeProvider.getColorScheme(
|
||||
theme = uiState.currentTheme,
|
||||
dynamic = uiState.dynamicColors,
|
||||
).secondary,
|
||||
onTap = {
|
||||
val sheet = ColorBottomSheet()
|
||||
notificationCenter.addObserver({ result ->
|
||||
model.reduce(
|
||||
SettingsScreenMviModel.Intent.ChangeCustomSecondaryColor(
|
||||
result as? Color?
|
||||
)
|
||||
)
|
||||
}, key, NotificationCenterContractKeys.ChangeColor)
|
||||
bottomSheetNavigator.show(sheet)
|
||||
},
|
||||
)
|
||||
|
||||
// custom tertiary color
|
||||
SettingsColorRow(
|
||||
title = stringResource(MR.strings.settings_tertiary_color),
|
||||
value = uiState.customTertiaryColor ?: colorSchemeProvider.getColorScheme(
|
||||
theme = uiState.currentTheme,
|
||||
dynamic = uiState.dynamicColors,
|
||||
).tertiary,
|
||||
onTap = {
|
||||
val sheet = ColorBottomSheet()
|
||||
notificationCenter.addObserver({ result ->
|
||||
model.reduce(
|
||||
SettingsScreenMviModel.Intent.ChangeCustomTertiaryColor(
|
||||
SettingsScreenMviModel.Intent.ChangeCustomSeedColor(
|
||||
result as? Color?
|
||||
)
|
||||
)
|
||||
|
@ -25,17 +25,13 @@ interface SettingsScreenMviModel :
|
||||
data class ChangeBlurNsfw(val value: Boolean) : Intent
|
||||
data class ChangeOpenUrlsInExternalBrowser(val value: Boolean) : Intent
|
||||
data class ChangeEnableSwipeActions(val value: Boolean) : Intent
|
||||
data class ChangeCustomPrimaryColor(val value: Color?) : Intent
|
||||
data class ChangeCustomSecondaryColor(val value: Color?) : Intent
|
||||
data class ChangeCustomTertiaryColor(val value: Color?) : Intent
|
||||
data class ChangeCustomSeedColor(val value: Color?) : Intent
|
||||
}
|
||||
|
||||
data class UiState(
|
||||
val isLogged: Boolean = false,
|
||||
val currentTheme: ThemeState = ThemeState.Light,
|
||||
val customPrimaryColor: Color? = null,
|
||||
val customSecondaryColor: Color? = null,
|
||||
val customTertiaryColor: Color? = null,
|
||||
val customSeedColor: Color? = null,
|
||||
val currentFontScale: FontScale = FontScale.Normal,
|
||||
val lang: String = "",
|
||||
val postLayout: PostLayout = PostLayout.Card,
|
||||
|
@ -66,14 +66,8 @@ class SettingsScreenViewModel(
|
||||
themeRepository.dynamicColors.onEach { value ->
|
||||
mvi.updateState { it.copy(dynamicColors = value) }
|
||||
}.launchIn(this)
|
||||
themeRepository.customPrimaryColor.onEach { value ->
|
||||
mvi.updateState { it.copy(customPrimaryColor = value) }
|
||||
}.launchIn(this)
|
||||
themeRepository.customSecondaryColor.onEach { value ->
|
||||
mvi.updateState { it.copy(customSecondaryColor = value) }
|
||||
}.launchIn(this)
|
||||
themeRepository.customTertiaryColor.onEach { value ->
|
||||
mvi.updateState { it.copy(customTertiaryColor = value) }
|
||||
themeRepository.customSeedColor.onEach { value ->
|
||||
mvi.updateState { it.copy(customSeedColor = value) }
|
||||
}.launchIn(this)
|
||||
themeRepository.postLayout.onEach { value ->
|
||||
mvi.updateState { it.copy(postLayout = value) }
|
||||
@ -156,15 +150,7 @@ class SettingsScreenViewModel(
|
||||
changeEnableSwipeActions(intent.value)
|
||||
}
|
||||
|
||||
is SettingsScreenMviModel.Intent.ChangeCustomPrimaryColor -> changeCustomPrimaryColor(
|
||||
intent.value
|
||||
)
|
||||
|
||||
is SettingsScreenMviModel.Intent.ChangeCustomSecondaryColor -> changeCustomSecondaryColor(
|
||||
intent.value
|
||||
)
|
||||
|
||||
is SettingsScreenMviModel.Intent.ChangeCustomTertiaryColor -> changeCustomTertiaryColor(
|
||||
is SettingsScreenMviModel.Intent.ChangeCustomSeedColor -> changeCustomSeedColor(
|
||||
intent.value
|
||||
)
|
||||
|
||||
@ -222,30 +208,12 @@ class SettingsScreenViewModel(
|
||||
keyStore.save(KeyStoreKeys.DynamicColors, value)
|
||||
}
|
||||
|
||||
private fun changeCustomPrimaryColor(value: Color?) {
|
||||
themeRepository.changeCustomPrimaryColor(value)
|
||||
private fun changeCustomSeedColor(value: Color?) {
|
||||
themeRepository.changeCustomSeedColor(value)
|
||||
if (value != null) {
|
||||
keyStore.save(KeyStoreKeys.CustomPrimaryColor, value.toArgb())
|
||||
keyStore.save(KeyStoreKeys.CustomSeedColor, value.toArgb())
|
||||
} else {
|
||||
keyStore.remove(KeyStoreKeys.CustomPrimaryColor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeCustomSecondaryColor(value: Color?) {
|
||||
themeRepository.changeCustomSecondaryColor(value)
|
||||
if (value != null) {
|
||||
keyStore.save(KeyStoreKeys.CustomSecondaryColor, value.toArgb())
|
||||
} else {
|
||||
keyStore.remove(KeyStoreKeys.CustomSecondaryColor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeCustomTertiaryColor(value: Color?) {
|
||||
themeRepository.changeCustomTertiaryColor(value)
|
||||
if (value != null) {
|
||||
keyStore.save(KeyStoreKeys.CustomTertiaryColor, value.toArgb())
|
||||
} else {
|
||||
keyStore.remove(KeyStoreKeys.CustomTertiaryColor)
|
||||
keyStore.remove(KeyStoreKeys.CustomSeedColor)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ ktor = "2.3.4"
|
||||
ktorfit_gradle = "1.7.0"
|
||||
ktorfit_lib = "1.7.0"
|
||||
markdown = "0.5.0"
|
||||
materialKolor = "1.2.5"
|
||||
moko_resources = "0.23.0"
|
||||
multiplatform_settings = "1.0.0"
|
||||
voyager = "1.0.0-rc07"
|
||||
@ -43,6 +44,8 @@ ktor_json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref =
|
||||
ktorfit_ksp = { module = "de.jensklingenberg.ktorfit:ktorfit-ksp", version.ref = "ktorfit.lib" }
|
||||
ktorfit_lib = { module = "de.jensklingenberg.ktorfit:ktorfit-lib", version.ref = "ktorfit.lib" }
|
||||
|
||||
materialKolor = { module = "com.materialkolor:material-kolor", version.ref = "materialKolor" }
|
||||
|
||||
moko_gradle = { module = "dev.icerock.moko:resources-generator", version.ref = "moko.resources" }
|
||||
moko_resources = { module = "dev.icerock.moko:resources", version.ref = "moko.resources" }
|
||||
moko_resources_compose = { module = "dev.icerock.moko:resources-compose", version.ref = "moko.resources" }
|
||||
|
@ -18,7 +18,7 @@
|
||||
<string name="message_login_successful">🎉 Login successful! 🎉</string>
|
||||
|
||||
<string name="button_confirm">Confirm</string>
|
||||
<string name="button_reset">Reset default</string>
|
||||
<string name="button_reset">Reset</string>
|
||||
|
||||
<string name="home_listing_type_all">All</string>
|
||||
<string name="home_listing_type_local">Local</string>
|
||||
@ -105,13 +105,19 @@
|
||||
<string name="settings_dynamic_colors">Use dynamic colors</string>
|
||||
<string name="settings_open_url_external">Open URLs in external browser</string>
|
||||
<string name="settings_enable_swipe_actions">Enable swipe actions</string>
|
||||
<string name="settings_primary_color">Primary color</string>
|
||||
<string name="settings_secondary_color">Secondary color</string>
|
||||
<string name="settings_tertiary_color">Tertiary color</string>
|
||||
<string name="settings_custom_seed_color">Custom theme color</string>
|
||||
<string name="settings_post_layout">Post layout</string>
|
||||
<string name="settings_post_layout_list">List</string>
|
||||
<string name="settings_post_layout_card">Card</string>
|
||||
<string name="settings_post_layout_full">Full</string>
|
||||
<string name="settings_color_blue">Corporate blue</string>
|
||||
<string name="settings_color_aquamarine">Aquamarine</string>
|
||||
<string name="settings_color_purple">Iris</string>
|
||||
<string name="settings_color_green">Peppermint</string>
|
||||
<string name="settings_color_red">Bright red</string>
|
||||
<string name="settings_color_orange">Orance juice</string>
|
||||
<string name="settings_color_pink">Shocking pink</string>
|
||||
<string name="settings_color_gray">Concrete</string>
|
||||
|
||||
<string name="community_detail_info">Community info</string>
|
||||
<string name="community_detail_instance_info">Instance details</string>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<string name="message_login_successful">🎉 Login effettuato con successo! 🎉</string>
|
||||
|
||||
<string name="button_confirm">Conferma</string>
|
||||
<string name="button_reset">Ripristina predefinito</string>
|
||||
<string name="button_reset">Reset</string>
|
||||
|
||||
<string name="home_listing_type_all">Tutti</string>
|
||||
<string name="home_listing_type_local">Locali</string>
|
||||
@ -103,13 +103,19 @@
|
||||
<string name="settings_dynamic_colors">Usa colori dinamici</string>
|
||||
<string name="settings_open_url_external">Apri URL su browser esterno</string>
|
||||
<string name="settings_enable_swipe_actions">Consenti azioni allo swipe</string>
|
||||
<string name="settings_primary_color">Colore primario</string>
|
||||
<string name="settings_secondary_color">Colore secondario</string>
|
||||
<string name="settings_tertiary_color">Colore terziario</string>
|
||||
<string name="settings_custom_seed_color">Colore tema personalizzato</string>
|
||||
<string name="settings_post_layout">Layout post</string>
|
||||
<string name="settings_post_layout_list">Lista</string>
|
||||
<string name="settings_post_layout_card">Carta</string>
|
||||
<string name="settings_post_layout_full">Intero</string>
|
||||
<string name="settings_color_blue">Blu aziendale</string>
|
||||
<string name="settings_color_aquamarine">Acquamarina</string>
|
||||
<string name="settings_color_purple">Iris</string>
|
||||
<string name="settings_color_green">Menta piperita</string>
|
||||
<string name="settings_color_red">Rosso fuoco</string>
|
||||
<string name="settings_color_orange">Aranciata</string>
|
||||
<string name="settings_color_pink">Rosa shocking</string>
|
||||
<string name="settings_color_gray">Cemento</string>
|
||||
|
||||
<string name="community_detail_info">Info comunità</string>
|
||||
<string name="community_detail_instance_info">Dettagli istanza</string>
|
||||
|
@ -69,23 +69,15 @@ fun App() {
|
||||
val themeRepository = remember { getThemeRepository() }
|
||||
val navTitles = keyStore[KeyStoreKeys.NavItemTitlesVisible, false]
|
||||
val dynamicColors = keyStore[KeyStoreKeys.DynamicColors, false]
|
||||
val customPrimaryColor = if (keyStore.containsKey(KeyStoreKeys.CustomPrimaryColor)) {
|
||||
Color(keyStore[KeyStoreKeys.CustomPrimaryColor, Color.Black.toArgb()])
|
||||
} else null
|
||||
val customSecondaryColor = if (keyStore.containsKey(KeyStoreKeys.CustomSecondaryColor)) {
|
||||
Color(keyStore[KeyStoreKeys.CustomSecondaryColor, Color.Black.toArgb()])
|
||||
} else null
|
||||
val customTertiaryColor = if (keyStore.containsKey(KeyStoreKeys.CustomTertiaryColor)) {
|
||||
Color(keyStore[KeyStoreKeys.CustomTertiaryColor, Color.Black.toArgb()])
|
||||
val customSeedColor = if (keyStore.containsKey(KeyStoreKeys.CustomSeedColor)) {
|
||||
Color(keyStore[KeyStoreKeys.CustomSeedColor, Color.Black.toArgb()])
|
||||
} else null
|
||||
val postLayout = keyStore[KeyStoreKeys.PostLayout, PostLayout.Card.toInt()].toPostLayout()
|
||||
LaunchedEffect(Unit) {
|
||||
with(themeRepository) {
|
||||
changeNavItemTitles(navTitles)
|
||||
changeDynamicColors(dynamicColors)
|
||||
changeCustomPrimaryColor(customPrimaryColor)
|
||||
changeCustomSecondaryColor(customSecondaryColor)
|
||||
changeCustomTertiaryColor(customTertiaryColor)
|
||||
changeCustomSeedColor(customSeedColor)
|
||||
changePostLayout(postLayout)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user