Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump com.pinterest.ktlint:ktlint-bom from 1.2.1 to 1.3.1 #1321

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ public fun IconsScreen(
}
}

private data class NamedIcon(
@DrawableRes val drawableRes: Int,
val name: String,
)
private data class NamedIcon(@DrawableRes val drawableRes: Int, val name: String)

private suspend fun getAllIconsRes(context: Context) = withContext(Default) {
IconR.drawable::class.java.declaredFields.mapNotNull { field ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,7 @@ internal interface MultiSelectorState {
}

@Stable
internal class MultiSelectorStateImpl(
options: List<String>,
selectedOption: String,
) : MultiSelectorState {
internal class MultiSelectorStateImpl(options: List<String>, selectedOption: String) : MultiSelectorState {

override val selectedIndex: Int
get() = _selectedIndex
Expand All @@ -208,9 +205,7 @@ internal class MultiSelectorStateImpl(
return _selectedIndex == other._selectedIndex
}

override fun hashCode(): Int {
return _selectedIndex.hashCode()
}
override fun hashCode(): Int = _selectedIndex.hashCode()
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ import com.adevinta.spark.tokens.SparkTypography

public object KleinanzeigenTheme : ThemeProvider {
@Composable
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors {
return when {
useDarkColors || isSystemInDarkTheme() -> KleinanzeigenDark
else -> KleinanzeigenLight
}
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors = when {
useDarkColors || isSystemInDarkTheme() -> KleinanzeigenDark
else -> KleinanzeigenLight
}

@Composable
override fun shapes(): SparkShapes = KleinanzeigenShapes

@Composable
override fun typography(): SparkTypography {
return KleinanzeigenTypo
}
override fun typography(): SparkTypography = KleinanzeigenTypo
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,15 @@ import com.adevinta.spark.tokens.lightSparkColors

public object LeboncoinTheme : ThemeProvider {
@Composable
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors {
return if (useDarkColors) {
if (isPro) LeboncoinColorProDark else darkSparkColors()
} else {
if (isPro) LeboncoinColorProLight else lightSparkColors()
}
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors = if (useDarkColors) {
if (isPro) LeboncoinColorProDark else darkSparkColors()
} else {
if (isPro) LeboncoinColorProLight else lightSparkColors()
}

@Composable
override fun shapes(): SparkShapes = LeboncoinShapes

@Composable
override fun typography(): SparkTypography {
return LeboncoinTypo
}
override fun typography(): SparkTypography = LeboncoinTypo
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,14 @@ import com.adevinta.spark.tokens.sparkTypography

public object MilanunciosTheme : ThemeProvider {
@Composable
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors {
return when {
useDarkColors || isSystemInDarkTheme() -> MilanunciosDark
else -> MilanunciosLight
}
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors = when {
useDarkColors || isSystemInDarkTheme() -> MilanunciosDark
else -> MilanunciosLight
}

@Composable
override fun shapes(): SparkShapes = MilanunciosShapes

@Composable
override fun typography(): SparkTypography {
return sparkTypography()
}
override fun typography(): SparkTypography = sparkTypography()
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,14 @@ import com.adevinta.spark.tokens.sparkTypography

public object SubitoTheme : ThemeProvider {
@Composable
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors {
return when {
useDarkColors || isSystemInDarkTheme() -> SubitoDark
else -> SubitoLight
}
override fun colors(useDarkColors: Boolean, isPro: Boolean): SparkColors = when {
useDarkColors || isSystemInDarkTheme() -> SubitoDark
else -> SubitoLight
}

@Composable
override fun shapes(): SparkShapes = SubitoShapes

@Composable
override fun typography(): SparkTypography {
return sparkTypography()
}
override fun typography(): SparkTypography = sparkTypography()
}
34 changes: 16 additions & 18 deletions catalog/src/main/kotlin/com/adevinta/spark/catalog/ui/Backdrop.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,22 @@ public fun rememberBackdropScaffoldState(
animationSpec: AnimationSpec<Float> = SwipeableDefaults.AnimationSpec,
confirmStateChange: (BackdropValue) -> Boolean = { true },
snackbarHostState: SnackbarHostState = remember { SnackbarHostState() },
): BackdropScaffoldState {
return rememberSaveable(
animationSpec,
confirmStateChange,
snackbarHostState,
saver = BackdropScaffoldState.Saver(
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
snackbarHostState = snackbarHostState,
),
) {
BackdropScaffoldState(
initialValue = initialValue,
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
snackbarHostState = snackbarHostState,
)
}
): BackdropScaffoldState = rememberSaveable(
animationSpec,
confirmStateChange,
snackbarHostState,
saver = BackdropScaffoldState.Saver(
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
snackbarHostState = snackbarHostState,
),
) {
BackdropScaffoldState(
initialValue = initialValue,
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
snackbarHostState = snackbarHostState,
)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ kotlin = "2.0.21"
kotlinx-coroutines = "1.9.0"
kotlinx-collections-immutable = "0.3.8"
kotlinx-serialization-json = "1.7.3"
ktlint = "1.2.1"
ktlint = "1.3.1"
lint = "31.7.1"
minCompileSdk = "24"
paparazzi = "1.3.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,5 @@ internal class Solid(
) : PlaceholderHighlight {
override fun alpha(progress: Float): Float = 1f

override fun brush(progress: Float, size: Size): Brush {
return SolidColor(color)
}
override fun brush(progress: Float, size: Size): Brush = SolidColor(color)
}
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,11 @@ public class TopAppBarColors internal constructor(
* percentage
*/
@Composable
internal fun containerColor(colorTransitionFraction: Float): Color {
return lerp(
containerColor,
scrolledContainerColor,
FastOutLinearInEasing.transform(colorTransitionFraction),
)
}
internal fun containerColor(colorTransitionFraction: Float): Color = lerp(
containerColor,
scrolledContainerColor,
FastOutLinearInEasing.transform(colorTransitionFraction),
)

override fun equals(other: Any?): Boolean {
if (this === other) return true
Expand Down Expand Up @@ -950,13 +948,11 @@ private fun TopAppBarLayout(
* @param elevationTransitionFraction a `0.0` to `1.0` value that represents a color transition percentage
*/
@Composable
private fun containerElevation(elevationTransitionFraction: Float): Dp {
return lerp(
ElevationTokens.Level0,
ElevationTokens.Level2,
FastOutLinearInEasing.transform(elevationTransitionFraction),
)
}
private fun containerElevation(elevationTransitionFraction: Float): Dp = lerp(
ElevationTokens.Level0,
ElevationTokens.Level2,
FastOutLinearInEasing.transform(elevationTransitionFraction),
)

// An easing function used to compute the alpha value that is applied to the top title part of a
// Medium or Large app bar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,7 @@ public class SwipeProgress<T>(
return result
}

override fun toString(): String {
return "SwipeProgress(from=$from, to=$to, fraction=$fraction)"
}
override fun toString(): String = "SwipeProgress(from=$from, to=$to, fraction=$fraction)"
}

/**
Expand All @@ -504,19 +502,17 @@ public fun <T : Any> rememberSwipeableState(
initialValue: T,
animationSpec: AnimationSpec<Float> = AnimationSpec,
confirmStateChange: (newValue: T) -> Boolean = { true },
): SwipeableState<T> {
return rememberSaveable(
saver = SwipeableState.Saver(
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
),
) {
SwipeableState(
initialValue = initialValue,
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
)
}
): SwipeableState<T> = rememberSaveable(
saver = SwipeableState.Saver(
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
),
) {
SwipeableState(
initialValue = initialValue,
animationSpec = animationSpec,
confirmStateChange = confirmStateChange,
)
}

/**
Expand Down Expand Up @@ -683,10 +679,13 @@ public interface ThresholdConfig {
@InternalSparkApi
// This is a copy from Material 3 Swipeable until b/163132293 is closed
// Until this is fixed use it when you really cannot use a BottomSheetDialogFragment
public data class FixedThreshold(private val offset: Dp) : ThresholdConfig {
override fun Density.computeThreshold(fromValue: Float, toValue: Float): Float {
return fromValue + offset.toPx() * sign(toValue - fromValue)
}
public data class FixedThreshold(
private val offset: Dp,
) : ThresholdConfig {
override fun Density.computeThreshold(
fromValue: Float,
toValue: Float,
): Float = fromValue + offset.toPx() * sign(toValue - fromValue)
}

/**
Expand All @@ -696,13 +695,9 @@ public data class FixedThreshold(private val offset: Dp) : ThresholdConfig {
*/
@Immutable
@ExperimentalMaterial3Api
internal data class FractionalThreshold(
/*@FloatRange(from = 0.0, to = 1.0)*/
private val fraction: Float,
) : ThresholdConfig {
override fun Density.computeThreshold(fromValue: Float, toValue: Float): Float {
return lerp(fromValue, toValue, fraction)
}
internal data class FractionalThreshold(/*@FloatRange(from = 0.0, to = 1.0)*/private val fraction: Float) :
ThresholdConfig {
override fun Density.computeThreshold(fromValue: Float, toValue: Float): Float = lerp(fromValue, toValue, fraction)
}

/**
Expand Down Expand Up @@ -762,9 +757,8 @@ public class ResistanceConfig(
return result
}

override fun toString(): String {
return "ResistanceConfig(basis=$basis, factorAtMin=$factorAtMin, factorAtMax=$factorAtMax)"
}
override fun toString(): String =
"ResistanceConfig(basis=$basis, factorAtMin=$factorAtMin, factorAtMax=$factorAtMax)"
}

/**
Expand Down Expand Up @@ -841,9 +835,7 @@ private fun computeTarget(
}
}

private fun <T> Map<Float, T>.getOffset(state: T): Float? {
return entries.firstOrNull { it.value == state }?.key
}
private fun <T> Map<Float, T>.getOffset(state: T): Float? = entries.firstOrNull { it.value == state }?.key

/**
* Contains useful defaults for [swipeable] and [SwipeableState].
Expand Down Expand Up @@ -882,13 +874,11 @@ public object SwipeableDefaults {
anchors: Set<Float>,
factorAtMin: Float = StandardResistanceFactor,
factorAtMax: Float = StandardResistanceFactor,
): ResistanceConfig? {
return if (anchors.size <= 1) {
null
} else {
val basis = anchors.maxOrNull()!! - anchors.minOrNull()!!
ResistanceConfig(basis, factorAtMin, factorAtMax)
}
): ResistanceConfig? = if (anchors.size <= 1) {
null
} else {
val basis = anchors.maxOrNull()!! - anchors.minOrNull()!!
ResistanceConfig(basis, factorAtMin, factorAtMax)
}
}

Expand All @@ -910,12 +900,10 @@ public val <T> SwipeableState<T>.PreUpPostDownNestedScrollConnection: NestedScro
consumed: Offset,
available: Offset,
source: NestedScrollSource,
): Offset {
return if (source == NestedScrollSource.UserInput) {
performDrag(available.toFloat()).toOffset()
} else {
Offset.Zero
}
): Offset = if (source == NestedScrollSource.UserInput) {
performDrag(available.toFloat()).toOffset()
} else {
Offset.Zero
}

override suspend fun onPreFling(available: Velocity): Velocity {
Expand Down
Loading
Loading