Fix ktlint issues

This commit is contained in:
Benoit Marty 2024-01-10 19:33:39 +01:00
parent 140a11cf77
commit a831f05f6e
100 changed files with 66 additions and 158 deletions

View file

@ -25,7 +25,6 @@ data class AvatarData(
val url: String? = null,
val size: AvatarSize,
) {
val initial by lazy {
(name?.takeIf { it.isNotBlank() } ?: id)
.let { dn ->

View file

@ -29,7 +29,6 @@ import io.element.android.libraries.designsystem.theme.components.TextButton
*/
@Immutable
sealed interface ButtonVisuals {
val action: () -> Unit
/**

View file

@ -29,7 +29,8 @@ import androidx.lifecycle.Lifecycle
* Inspired from https://stackoverflow.com/questions/68847559/how-can-i-detect-keyboard-opening-and-closing-in-jetpack-compose
*/
enum class Keyboard {
Opened, Closed
Opened,
Closed
}
// Note: it does not work as expected...

View file

@ -95,7 +95,6 @@ private fun PreferenceTopAppBar(
overflow = TextOverflow.Ellipsis
)
}
)
}

View file

@ -55,7 +55,7 @@ fun PreferenceTextField(
style: ListItemStyle = ListItemStyle.Default,
) {
var displayTextFieldDialog by rememberSaveable { mutableStateOf(false) }
val valueToDisplay = if (displayValue(value)) { value } else supportingText
val valueToDisplay = if (displayValue(value)) value else supportingText
ListItem(
modifier = modifier,

View file

@ -259,11 +259,14 @@ sealed interface IconSource {
}
enum class ButtonSize {
Medium, Large
Medium,
Large
}
internal enum class ButtonStyle {
Filled, Outlined, Text;
Filled,
Outlined,
Text;
@Composable
fun getColors(destructive: Boolean): ButtonColors = when (this) {

View file

@ -38,7 +38,8 @@ import io.element.android.libraries.designsystem.preview.PreviewGroup
fun FloatingActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
shape: Shape = CircleShape, // FloatingActionButtonDefaults.shape,
// FloatingActionButtonDefaults.shape
shape: Shape = CircleShape,
containerColor: Color = FloatingActionButtonDefaults.containerColor,
contentColor: Color = contentColorFor(containerColor),
elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(),

View file

@ -378,7 +378,6 @@ internal fun ListItemDisabledWithIconPreview() = PreviewItems.OneLineListItemPre
@Suppress("ModifierMissing")
private object PreviewItems {
@Composable
fun ThreeLinesListItemPreview(
modifier: Modifier = Modifier,

View file

@ -81,7 +81,6 @@ fun ListSupportingText(
}
object ListSupportingTextDefaults {
/** Specifies the padding to use for the supporting text. */
@Immutable
sealed interface Padding {

View file

@ -151,7 +151,6 @@ fun <T> SearchBar(
}
object ElementSearchBarDefaults {
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun inactiveColors() = SearchBarDefaults.colors(

View file

@ -37,7 +37,7 @@ fun Slider(
modifier: Modifier = Modifier,
enabled: Boolean = true,
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
/*@IntRange(from = 0)*/
// @IntRange(from = 0)
steps: Int = 0,
onValueChangeFinished: (() -> Unit)? = null,
colors: SliderColors = SliderDefaults.colors(),

View file

@ -282,11 +282,13 @@ private fun CustomStandardBottomSheet(
if (anchoredDraggableState.anchors.size > 1 && sheetSwipeEnabled) {
if (currentValue == SheetValue.PartiallyExpanded) {
expand(expandActionLabel) {
scope.launch { expand() }; true
scope.launch { expand() }
true
}
} else {
collapse(partialExpandActionLabel) {
scope.launch { partialExpand() }; true
scope.launch { partialExpand() }
true
}
}
if (!state.skipHiddenState) {
@ -314,7 +316,6 @@ private fun CustomStandardBottomSheet(
*/
@ExperimentalFoundationApi
class DraggableAnchorsConfig<T> {
internal val anchors = mutableMapOf<T, Float>()
/**
@ -344,7 +345,6 @@ internal fun <T : Any> DraggableAnchors(
): DraggableAnchors<T> = MapDraggableAnchors(DraggableAnchorsConfig<T>().apply(builder).anchors)
private class MapDraggableAnchors<T>(private val anchors: Map<T, Float>) : DraggableAnchors<T> {
override fun positionOf(value: T): Float = anchors[value] ?: Float.NaN
override fun hasAnchorFor(value: T) = anchors.containsKey(value)

View file

@ -51,7 +51,6 @@ constructor(
confirmValueChange: (SheetValue) -> Boolean = { true },
internal val skipHiddenState: Boolean = false,
) {
/**
* State of a sheet composable, such as [ModalBottomSheet]
*

View file

@ -30,7 +30,8 @@ import io.element.android.libraries.designsystem.theme.components.Snackbar
fun SnackbarHost(hostState: SnackbarHostState, modifier: Modifier = Modifier) {
androidx.compose.material3.SnackbarHost(hostState, modifier) { data ->
Snackbar(
modifier = Modifier.padding(12.dp), // Add default padding
// Add default padding
modifier = Modifier.padding(12.dp),
message = data.visuals.message,
action = data.visuals.actionLabel?.let { ButtonVisuals.Text(it, data::performAction) },
dismissAction = if (data.visuals.withDismissAction) {

View file

@ -22,7 +22,6 @@ import io.element.android.compound.theme.avatarColorsLight
import org.junit.Test
class AvatarColorsTest {
@Test
fun `ensure the size of the avatar color are equal for light and dark theme`() {
assertThat(avatarColorsDark.size).isEqualTo(avatarColorsLight.size)

View file

@ -22,7 +22,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
class SnackbarDispatcherTests {
@Test
fun `given an empty queue the flow emits a null item`() = runTest {
val snackbarDispatcher = SnackbarDispatcher()