Tweak about preferences styles

This commit is contained in:
arkon 2022-04-23 12:42:35 -04:00
parent 7e2f1d729f
commit 8933b41937
3 changed files with 20 additions and 21 deletions

View File

@ -5,23 +5,27 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.widthIn
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector 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 androidx.compose.ui.unit.dp
import eu.kanade.presentation.util.horizontalPadding import eu.kanade.presentation.util.horizontalPadding
@Composable
fun Divider() {
androidx.compose.material3.Divider(
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.2f),
)
}
@Composable @Composable
fun PreferenceRow( fun PreferenceRow(
title: String, title: String,
@ -33,15 +37,17 @@ fun PreferenceRow(
) { ) {
val height = if (subtitle != null) 72.dp else 56.dp val height = if (subtitle != null) 72.dp else 56.dp
// TODO: adjust text styles, especially subtitles val titleTextStyle = MaterialTheme.typography.bodyLarge.copy(
val textStyle = MaterialTheme.typography.titleMedium.copy( color = MaterialTheme.colorScheme.onSurface,
color = contentColorFor(MaterialTheme.colorScheme.background), )
val subtitleTextStyle = MaterialTheme.typography.bodyMedium.copy(
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f),
) )
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.requiredHeight(height) .heightIn(min = height)
.combinedClickable( .combinedClickable(
onLongClick = onLongClick, onLongClick = onLongClick,
onClick = onClick onClick = onClick
@ -65,18 +71,13 @@ fun PreferenceRow(
) { ) {
Text( Text(
text = title, text = title,
overflow = TextOverflow.Ellipsis, style = titleTextStyle,
maxLines = 1,
style = textStyle,
) )
if (subtitle != null) { if (subtitle != null) {
Text( Text(
modifier = Modifier.padding(top = 4.dp),
text = subtitle, text = subtitle,
overflow = TextOverflow.Ellipsis, style = subtitleTextStyle,
maxLines = 1,
style = textStyle.copy(
fontWeight = FontWeight.Normal,
),
) )
} }
} }

View File

@ -2,7 +2,6 @@ package eu.kanade.presentation.more
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
@ -20,9 +19,9 @@ fun LicensesScreen(
.nestedScroll(nestedScrollInterop), .nestedScroll(nestedScrollInterop),
colors = LibraryDefaults.libraryColors( colors = LibraryDefaults.libraryColors(
backgroundColor = MaterialTheme.colorScheme.background, backgroundColor = MaterialTheme.colorScheme.background,
contentColor = contentColorFor(MaterialTheme.colorScheme.background), contentColor = MaterialTheme.colorScheme.onBackground,
badgeBackgroundColor = MaterialTheme.colorScheme.primary, badgeBackgroundColor = MaterialTheme.colorScheme.primary,
badgeContentColor = contentColorFor(MaterialTheme.colorScheme.primary), badgeContentColor = MaterialTheme.colorScheme.onPrimary,
), ),
) )
} }

View File

@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.material3.Divider
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
@ -12,6 +11,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.Divider
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@Composable @Composable
@ -30,7 +30,6 @@ fun LogoHeader() {
) )
} }
// TODO: proper color
Divider() Divider()
} }
} }