From 8851071d58a0c698f59eaf9d1053d9803e6149fa Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 5 Oct 2022 11:50:22 +0530 Subject: [PATCH] refactor(common): resolve Detekt-reported issues --- .../dev/msfjarvis/claw/common/comments/CommentEntry.kt | 9 ++++++++- .../main/kotlin/dev/msfjarvis/claw/common/theme/Theme.kt | 3 ++- detekt-baselines/common.xml | 6 +----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt index bce70fab..3b3cd62f 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentEntry.kt @@ -129,6 +129,8 @@ fun PostLink( } } +private val CommentEntryPadding = 16f.dp + @OptIn(ExperimentalAnimationApi::class) @Composable fun CommentEntry( @@ -144,7 +146,12 @@ fun CommentEntry( .fillMaxWidth() .clickable { expanded = !expanded } .background(MaterialTheme.colorScheme.background) - .padding(start = (comment.indentLevel * 16).dp, end = 16.dp, top = 16.dp, bottom = 16.dp), + .padding( + start = CommentEntryPadding * comment.indentLevel, + end = CommentEntryPadding, + top = CommentEntryPadding, + bottom = CommentEntryPadding, + ), ) { Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { Submitter( diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/theme/Theme.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/theme/Theme.kt index 2e9c7a08..fe9b22dc 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/theme/Theme.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/theme/Theme.kt @@ -71,6 +71,7 @@ internal val DarkThemeColors = inverseSurface = md_theme_dark_inverseSurface, ) +@Suppress("SpreadOperator") @Composable fun LobstersTheme( darkTheme: Boolean = isSystemInDarkTheme(), @@ -80,7 +81,7 @@ fun LobstersTheme( ) { val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= 31 -> { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { val context = LocalContext.current if (darkTheme) { dynamicDarkColorScheme(context) diff --git a/detekt-baselines/common.xml b/detekt-baselines/common.xml index ce05be31..05308663 100644 --- a/detekt-baselines/common.xml +++ b/detekt-baselines/common.xml @@ -1,9 +1,5 @@ - - MagicNumber:CommentEntry.kt$16 - MagicNumber:Theme.kt$31 - SpreadOperator:Theme.kt$(*providedValues) - +