Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup code for lint checks
Browse files Browse the repository at this point in the history
Walingar committed Nov 2, 2023
1 parent 8d0e1bc commit ba77d9b
Showing 5 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jetbrains.jewel.foundation.lazy

import org.jetbrains.jewel.foundation.lazy.SelectableLazyListKey.Selectable
import java.util.Collections.addAll
import kotlin.math.max
import kotlin.math.min

Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import org.jetbrains.jewel.foundation.lazy.SelectableLazyListScopeContainer.Entry
import org.jetbrains.jewel.foundation.lazy.tree.DefaultSelectableLazyColumnEventAction
Original file line number Diff line number Diff line change
@@ -104,13 +104,9 @@ internal class SelectableLazyListScopeContainer : SelectableLazyListScope {
) : Entry
}

internal fun getKeyIndex(key: Any): Int {
return keyToIndex[key] ?: error("Cannot find index of '$key'")
}
internal fun getKeyIndex(key: Any): Int = keyToIndex[key] ?: error("Cannot find index of '$key'")

internal fun isKeySelectable(key: Any): Boolean {
return key !in nonSelectableKeys
}
internal fun isKeySelectable(key: Any): Boolean = key !in nonSelectableKeys

override fun item(
key: Any,
Original file line number Diff line number Diff line change
@@ -237,7 +237,6 @@ internal class SelectableLazyColumnTest {
assertEquals(expectedElementsAfterPageUp.size, state.selectedKeys.size)
assertEquals(expectedElementsAfterPageUp.toSet(), state.selectedKeys.toSet())


// select item 5 by click
composeRule.onNodeWithTag("Item 5").assertExists()
composeRule.onNodeWithTag("Item 5").performClick()
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ fun SelectableLazyColumnSample() {
val interactionSource = remember { MutableInteractionSource() }
val state = rememberSelectableLazyListState()
Box(
modifier = Modifier.size(200.dp, 200.dp)
modifier = Modifier.size(200.dp, 200.dp),
) {
SelectableLazyColumn(
modifier = Modifier.focusable(interactionSource = interactionSource),

0 comments on commit ba77d9b

Please sign in to comment.