Minor cleanup

This commit is contained in:
arkon 2022-04-24 14:39:51 -04:00
parent 29a0989f28
commit 0ec9496d26
9 changed files with 31 additions and 43 deletions

View File

@ -24,8 +24,6 @@ fun AppBarTitle(
title: String?, title: String?,
subtitle: String? = null, subtitle: String? = null,
) { ) {
val subtitleTextStyle = MaterialTheme.typography.bodyMedium
Column { Column {
title?.let { title?.let {
Text( Text(
@ -37,7 +35,7 @@ fun AppBarTitle(
subtitle?.let { subtitle?.let {
Text( Text(
text = it, text = it,
style = subtitleTextStyle, style = MaterialTheme.typography.bodyMedium,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
@ -54,7 +52,7 @@ fun AppBarActions(
actions.filterIsInstance<AppBar.Action>().map { actions.filterIsInstance<AppBar.Action>().map {
IconButton( IconButton(
onClick = it.onClick, onClick = it.onClick,
enabled = it.isEnabled, enabled = it.enabled,
) { ) {
Icon( Icon(
imageVector = it.icon, imageVector = it.icon,
@ -71,7 +69,7 @@ fun AppBarActions(
DropdownMenu( DropdownMenu(
expanded = showMenu, expanded = showMenu,
onDismissRequest = { showMenu = false } onDismissRequest = { showMenu = false },
) { ) {
overflowActions.map { overflowActions.map {
DropdownMenuItem( DropdownMenuItem(
@ -93,7 +91,7 @@ object AppBar {
val title: String, val title: String,
val icon: ImageVector, val icon: ImageVector,
val onClick: () -> Unit, val onClick: () -> Unit,
val isEnabled: Boolean = true, val enabled: Boolean = true,
) : AppBarAction ) : AppBarAction
data class OverflowAction( data class OverflowAction(

View File

@ -1,8 +1,8 @@
package eu.kanade.presentation.components package eu.kanade.presentation.components
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -28,12 +28,12 @@ fun LinkIcon(
painter: Painter, painter: Painter,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
Icon( IconButton(onClick = onClick) {
modifier = modifier Icon(
.clickable(onClick = onClick) modifier = modifier.padding(16.dp),
.padding(16.dp), painter = painter,
painter = painter, tint = MaterialTheme.colorScheme.primary,
tint = MaterialTheme.colorScheme.primary, contentDescription = label,
contentDescription = label, )
) }
} }

View File

@ -39,9 +39,7 @@ fun PreferenceRow(
) { ) {
val height = if (subtitle != null) 72.dp else 56.dp val height = if (subtitle != null) 72.dp else 56.dp
val titleTextStyle = MaterialTheme.typography.bodyLarge.copy( val titleTextStyle = MaterialTheme.typography.bodyLarge
color = MaterialTheme.colorScheme.onSurface,
)
val subtitleTextStyle = MaterialTheme.typography.bodyMedium.copy( val subtitleTextStyle = MaterialTheme.typography.bodyMedium.copy(
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f), color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f),
) )

View File

@ -180,9 +180,7 @@ fun HistoryItem(
.weight(1f) .weight(1f)
.padding(start = horizontalPadding, end = 8.dp), .padding(start = horizontalPadding, end = 8.dp),
) { ) {
val textStyle = MaterialTheme.typography.bodyMedium.copy( val textStyle = MaterialTheme.typography.bodyMedium
color = MaterialTheme.colorScheme.onSurface,
)
Text( Text(
text = history.title, text = history.title,
maxLines = 2, maxLines = 2,
@ -201,7 +199,7 @@ fun HistoryItem(
history.readAt?.toTimestampString() ?: "" history.readAt?.toTimestampString() ?: ""
}, },
modifier = Modifier.padding(top = 4.dp), modifier = Modifier.padding(top = 4.dp),
style = textStyle style = textStyle,
) )
} }
} }

View File

@ -65,9 +65,7 @@ fun AboutScreen(
item { item {
PreferenceRow( PreferenceRow(
title = stringResource(R.string.check_for_updates), title = stringResource(R.string.check_for_updates),
onClick = { onClick = checkVersion,
checkVersion()
},
) )
} }
} }
@ -75,9 +73,7 @@ fun AboutScreen(
item { item {
PreferenceRow( PreferenceRow(
title = stringResource(R.string.whats_new), title = stringResource(R.string.whats_new),
onClick = { onClick = { uriHandler.openUri(RELEASE_URL) },
uriHandler.openUri(RELEASE_URL)
},
) )
} }
} }

View File

@ -86,21 +86,21 @@ fun MoreScreen(
} }
}, },
painter = rememberVectorPainter(Icons.Outlined.GetApp), painter = rememberVectorPainter(Icons.Outlined.GetApp),
onClick = { onClickDownloadQueue() }, onClick = onClickDownloadQueue,
) )
} }
item { item {
PreferenceRow( PreferenceRow(
title = stringResource(R.string.categories), title = stringResource(R.string.categories),
painter = rememberVectorPainter(Icons.Outlined.Label), painter = rememberVectorPainter(Icons.Outlined.Label),
onClick = { onClickCategories() }, onClick = onClickCategories,
) )
} }
item { item {
PreferenceRow( PreferenceRow(
title = stringResource(R.string.label_backup), title = stringResource(R.string.label_backup),
painter = rememberVectorPainter(Icons.Outlined.SettingsBackupRestore), painter = rememberVectorPainter(Icons.Outlined.SettingsBackupRestore),
onClick = { onClickBackupAndRestore() }, onClick = onClickBackupAndRestore,
) )
} }
@ -110,14 +110,14 @@ fun MoreScreen(
PreferenceRow( PreferenceRow(
title = stringResource(R.string.label_settings), title = stringResource(R.string.label_settings),
painter = rememberVectorPainter(Icons.Outlined.Settings), painter = rememberVectorPainter(Icons.Outlined.Settings),
onClick = { onClickSettings() }, onClick = onClickSettings,
) )
} }
item { item {
PreferenceRow( PreferenceRow(
title = stringResource(R.string.pref_category_about), title = stringResource(R.string.pref_category_about),
painter = rememberVectorPainter(Icons.Outlined.Info), painter = rememberVectorPainter(Icons.Outlined.Info),
onClick = { onClickAbout() }, onClick = onClickAbout,
) )
} }
item { item {

View File

@ -10,12 +10,12 @@ fun TachiyomiTheme(content: @Composable () -> Unit) {
val context = LocalContext.current val context = LocalContext.current
val (colorScheme, typography) = createMdc3Theme( val (colorScheme, typography) = createMdc3Theme(
context = context, context = context,
setTextColors = true setTextColors = true,
) )
MaterialTheme( MaterialTheme(
colorScheme = colorScheme!!, colorScheme = colorScheme!!,
typography = typography!!, typography = typography!!,
content = content content = content,
) )
} }

View File

@ -8,9 +8,7 @@ import androidx.compose.ui.text.font.FontWeight
val Typography.header: TextStyle val Typography.header: TextStyle
@Composable @Composable
get() { get() = bodyMedium.copy(
return bodyMedium.copy( color = MaterialTheme.colorScheme.onSurfaceVariant,
color = MaterialTheme.colorScheme.onSurfaceVariant, fontWeight = FontWeight.SemiBold,
fontWeight = FontWeight.SemiBold )
)
}

View File

@ -73,7 +73,7 @@ fun WebViewScreen(
navigator.navigateBack() navigator.navigateBack()
} }
}, },
isEnabled = navigator.canGoBack, enabled = navigator.canGoBack,
), ),
AppBar.Action( AppBar.Action(
title = stringResource(R.string.action_webview_forward), title = stringResource(R.string.action_webview_forward),
@ -83,7 +83,7 @@ fun WebViewScreen(
navigator.navigateForward() navigator.navigateForward()
} }
}, },
isEnabled = navigator.canGoForward, enabled = navigator.canGoForward,
), ),
AppBar.OverflowAction( AppBar.OverflowAction(
title = stringResource(R.string.action_webview_refresh), title = stringResource(R.string.action_webview_refresh),