From 8933b41937940d53274839695c8cb04f881a8e95 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 23 Apr 2022 12:42:35 -0400 Subject: [PATCH] Tweak about preferences styles --- .../presentation/components/Preferences.kt | 33 ++++++++++--------- .../presentation/more/LicensesScreen.kt | 5 ++- .../eu/kanade/presentation/more/LogoHeader.kt | 3 +- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/Preferences.kt b/app/src/main/java/eu/kanade/presentation/components/Preferences.kt index a604c513c..74343b4e1 100644 --- a/app/src/main/java/eu/kanade/presentation/components/Preferences.kt +++ b/app/src/main/java/eu/kanade/presentation/components/Preferences.kt @@ -5,23 +5,27 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.requiredHeight import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.widthIn import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text -import androidx.compose.material3.contentColorFor import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import eu.kanade.presentation.util.horizontalPadding +@Composable +fun Divider() { + androidx.compose.material3.Divider( + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.2f), + ) +} + @Composable fun PreferenceRow( title: String, @@ -33,15 +37,17 @@ fun PreferenceRow( ) { val height = if (subtitle != null) 72.dp else 56.dp - // TODO: adjust text styles, especially subtitles - val textStyle = MaterialTheme.typography.titleMedium.copy( - color = contentColorFor(MaterialTheme.colorScheme.background), + val titleTextStyle = MaterialTheme.typography.bodyLarge.copy( + color = MaterialTheme.colorScheme.onSurface, + ) + val subtitleTextStyle = MaterialTheme.typography.bodyMedium.copy( + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f), ) Row( modifier = Modifier .fillMaxWidth() - .requiredHeight(height) + .heightIn(min = height) .combinedClickable( onLongClick = onLongClick, onClick = onClick @@ -65,18 +71,13 @@ fun PreferenceRow( ) { Text( text = title, - overflow = TextOverflow.Ellipsis, - maxLines = 1, - style = textStyle, + style = titleTextStyle, ) if (subtitle != null) { Text( + modifier = Modifier.padding(top = 4.dp), text = subtitle, - overflow = TextOverflow.Ellipsis, - maxLines = 1, - style = textStyle.copy( - fontWeight = FontWeight.Normal, - ), + style = subtitleTextStyle, ) } } diff --git a/app/src/main/java/eu/kanade/presentation/more/LicensesScreen.kt b/app/src/main/java/eu/kanade/presentation/more/LicensesScreen.kt index 11460813e..f4d048007 100644 --- a/app/src/main/java/eu/kanade/presentation/more/LicensesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/LicensesScreen.kt @@ -2,7 +2,6 @@ package eu.kanade.presentation.more import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.contentColorFor import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.NestedScrollConnection @@ -20,9 +19,9 @@ fun LicensesScreen( .nestedScroll(nestedScrollInterop), colors = LibraryDefaults.libraryColors( backgroundColor = MaterialTheme.colorScheme.background, - contentColor = contentColorFor(MaterialTheme.colorScheme.background), + contentColor = MaterialTheme.colorScheme.onBackground, badgeBackgroundColor = MaterialTheme.colorScheme.primary, - badgeContentColor = contentColorFor(MaterialTheme.colorScheme.primary), + badgeContentColor = MaterialTheme.colorScheme.onPrimary, ), ) } diff --git a/app/src/main/java/eu/kanade/presentation/more/LogoHeader.kt b/app/src/main/java/eu/kanade/presentation/more/LogoHeader.kt index 4d23f1702..3506ed505 100644 --- a/app/src/main/java/eu/kanade/presentation/more/LogoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/more/LogoHeader.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.material3.Divider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -12,6 +11,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp +import eu.kanade.presentation.components.Divider import eu.kanade.tachiyomi.R @Composable @@ -30,7 +30,6 @@ fun LogoHeader() { ) } - // TODO: proper color Divider() } }