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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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