Skip to content

Commit

Permalink
Apply new ktlint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
soulcramer committed Feb 1, 2024
1 parent f772341 commit 3e314e4
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ private fun AppIcon() {
modifier = Modifier
.padding(start = 16.dp)
.size(24.dp),
painter = painter, // spark logo
// spark logo
painter = painter,
contentDescription = null,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ internal val KleinanzeigenLight: SparkColors = lightSparkColors(
onSupportVariant = White,
success = Green600,
onSuccess = White,
successContainer = Green100, // == surface disabled
successContainer = Green100,
onSuccessContainer = Green600,
alert = Yellow300,
onAlert = Neutral900,
Expand Down Expand Up @@ -168,7 +168,7 @@ internal val KleinanzeigenDark: SparkColors = lightSparkColors(
onSupport = Neutral900,
supportContainer = Green700,
onSupportContainer = Green100,
supportVariant = Green800, // tertiary => neutral / Dim 1
supportVariant = Green800,
onSupportVariant = White,
success = Green100,
onSuccess = Neutral900,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ internal val LeboncoinColorPartLightLegacy: SparkColors = lightSparkColors(
onAccentVariant = Color.White,
basic = BrikkeBlack,
onBasic = Color.White,
basicContainer = BrikkeGreyLight, // Highlight Surface => backgroundVariant
// Highlight Surface => backgroundVariant
basicContainer = BrikkeGreyLight,
onBasicContainer = Blueberry900,
main = BrikkeOrange,
onMain = Color.White,
Expand All @@ -211,9 +212,11 @@ internal val LeboncoinColorPartLightLegacy: SparkColors = lightSparkColors(
onMainVariant = Color.White,
support = BrikkeBlack,
onSupport = Color.White,
supportContainer = BrikkeGreyLight, // Highlight Surface => backgroundVariant
// Highlight Surface => backgroundVariant
supportContainer = BrikkeGreyLight,
onSupportContainer = Blueberry900,
supportVariant = BrikkeGreyDark, // tertiary => neutral / Dim 1
// tertiary => neutral / Dim 1
supportVariant = BrikkeGreyDark,
onSupportVariant = Grey10,
tertiary = BrikkeGrey,
onTertiary = GreyBlue99,
Expand All @@ -237,11 +240,13 @@ internal val LeboncoinColorPartLightLegacy: SparkColors = lightSparkColors(
onInfoContainer = Blueberry700,
neutral = NightShade50,
onNeutral = Color.White,
neutralContainer = NightShade50, // == surface Highlight
// == surface Highlight
neutralContainer = NightShade50,
onNeutralContainer = NightShade700,
background = Color.White,
onBackground = Blueberry900,
backgroundVariant = GreyBlue90, // == surface disabled
// == surface disabled
backgroundVariant = GreyBlue90,
onBackgroundVariant = GreyBlue30,
surface = Color.White,
onSurface = Grey10,
Expand All @@ -266,7 +271,8 @@ internal val LeboncoinColorProLightLegacy: SparkColors = lightSparkColors(
onAccentVariant = Color.White,
basic = BrikkeBlack,
onBasic = Color.White,
basicContainer = BrikkeGreyLight, // Highlight Surface => backgroundVariant
// Highlight Surface => backgroundVariant
basicContainer = BrikkeGreyLight,
onBasicContainer = Blueberry900,
main = BrikkeBlue,
onMain = Color.White,
Expand All @@ -276,9 +282,11 @@ internal val LeboncoinColorProLightLegacy: SparkColors = lightSparkColors(
onMainVariant = Color.White,
support = BrikkeBlack,
onSupport = Color.White,
supportContainer = BrikkeGreyLight, // Highlight Surface => backgroundVariant
// Highlight Surface => backgroundVariant
supportContainer = BrikkeGreyLight,
onSupportContainer = Blueberry900,
supportVariant = BrikkeGreyDark, // tertiary => neutral / Dim 1
// tertiary => neutral / Dim 1
supportVariant = BrikkeGreyDark,
onSupportVariant = Grey10,
tertiary = BrikkeGrey,
onTertiary = GreyBlue99,
Expand All @@ -302,11 +310,13 @@ internal val LeboncoinColorProLightLegacy: SparkColors = lightSparkColors(
onInfoContainer = Blueberry700,
neutral = NightShade50,
onNeutral = Color.White,
neutralContainer = NightShade50, // == surface Highlight
// == surface Highlight
neutralContainer = NightShade50,
onNeutralContainer = NightShade700,
background = Color.White,
onBackground = Blueberry900,
backgroundVariant = GreyBlue90, // == surface disabled
// == surface disabled
backgroundVariant = GreyBlue90,
onBackgroundVariant = GreyBlue30,
surface = Color.White,
onSurface = Grey10,
Expand Down Expand Up @@ -343,15 +353,17 @@ internal val LeboncoinColorPartLight: SparkColors = lightSparkColors(
onSupport = Color.White,
supportContainer = Blueberry100,
onSupportContainer = Blueberry900,
supportVariant = Blueberry700, // tertiary => neutral / Dim 1
// tertiary => neutral / Dim 1
supportVariant = Blueberry700,
onSupportVariant = Color.White,
tertiary = Color.Magenta,
onTertiary = Color.Blue,
tertiaryContainer = Color.Magenta,
onTertiaryContainer = Color.Blue,
success = Avocado500,
onSuccess = Color.White,
successContainer = Avocado100, // == surface disabled
// == surface disabled
successContainer = Avocado100,
onSuccessContainer = Avocado700,
alert = Banana500,
onAlert = NightShade900,
Expand Down Expand Up @@ -403,15 +415,17 @@ internal val LeboncoinColorProLight: SparkColors = lightSparkColors(
onSupport = Color.White,
supportContainer = Blueberry100,
onSupportContainer = Blueberry900,
supportVariant = Blueberry700, // tertiary => neutral / Dim 1
// tertiary => neutral / Dim 1
supportVariant = Blueberry700,
onSupportVariant = Color.White,
tertiary = Color.Magenta,
onTertiary = Color.Blue,
tertiaryContainer = Color.Magenta,
onTertiaryContainer = Color.Blue,
success = Avocado500,
onSuccess = Color.White,
successContainer = Avocado100, // == surface disabled
// == surface disabled
successContainer = Avocado100,
onSuccessContainer = Avocado700,
alert = Banana500,
onAlert = NightShade900,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ public fun ModalBottomSheetLayout(
DragHandle(
Modifier
.align(Alignment.CenterHorizontally)
.padding(top = 8.dp, bottom = 16.dp), // specs to extract into default?
// specs to extract into default?
.padding(top = 8.dp, bottom = 16.dp),
)
sheetContent()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,13 @@ internal class SwipeableV2State<T>(
if (distance > 1e-6f) {
val progress = (this.requireOffset() - a) / (b - a)
// If we are very close to 0f or 1f, we round to the closest
if (progress < 1e-6f) 0f else if (progress > 1 - 1e-6f) 1f else progress
if (progress < 1e-6f) {
0f
} else if (progress > 1 - 1e-6f) {
1f
} else {
progress
}
} else {
1f
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ private fun ModalBottomSheetAnchorChangeHandler(
val hasPartiallyExpandedState = newAnchors.containsKey(SheetValue.PartiallyExpanded)
val newTarget = if (hasPartiallyExpandedState) {
SheetValue.PartiallyExpanded
} else if (newAnchors.containsKey(Expanded)) Expanded else Hidden
} else if (newAnchors.containsKey(Expanded)) {
Expanded
} else {
Hidden
}
newTarget
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ internal fun BaseSparkButton(
modifier = Modifier
.size(SparkButtonDefaults.IconSize)
.testTag("buttonIcon"),
contentDescription = null, // button text should be enough for context
// button text should be enough for context
contentDescription = null,
)
Spacer(Modifier.width(SparkButtonDefaults.IconSpacing))
}
Expand All @@ -125,7 +126,8 @@ internal fun BaseSparkButton(
modifier = Modifier
.size(SparkButtonDefaults.IconSize)
.testTag("buttonIcon"),
contentDescription = null, // button text should be enough for context
// button text should be enough for context
contentDescription = null,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ private fun ImageIconState(sparkIcon: SparkIcon) {
EmphasizeDim2 {
Icon(
sparkIcon = sparkIcon,
contentDescription = null, // The SparkImage handle the content description
// The SparkImage handle the content description
contentDescription = null,
modifier = Modifier.padding(8.dp),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ private fun ImageIconState(sparkIcon: SparkIcon) {
) {
Illustration(
sparkIcon = sparkIcon,
contentDescription = null, // The SparkImage handle the content description
// The SparkImage handle the content description
contentDescription = null,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,15 @@ import kotlinx.coroutines.launch
@OptIn(ExperimentalMaterial3Api::class)
public fun Popover(
popoverContent: @Composable () -> Unit,
modifier: Modifier = Modifier, // ignored
modifier: Modifier = Modifier,
isDismissButtonEnabled: Boolean = false,
popoverState: TooltipState = rememberTooltipState(isPersistent = true),
anchorContent: @Composable () -> Unit,
) {
val shape: Shape = TooltipDefaults.richTooltipContainerShape
/**
* ComposeLint lib currently doesn't catch suppress "ComposeModifierMissing"
* and throws a lint error
* TODO: remove unnecessary @modifier parameter when they fix it in a later version
*/
modifier.hashCode()

TooltipBox(
modifier = modifier,
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = {
val colors: RichTooltipColors = TooltipDefaults.richTooltipColors()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ internal fun BaseSparkTag(
Icon(
sparkIcon = leadingIcon,
modifier = Modifier.size(LeadingIconSize),
contentDescription = null, // The tag is associated with a mandatory label so it's okay
// The tag is associated with a mandatory label so it's okay
contentDescription = null,
tint = tint ?: LocalContentColor.current,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public abstract class AddonScope {
Icon(
sparkIcon = icon,
modifier = Modifier.size(SparkButtonDefaults.IconSize),
contentDescription = null, // button text should be enough for context
// button text should be enough for context
contentDescription = null,
)
}
AnimatedVisibility(visible = isLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ internal fun SparkTextField(
placeholder: String?,
helper: String?,
counter: TextFieldCharacterCounter?,
leadingIcon: @Composable (AddonScope.() -> Unit)?, // Should we rename it to leadingContent?
trailingIcon: @Composable (AddonScope.() -> Unit)?, // Should we rename it to trailingContent?
// Should we rename it to leadingContent?
leadingIcon: @Composable (AddonScope.() -> Unit)?,
// Should we rename it to trailingContent?
trailingIcon: @Composable (AddonScope.() -> Unit)?,
state: TextFieldState?,
stateMessage: String?,
visualTransformation: VisualTransformation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public fun TextField(
label = label,
placeholder = placeholder,
helper = helper,
counter = null, // Available only for MultilineTextField Variant
// Available only for MultilineTextField Variant
counter = null,
leadingContent = leadingContent,
trailingContent = trailingContentBasedOnState,
state = state,
Expand Down Expand Up @@ -225,7 +226,8 @@ public fun TextField(
label = label,
placeholder = placeholder,
helper = helper,
counter = null, // Available only for MultilineTextField Variant
// Available only for MultilineTextField Variant
counter = null,
leadingIcon = leadingContent,
trailingIcon = trailingContentBasedOnState,
state = state,
Expand Down

0 comments on commit 3e314e4

Please sign in to comment.