mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Lambda parameters in a composable function should be in present tense, not past tense.
https://mrmans0n.github.io/compose-rules/rules/#naming-parameters-properly
This commit is contained in:
+7
-7
@@ -51,7 +51,7 @@ import kotlinx.collections.immutable.persistentListOf
|
||||
fun AvatarActionBottomSheet(
|
||||
actions: ImmutableList<AvatarAction>,
|
||||
isVisible: Boolean,
|
||||
onActionSelected: (action: AvatarAction) -> Unit,
|
||||
onSelectAction: (action: AvatarAction) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
@@ -64,8 +64,8 @@ fun AvatarActionBottomSheet(
|
||||
sheetState.hide(coroutineScope, then = { onDismiss() })
|
||||
}
|
||||
|
||||
fun onItemActionClicked(itemAction: AvatarAction) {
|
||||
onActionSelected(itemAction)
|
||||
fun onItemActionClick(itemAction: AvatarAction) {
|
||||
onSelectAction(itemAction)
|
||||
sheetState.hide(coroutineScope, then = { onDismiss() })
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ fun AvatarActionBottomSheet(
|
||||
) {
|
||||
AvatarActionBottomSheetContent(
|
||||
actions = actions,
|
||||
onActionClicked = ::onItemActionClicked,
|
||||
onActionClick = ::onItemActionClick,
|
||||
modifier = Modifier
|
||||
.navigationBarsPadding()
|
||||
.imePadding()
|
||||
@@ -92,7 +92,7 @@ fun AvatarActionBottomSheet(
|
||||
private fun AvatarActionBottomSheetContent(
|
||||
actions: ImmutableList<AvatarAction>,
|
||||
modifier: Modifier = Modifier,
|
||||
onActionClicked: (AvatarAction) -> Unit = { },
|
||||
onActionClick: (AvatarAction) -> Unit = { },
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = modifier.fillMaxWidth()
|
||||
@@ -101,7 +101,7 @@ private fun AvatarActionBottomSheetContent(
|
||||
items = actions,
|
||||
) { action ->
|
||||
ListItem(
|
||||
modifier = Modifier.clickable { onActionClicked(action) },
|
||||
modifier = Modifier.clickable { onActionClick(action) },
|
||||
headlineContent = {
|
||||
Text(
|
||||
text = stringResource(action.titleResId),
|
||||
@@ -125,7 +125,7 @@ internal fun AvatarActionBottomSheetPreview() = ElementPreview {
|
||||
AvatarActionBottomSheet(
|
||||
actions = persistentListOf(AvatarAction.TakePhoto, AvatarAction.ChoosePhoto, AvatarAction.Remove),
|
||||
isVisible = true,
|
||||
onActionSelected = { },
|
||||
onSelectAction = { },
|
||||
onDismiss = { },
|
||||
)
|
||||
}
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ fun EditableAvatarView(
|
||||
displayName: String?,
|
||||
avatarUrl: Uri?,
|
||||
avatarSize: AvatarSize,
|
||||
onAvatarClicked: () -> Unit,
|
||||
onAvatarClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
@@ -64,7 +64,7 @@ fun EditableAvatarView(
|
||||
.size(avatarSize.dp)
|
||||
.clickable(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = onAvatarClicked,
|
||||
onClick = onAvatarClick,
|
||||
indication = rememberRipple(bounded = false),
|
||||
)
|
||||
.testTag(TestTags.editAvatar)
|
||||
@@ -113,7 +113,7 @@ internal fun EditableAvatarViewPreview(
|
||||
displayName = "A room",
|
||||
avatarUrl = uri,
|
||||
avatarSize = AvatarSize.EditRoomDetails,
|
||||
onAvatarClicked = {},
|
||||
onAvatarClick = {},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -50,7 +50,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||
@Composable
|
||||
fun SelectedRoom(
|
||||
roomSummary: RoomSummaryDetails,
|
||||
onRoomRemoved: (RoomSummaryDetails) -> Unit,
|
||||
onRemoveRoom: (RoomSummaryDetails) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(
|
||||
@@ -78,7 +78,7 @@ fun SelectedRoom(
|
||||
.clickable(
|
||||
indication = rememberRipple(),
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = { onRoomRemoved(roomSummary) }
|
||||
onClick = { onRemoveRoom(roomSummary) }
|
||||
),
|
||||
) {
|
||||
Icon(
|
||||
@@ -98,6 +98,6 @@ internal fun SelectedRoomPreview(
|
||||
) = ElementPreview {
|
||||
SelectedRoom(
|
||||
roomSummary = roomSummaryDetails,
|
||||
onRoomRemoved = {},
|
||||
onRemoveRoom = {},
|
||||
)
|
||||
}
|
||||
|
||||
+4
-4
@@ -53,7 +53,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||
fun SelectedUser(
|
||||
matrixUser: MatrixUser,
|
||||
canRemove: Boolean,
|
||||
onUserRemoved: (MatrixUser) -> Unit,
|
||||
onUserRemove: (MatrixUser) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(
|
||||
@@ -83,7 +83,7 @@ fun SelectedUser(
|
||||
.clickable(
|
||||
indication = rememberRipple(),
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = { onUserRemoved(matrixUser) }
|
||||
onClick = { onUserRemove(matrixUser) }
|
||||
),
|
||||
) {
|
||||
Icon(
|
||||
@@ -103,7 +103,7 @@ internal fun SelectedUserPreview() = ElementPreview {
|
||||
SelectedUser(
|
||||
aMatrixUser(displayName = "John Doe"),
|
||||
canRemove = true,
|
||||
onUserRemoved = {},
|
||||
onUserRemove = {},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -113,6 +113,6 @@ internal fun SelectedUserCannotRemovePreview() = ElementPreview {
|
||||
SelectedUser(
|
||||
aMatrixUser(),
|
||||
canRemove = false,
|
||||
onUserRemoved = {},
|
||||
onUserRemove = {},
|
||||
)
|
||||
}
|
||||
|
||||
+4
-4
@@ -48,7 +48,7 @@ import kotlin.math.floor
|
||||
@Composable
|
||||
fun SelectedUsersRowList(
|
||||
selectedUsers: ImmutableList<MatrixUser>,
|
||||
onUserRemoved: (MatrixUser) -> Unit,
|
||||
onUserRemove: (MatrixUser) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
autoScroll: Boolean = false,
|
||||
canDeselect: (MatrixUser) -> Boolean = { true },
|
||||
@@ -112,7 +112,7 @@ fun SelectedUsersRowList(
|
||||
SelectedUser(
|
||||
matrixUser = selectedUser,
|
||||
canRemove = canDeselect(selectedUser),
|
||||
onUserRemoved = onUserRemoved,
|
||||
onUserRemove = onUserRemove,
|
||||
)
|
||||
},
|
||||
measurePolicy = { measurables, constraints ->
|
||||
@@ -137,7 +137,7 @@ internal fun SelectedUsersRowListPreview() = ElementPreview {
|
||||
// Two users that will be visible with no scrolling
|
||||
SelectedUsersRowList(
|
||||
selectedUsers = aMatrixUserList().take(2).toImmutableList(),
|
||||
onUserRemoved = {},
|
||||
onUserRemove = {},
|
||||
modifier = Modifier
|
||||
.width(200.dp)
|
||||
.border(1.dp, Color.Red)
|
||||
@@ -147,7 +147,7 @@ internal fun SelectedUsersRowListPreview() = ElementPreview {
|
||||
for (i in 0..5) {
|
||||
SelectedUsersRowList(
|
||||
selectedUsers = aMatrixUserList().take(6).toImmutableList(),
|
||||
onUserRemoved = {},
|
||||
onUserRemove = {},
|
||||
modifier = Modifier
|
||||
.width((200 + i * 20).dp)
|
||||
.border(1.dp, Color.Red)
|
||||
|
||||
Reference in New Issue
Block a user