From 0ec9496d26e2904a46c744c8a979a0947d38518e Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 24 Apr 2022 14:39:51 -0400 Subject: [PATCH] Minor cleanup --- .../kanade/presentation/components/AppBar.kt | 10 ++++------ .../kanade/presentation/components/LinkIcon.kt | 18 +++++++++--------- .../presentation/components/Preferences.kt | 4 +--- .../presentation/history/HistoryScreen.kt | 6 ++---- .../eu/kanade/presentation/more/AboutScreen.kt | 8 ++------ .../eu/kanade/presentation/more/MoreScreen.kt | 10 +++++----- .../presentation/theme/TachiyomiTheme.kt | 4 ++-- .../eu/kanade/presentation/theme/Typography.kt | 10 ++++------ .../presentation/webview/WebViewScreen.kt | 4 ++-- 9 files changed, 31 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt index 9a1acbf45..09b18a7fd 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt @@ -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().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( diff --git a/app/src/main/java/eu/kanade/presentation/components/LinkIcon.kt b/app/src/main/java/eu/kanade/presentation/components/LinkIcon.kt index 8d9adcf8e..31b06762e 100644 --- a/app/src/main/java/eu/kanade/presentation/components/LinkIcon.kt +++ b/app/src/main/java/eu/kanade/presentation/components/LinkIcon.kt @@ -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, + ) + } } 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 d0be06ded..b3db495b2 100644 --- a/app/src/main/java/eu/kanade/presentation/components/Preferences.kt +++ b/app/src/main/java/eu/kanade/presentation/components/Preferences.kt @@ -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), ) diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt index b96e32106..ed9f6738a 100644 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt @@ -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, ) } } diff --git a/app/src/main/java/eu/kanade/presentation/more/AboutScreen.kt b/app/src/main/java/eu/kanade/presentation/more/AboutScreen.kt index 2647d8932..5c8cd17c6 100644 --- a/app/src/main/java/eu/kanade/presentation/more/AboutScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/AboutScreen.kt @@ -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) }, ) } } diff --git a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt index 945af6f14..9ceade06d 100644 --- a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt @@ -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 { diff --git a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt index 1ce2b579e..a0cc3b47e 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt @@ -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, ) } diff --git a/app/src/main/java/eu/kanade/presentation/theme/Typography.kt b/app/src/main/java/eu/kanade/presentation/theme/Typography.kt index 74bd03fdf..537424e88 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/Typography.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/Typography.kt @@ -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, + ) diff --git a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt index aece16b97..9cd9652ff 100644 --- a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt @@ -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),