Merge pull request #2936 from element-hq/renovate/io.nlopez.compose.rules-detekt-0.x

Update dependency io.nlopez.compose.rules:detekt to v0.4.3
This commit is contained in:
Benoit Marty 2024-05-29 15:25:34 +02:00 committed by GitHub
commit c6e8628bd9
259 changed files with 1801 additions and 1796 deletions

View file

@ -45,8 +45,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
fun DialogLikeBannerMolecule(
title: String,
content: String,
onSubmitClicked: () -> Unit,
onDismissClicked: (() -> Unit)?,
onSubmitClick: () -> Unit,
onDismissClick: (() -> Unit)?,
modifier: Modifier = Modifier,
) {
Box(modifier = modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
@ -68,9 +68,9 @@ fun DialogLikeBannerMolecule(
color = MaterialTheme.colorScheme.primary,
textAlign = TextAlign.Start,
)
if (onDismissClicked != null) {
if (onDismissClick != null) {
Icon(
modifier = Modifier.clickable(onClick = onDismissClicked),
modifier = Modifier.clickable(onClick = onDismissClick),
imageVector = CompoundIcons.Close(),
contentDescription = stringResource(CommonStrings.action_close)
)
@ -86,7 +86,7 @@ fun DialogLikeBannerMolecule(
text = stringResource(CommonStrings.action_continue),
size = ButtonSize.Medium,
modifier = Modifier.fillMaxWidth(),
onClick = onSubmitClicked,
onClick = onSubmitClick,
)
}
}
@ -99,7 +99,7 @@ internal fun DialogLikeBannerMoleculePreview() = ElementPreview {
DialogLikeBannerMolecule(
title = "Title",
content = "Content",
onSubmitClicked = {},
onDismissClicked = {}
onSubmitClick = {},
onDismissClick = {}
)
}

View file

@ -41,7 +41,7 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
/**
* A Page with:
* - a top bar as TobAppBar with optional back button (displayed if [onBackClicked] is not null)
* - a top bar as TobAppBar with optional back button (displayed if [onBackClick] is not null)
* - a header, as IconTitleSubtitleMolecule
* - a content.
* - a footer, as ButtonColumnMolecule
@ -52,21 +52,21 @@ fun FlowStepPage(
iconVector: ImageVector?,
title: String,
modifier: Modifier = Modifier,
onBackClicked: (() -> Unit)? = null,
onBackClick: (() -> Unit)? = null,
subTitle: String? = null,
content: @Composable () -> Unit = {},
buttons: @Composable ColumnScope.() -> Unit = {},
content: @Composable () -> Unit = {},
) {
BackHandler(enabled = onBackClicked != null) {
onBackClicked?.invoke()
BackHandler(enabled = onBackClick != null) {
onBackClick?.invoke()
}
HeaderFooterPage(
modifier = modifier,
topBar = {
TopAppBar(
navigationIcon = {
if (onBackClicked != null) {
BackButton(onClick = onBackClicked)
if (onBackClick != null) {
BackButton(onClick = onBackClick)
}
},
title = {},
@ -94,25 +94,24 @@ fun FlowStepPage(
@Composable
internal fun FlowStepPagePreview() = ElementPreview {
FlowStepPage(
onBackClicked = {},
onBackClick = {},
title = "Title",
subTitle = "Subtitle",
iconVector = CompoundIcons.Computer(),
content = {
Box(
Modifier
.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = "Content",
style = ElementTheme.typography.fontHeadingXlBold
)
}
},
buttons = {
TextButton(text = "A button", onClick = { })
Button(text = "Continue", onClick = { })
}
)
) {
Box(
Modifier
.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = "Content",
style = ElementTheme.typography.fontHeadingXlBold
)
}
}
}

View file

@ -67,7 +67,7 @@ fun ProgressDialog(
modifier = modifier,
text = text,
isCancellable = isCancellable,
onCancelClicked = onDismissRequest,
onCancelClick = onDismissRequest,
progressIndicator = {
when (type) {
is ProgressDialogType.Indeterminate -> {
@ -98,7 +98,7 @@ private fun ProgressDialogContent(
modifier: Modifier = Modifier,
text: String? = null,
isCancellable: Boolean = false,
onCancelClicked: () -> Unit = {},
onCancelClick: () -> Unit = {},
progressIndicator: @Composable () -> Unit = {
CircularProgressIndicator(
color = MaterialTheme.colorScheme.primary
@ -133,7 +133,7 @@ private fun ProgressDialogContent(
) {
TextButton(
text = stringResource(id = CommonStrings.action_cancel),
onClick = onCancelClicked,
onClick = onCancelClick,
)
}
}

View file

@ -99,7 +99,7 @@ internal fun AsyncActionViewPreview(
ConfirmationDialog(
title = "Confirmation",
content = "Are you sure?",
onSubmitClicked = {},
onSubmitClick = {},
onDismiss = {},
)
},

View file

@ -34,7 +34,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
@Composable
fun ConfirmationDialog(
content: String,
onSubmitClicked: () -> Unit,
onSubmitClick: () -> Unit,
onDismiss: () -> Unit,
modifier: Modifier = Modifier,
title: String? = null,
@ -42,8 +42,8 @@ fun ConfirmationDialog(
cancelText: String = stringResource(id = CommonStrings.action_cancel),
destructiveSubmit: Boolean = false,
thirdButtonText: String? = null,
onCancelClicked: () -> Unit = onDismiss,
onThirdButtonClicked: () -> Unit = {},
onCancelClick: () -> Unit = onDismiss,
onThirdButtonClick: () -> Unit = {},
) {
BasicAlertDialog(modifier = modifier, onDismissRequest = onDismiss) {
ConfirmationDialogContent(
@ -53,9 +53,9 @@ fun ConfirmationDialog(
cancelText = cancelText,
thirdButtonText = thirdButtonText,
destructiveSubmit = destructiveSubmit,
onSubmitClicked = onSubmitClicked,
onCancelClicked = onCancelClicked,
onThirdButtonClicked = onThirdButtonClicked,
onSubmitClick = onSubmitClick,
onCancelClick = onCancelClick,
onThirdButtonClick = onThirdButtonClick,
)
}
}
@ -65,11 +65,11 @@ private fun ConfirmationDialogContent(
content: String,
submitText: String,
cancelText: String,
onSubmitClicked: () -> Unit,
onCancelClicked: () -> Unit,
onSubmitClick: () -> Unit,
onCancelClick: () -> Unit,
title: String? = null,
thirdButtonText: String? = null,
onThirdButtonClicked: () -> Unit = {},
onThirdButtonClick: () -> Unit = {},
destructiveSubmit: Boolean = false,
icon: @Composable (() -> Unit)? = null,
) {
@ -77,11 +77,11 @@ private fun ConfirmationDialogContent(
title = title,
content = content,
submitText = submitText,
onSubmitClicked = onSubmitClicked,
onSubmitClick = onSubmitClick,
cancelText = cancelText,
onCancelClicked = onCancelClicked,
onCancelClick = onCancelClick,
thirdButtonText = thirdButtonText,
onThirdButtonClicked = onThirdButtonClicked,
onThirdButtonClick = onThirdButtonClick,
destructiveSubmit = destructiveSubmit,
icon = icon,
)
@ -98,9 +98,9 @@ internal fun ConfirmationDialogContentPreview() =
submitText = "OK",
cancelText = "Cancel",
thirdButtonText = "Disable",
onSubmitClicked = {},
onCancelClicked = {},
onThirdButtonClicked = {},
onSubmitClick = {},
onCancelClick = {},
onThirdButtonClick = {},
)
}
}
@ -114,7 +114,7 @@ internal fun ConfirmationDialogPreview() = ElementPreview {
submitText = "OK",
cancelText = "Cancel",
thirdButtonText = "Disable",
onSubmitClicked = {},
onSubmitClick = {},
onDismiss = {}
)
}

View file

@ -44,7 +44,7 @@ fun ErrorDialog(
title = title,
content = content,
submitText = submitText,
onSubmitClicked = onDismiss,
onSubmitClick = onDismiss,
)
}
}
@ -52,7 +52,7 @@ fun ErrorDialog(
@Composable
private fun ErrorDialogContent(
content: String,
onSubmitClicked: () -> Unit,
onSubmitClick: () -> Unit,
title: String = ErrorDialogDefaults.title,
submitText: String = ErrorDialogDefaults.submitText,
) {
@ -60,7 +60,7 @@ private fun ErrorDialogContent(
title = title,
content = content,
submitText = submitText,
onSubmitClicked = onSubmitClicked,
onSubmitClick = onSubmitClick,
)
}
@ -76,7 +76,7 @@ internal fun ErrorDialogContentPreview() {
DialogPreview {
ErrorDialogContent(
content = "Content",
onSubmitClicked = {},
onSubmitClick = {},
)
}
}

View file

@ -67,7 +67,7 @@ fun ListDialog(
cancelText = cancelText,
submitText = submitText,
onDismissRequest = onDismissRequest,
onSubmitClicked = onSubmit,
onSubmitClick = onSubmit,
enabled = enabled,
listItems = listItems,
)
@ -78,7 +78,7 @@ fun ListDialog(
private fun ListDialogContent(
listItems: LazyListScope.() -> Unit,
onDismissRequest: () -> Unit,
onSubmitClicked: () -> Unit,
onSubmitClick: () -> Unit,
cancelText: String,
submitText: String,
title: String? = null,
@ -90,8 +90,8 @@ private fun ListDialogContent(
subtitle = subtitle,
cancelText = cancelText,
submitText = submitText,
onCancelClicked = onDismissRequest,
onSubmitClicked = onSubmitClicked,
onCancelClick = onDismissRequest,
onSubmitClick = onSubmitClick,
enabled = enabled,
applyPaddingToContents = false,
) {
@ -109,15 +109,15 @@ internal fun ListDialogContentPreview() {
ListDialogContent(
listItems = {
item {
TextFieldListItem(placeholder = "Text input", text = "", onTextChanged = {})
TextFieldListItem(placeholder = "Text input", text = "", onTextChange = {})
}
item {
TextFieldListItem(placeholder = "Another text input", text = "", onTextChanged = {})
TextFieldListItem(placeholder = "Another text input", text = "", onTextChange = {})
}
},
title = "Dialog title",
onDismissRequest = {},
onSubmitClicked = {},
onSubmitClick = {},
cancelText = "Cancel",
submitText = "Save",
)
@ -131,10 +131,10 @@ internal fun ListDialogPreview() = ElementPreview {
ListDialog(
listItems = {
item {
TextFieldListItem(placeholder = "Text input", text = "", onTextChanged = {})
TextFieldListItem(placeholder = "Text input", text = "", onTextChange = {})
}
item {
TextFieldListItem(placeholder = "Another text input", text = "", onTextChanged = {})
TextFieldListItem(placeholder = "Another text input", text = "", onTextChange = {})
}
},
title = "Dialog title",

View file

@ -44,7 +44,7 @@ import kotlinx.collections.immutable.persistentListOf
@Composable
fun MultipleSelectionDialog(
options: ImmutableList<ListOption>,
onConfirmClicked: (List<Int>) -> Unit,
onConfirmClick: (List<Int>) -> Unit,
onDismissRequest: () -> Unit,
modifier: Modifier = Modifier,
confirmButtonTitle: String = stringResource(CommonStrings.action_confirm),
@ -70,7 +70,7 @@ fun MultipleSelectionDialog(
subtitle = decoratedSubtitle,
options = options,
confirmButtonTitle = confirmButtonTitle,
onConfirmClicked = onConfirmClicked,
onConfirmClick = onConfirmClick,
dismissButtonTitle = dismissButtonTitle,
onDismissRequest = onDismissRequest,
initialSelected = initialSelection,
@ -82,7 +82,7 @@ fun MultipleSelectionDialog(
private fun MultipleSelectionDialogContent(
options: ImmutableList<ListOption>,
confirmButtonTitle: String,
onConfirmClicked: (List<Int>) -> Unit,
onConfirmClick: (List<Int>) -> Unit,
dismissButtonTitle: String,
onDismissRequest: () -> Unit,
title: String? = null,
@ -97,11 +97,11 @@ private fun MultipleSelectionDialogContent(
title = title,
subtitle = subtitle,
submitText = confirmButtonTitle,
onSubmitClicked = {
onConfirmClicked(selectedOptionIndexes.toList())
onSubmitClick = {
onConfirmClick(selectedOptionIndexes.toList())
},
cancelText = dismissButtonTitle,
onCancelClicked = onDismissRequest,
onCancelClick = onDismissRequest,
applyPaddingToContents = false,
) {
LazyColumn {
@ -138,7 +138,7 @@ internal fun MultipleSelectionDialogContentPreview() {
MultipleSelectionDialogContent(
title = "Dialog title",
options = options,
onConfirmClicked = {},
onConfirmClick = {},
onDismissRequest = {},
confirmButtonTitle = "Save",
dismissButtonTitle = "Cancel",
@ -159,7 +159,7 @@ internal fun MultipleSelectionDialogPreview() = ElementPreview {
MultipleSelectionDialog(
title = "Dialog title",
options = options,
onConfirmClicked = {},
onConfirmClick = {},
onDismissRequest = {},
confirmButtonTitle = "Save",
dismissButtonTitle = "Cancel",

View file

@ -66,9 +66,9 @@ private fun RetryDialogContent(
title = title,
content = content,
submitText = retryText,
onSubmitClicked = onRetry,
onSubmitClick = onRetry,
cancelText = dismissText,
onCancelClicked = onDismiss,
onCancelClick = onDismiss,
)
}

View file

@ -41,7 +41,7 @@ import kotlinx.collections.immutable.persistentListOf
@Composable
fun SingleSelectionDialog(
options: ImmutableList<ListOption>,
onOptionSelected: (Int) -> Unit,
onSelectOption: (Int) -> Unit,
onDismissRequest: () -> Unit,
modifier: Modifier = Modifier,
title: String? = null,
@ -65,7 +65,7 @@ fun SingleSelectionDialog(
title = title,
subtitle = decoratedSubtitle,
options = options,
onOptionSelected = onOptionSelected,
onOptionClick = onSelectOption,
dismissButtonTitle = dismissButtonTitle,
onDismissRequest = onDismissRequest,
initialSelection = initialSelection,
@ -76,7 +76,7 @@ fun SingleSelectionDialog(
@Composable
private fun SingleSelectionDialogContent(
options: ImmutableList<ListOption>,
onOptionSelected: (Int) -> Unit,
onOptionClick: (Int) -> Unit,
dismissButtonTitle: String,
onDismissRequest: () -> Unit,
title: String? = null,
@ -87,7 +87,7 @@ private fun SingleSelectionDialogContent(
title = title,
subtitle = subtitle,
submitText = dismissButtonTitle,
onSubmitClicked = onDismissRequest,
onSubmitClick = onDismissRequest,
applyPaddingToContents = false,
) {
LazyColumn {
@ -96,7 +96,7 @@ private fun SingleSelectionDialogContent(
headline = option.title,
supportingText = option.subtitle,
selected = index == initialSelection,
onSelected = { onOptionSelected(index) },
onSelect = { onOptionClick(index) },
compactLayout = true,
modifier = Modifier.padding(start = 8.dp)
)
@ -118,7 +118,7 @@ internal fun SingleSelectionDialogContentPreview() {
SingleSelectionDialogContent(
title = "Dialog title",
options = options,
onOptionSelected = {},
onOptionClick = {},
onDismissRequest = {},
dismissButtonTitle = "Cancel",
initialSelection = 0
@ -138,7 +138,7 @@ internal fun SingleSelectionDialogPreview() = ElementPreview {
SingleSelectionDialog(
title = "Dialog title",
options = options,
onOptionSelected = {},
onSelectOption = {},
onDismissRequest = {},
dismissButtonTitle = "Cancel",
initialSelection = 0

View file

@ -41,7 +41,7 @@ import kotlinx.collections.immutable.toImmutableList
fun MultipleSelectionListItem(
headline: String,
options: ImmutableList<ListOption>,
onSelectionChanged: (List<Int>) -> Unit,
onSelectionChange: (List<Int>) -> Unit,
resultFormatter: (List<Int>) -> String?,
modifier: Modifier = Modifier,
supportingText: String? = null,
@ -87,9 +87,9 @@ fun MultipleSelectionListItem(
MultipleSelectionDialog(
title = headline,
options = options,
onConfirmClicked = { newSelectedIndexes ->
onConfirmClick = { newSelectedIndexes ->
if (newSelectedIndexes != selectedIndexes.toList()) {
onSelectionChanged(newSelectedIndexes)
onSelectionChange(newSelectedIndexes)
selectedIndexes.clear()
selectedIndexes.addAll(newSelectedIndexes)
}
@ -109,7 +109,7 @@ internal fun MutipleSelectionListItemPreview() {
MultipleSelectionListItem(
headline = "Headline",
options = options,
onSelectionChanged = {},
onSelectionChange = {},
supportingText = "Supporting text",
resultFormatter = { result -> formatResult(result, options) },
)
@ -125,7 +125,7 @@ internal fun MutipleSelectionListItemSelectedPreview() {
MultipleSelectionListItem(
headline = "Headline",
options = options,
onSelectionChanged = {},
onSelectionChange = {},
supportingText = "Supporting text",
resultFormatter = {
val selectedValues = formatResult(it, options)
@ -145,7 +145,7 @@ internal fun MutipleSelectionListItemSelectedTrailingContentPreview() {
MultipleSelectionListItem(
headline = "Headline",
options = options,
onSelectionChanged = {},
onSelectionChange = {},
supportingText = "Supporting text",
resultFormatter = { selected.size.toString() },
displayResultInTrailingContent = true,

View file

@ -26,7 +26,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
fun RadioButtonListItem(
headline: String,
selected: Boolean,
onSelected: () -> Unit,
onSelect: () -> Unit,
modifier: Modifier = Modifier,
supportingText: String? = null,
trailingContent: ListItemContent? = null,
@ -42,6 +42,6 @@ fun RadioButtonListItem(
trailingContent = trailingContent,
style = style,
enabled = enabled,
onClick = onSelected,
onClick = onSelect,
)
}

View file

@ -42,7 +42,7 @@ import kotlin.time.Duration.Companion.seconds
fun SingleSelectionListItem(
headline: String,
options: ImmutableList<ListOption>,
onSelectionChanged: (Int) -> Unit,
onSelectionChange: (Int) -> Unit,
modifier: Modifier = Modifier,
supportingText: String? = null,
leadingContent: ListItemContent? = null,
@ -86,9 +86,9 @@ fun SingleSelectionListItem(
SingleSelectionDialog(
title = headline,
options = options,
onOptionSelected = { index ->
onSelectOption = { index ->
if (index != selectedIndex) {
onSelectionChanged(index)
onSelectionChange(index)
selectedIndex = index
}
// Delay hiding the dialog for a bit so the new state is displayed in it before being dismissed
@ -110,7 +110,7 @@ internal fun SingleSelectionListItemPreview() {
SingleSelectionListItem(
headline = "Headline",
options = listOptionOf("Option 1", "Option 2", "Option 3"),
onSelectionChanged = {},
onSelectionChange = {},
)
}
}
@ -123,7 +123,7 @@ internal fun SingleSelectionListItemUnselectedWithSupportingTextPreview() {
headline = "Headline",
options = listOptionOf("Option 1", "Option 2", "Option 3"),
supportingText = "Supporting text",
onSelectionChanged = {},
onSelectionChange = {},
)
}
}
@ -136,7 +136,7 @@ internal fun SingleSelectionListItemSelectedInSupportingTextPreview() {
headline = "Headline",
options = listOptionOf("Option 1", "Option 2", "Option 3"),
supportingText = "Supporting text",
onSelectionChanged = {},
onSelectionChange = {},
selected = 1,
)
}
@ -150,7 +150,7 @@ internal fun SingleSelectionListItemSelectedInTrailingContentPreview() {
headline = "Headline",
options = listOptionOf("Option 1", "Option 2", "Option 3"),
supportingText = "Supporting text",
onSelectionChanged = {},
onSelectionChange = {},
selected = 1,
displayResultInTrailingContent = true,
)
@ -165,7 +165,7 @@ internal fun SingleSelectionListItemCustomFormattertPreview() {
headline = "Headline",
options = listOptionOf("Option 1", "Option 2", "Option 3"),
supportingText = "Supporting text",
onSelectionChanged = {},
onSelectionChange = {},
resultFormatter = { "Selected index: $it" },
selected = 1,
displayResultInTrailingContent = true,

View file

@ -34,7 +34,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
fun TextFieldListItem(
placeholder: String?,
text: String,
onTextChanged: (String) -> Unit,
onTextChange: (String) -> Unit,
modifier: Modifier = Modifier,
error: String? = null,
maxLines: Int = 1,
@ -45,7 +45,7 @@ fun TextFieldListItem(
OutlinedTextField(
value = text,
onValueChange = { onTextChanged(it) },
onValueChange = { onTextChange(it) },
placeholder = placeholder?.let { @Composable { Text(it) } },
colors = OutlinedTextFieldDefaults.colors(
disabledBorderColor = Color.Transparent,
@ -68,7 +68,7 @@ fun TextFieldListItem(
fun TextFieldListItem(
placeholder: String?,
text: TextFieldValue,
onTextChanged: (TextFieldValue) -> Unit,
onTextChange: (TextFieldValue) -> Unit,
modifier: Modifier = Modifier,
error: String? = null,
maxLines: Int = 1,
@ -79,7 +79,7 @@ fun TextFieldListItem(
OutlinedTextField(
value = text,
onValueChange = { onTextChanged(it) },
onValueChange = { onTextChange(it) },
placeholder = placeholder?.let { @Composable { Text(it) } },
colors = OutlinedTextFieldDefaults.colors(
disabledBorderColor = Color.Transparent,
@ -105,7 +105,7 @@ internal fun TextFieldListItemEmptyPreview() {
TextFieldListItem(
placeholder = "Placeholder",
text = "",
onTextChanged = {},
onTextChange = {},
)
}
}
@ -117,7 +117,7 @@ internal fun TextFieldListItemPreview() {
TextFieldListItem(
placeholder = "Placeholder",
text = "Text",
onTextChanged = {},
onTextChange = {},
)
}
}
@ -129,7 +129,7 @@ internal fun TextFieldListItemTextFieldValuePreview() {
TextFieldListItem(
placeholder = "Placeholder",
text = TextFieldValue("Text field value"),
onTextChanged = {},
onTextChange = {},
)
}
}

View file

@ -44,7 +44,7 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
@Composable
fun PreferencePage(
title: String,
onBackPressed: () -> Unit,
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
snackbarHost: @Composable () -> Unit = {},
content: @Composable ColumnScope.() -> Unit,
@ -58,7 +58,7 @@ fun PreferencePage(
topBar = {
PreferenceTopAppBar(
title = title,
onBackPressed = onBackPressed,
onBackClick = onBackClick,
)
},
snackbarHost = snackbarHost,
@ -79,11 +79,11 @@ fun PreferencePage(
@Composable
private fun PreferenceTopAppBar(
title: String,
onBackPressed: () -> Unit,
onBackClick: () -> Unit,
) {
TopAppBar(
navigationIcon = {
BackButton(onClick = onBackPressed)
BackButton(onClick = onBackClick)
},
title = {
Text(
@ -101,7 +101,7 @@ private fun PreferenceTopAppBar(
internal fun PreferencePagePreview() = ElementPreview {
PreferencePage(
title = "Preference screen",
onBackPressed = {},
onBackClick = {},
) {
PreferenceCategory(
title = "Category title",

View file

@ -114,7 +114,7 @@ private fun TextFieldDialog(
TextFieldListItem(
placeholder = placeholder.orEmpty(),
text = textFieldContents,
onTextChanged = {
onTextChange = {
error = if (!validation(it.text)) onValidationErrorMessage else null
textFieldContents = it
},

View file

@ -54,14 +54,14 @@ import kotlin.math.max
internal fun SimpleAlertDialogContent(
content: String,
submitText: String,
onSubmitClicked: () -> Unit,
onSubmitClick: () -> Unit,
title: String? = null,
subtitle: @Composable (() -> Unit)? = null,
destructiveSubmit: Boolean = false,
cancelText: String? = null,
onCancelClicked: () -> Unit = {},
onCancelClick: () -> Unit = {},
thirdButtonText: String? = null,
onThirdButtonClicked: () -> Unit = {},
onThirdButtonClick: () -> Unit = {},
applyPaddingToContents: Boolean = true,
icon: @Composable (() -> Unit)? = null,
) {
@ -77,11 +77,11 @@ internal fun SimpleAlertDialogContent(
},
submitText = submitText,
destructiveSubmit = destructiveSubmit,
onSubmitClicked = onSubmitClicked,
onSubmitClick = onSubmitClick,
cancelText = cancelText,
onCancelClicked = onCancelClicked,
onCancelClick = onCancelClick,
thirdButtonText = thirdButtonText,
onThirdButtonClicked = onThirdButtonClicked,
onThirdButtonClick = onThirdButtonClick,
applyPaddingToContents = applyPaddingToContents,
)
}
@ -89,14 +89,14 @@ internal fun SimpleAlertDialogContent(
@Composable
internal fun SimpleAlertDialogContent(
submitText: String,
onSubmitClicked: () -> Unit,
onSubmitClick: () -> Unit,
title: String? = null,
subtitle: @Composable (() -> Unit)? = null,
destructiveSubmit: Boolean = false,
cancelText: String? = null,
onCancelClicked: () -> Unit = {},
onCancelClick: () -> Unit = {},
thirdButtonText: String? = null,
onThirdButtonClicked: () -> Unit = {},
onThirdButtonClick: () -> Unit = {},
applyPaddingToContents: Boolean = true,
enabled: Boolean = true,
icon: @Composable (() -> Unit)? = null,
@ -115,7 +115,7 @@ internal fun SimpleAlertDialogContent(
modifier = Modifier.testTag(TestTags.dialogNeutral),
text = thirdButtonText,
size = ButtonSize.Medium,
onClick = onThirdButtonClicked,
onClick = onThirdButtonClick,
)
}
if (cancelText != null) {
@ -123,14 +123,14 @@ internal fun SimpleAlertDialogContent(
modifier = Modifier.testTag(TestTags.dialogNegative),
text = cancelText,
size = ButtonSize.Medium,
onClick = onCancelClicked,
onClick = onCancelClick,
)
Button(
modifier = Modifier.testTag(TestTags.dialogPositive),
text = submitText,
enabled = enabled,
size = ButtonSize.Medium,
onClick = onSubmitClicked,
onClick = onSubmitClick,
destructive = destructiveSubmit,
)
} else {
@ -139,7 +139,7 @@ internal fun SimpleAlertDialogContent(
text = submitText,
enabled = enabled,
size = ButtonSize.Medium,
onClick = onSubmitClicked,
onClick = onSubmitClick,
destructive = destructiveSubmit,
)
}
@ -174,6 +174,7 @@ internal fun SimpleAlertDialogContent(
/**
* Copy of M3's `AlertDialogContent` so we can use it for previews.
*/
@Suppress("ContentTrailingLambda")
@Composable
internal fun AlertDialogContent(
buttons: @Composable () -> Unit,
@ -444,7 +445,7 @@ internal fun DialogWithTitleIconAndOkButtonPreview() {
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
" or prompt for a decision to be made. Learn more",
submitText = "OK",
onSubmitClicked = {},
onSubmitClick = {},
)
}
}
@ -461,7 +462,7 @@ internal fun DialogWithTitleAndOkButtonPreview() {
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
" or prompt for a decision to be made. Learn more",
submitText = "OK",
onSubmitClicked = {},
onSubmitClick = {},
)
}
}
@ -477,7 +478,7 @@ internal fun DialogWithOnlyMessageAndOkButtonPreview() {
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
" or prompt for a decision to be made. Learn more",
submitText = "OK",
onSubmitClicked = {},
onSubmitClick = {},
)
}
}
@ -494,7 +495,7 @@ internal fun DialogWithDestructiveButtonPreview() {
cancelText = "Cancel",
submitText = "Delete",
destructiveSubmit = true,
onSubmitClicked = {},
onSubmitClick = {},
)
}
}
@ -511,7 +512,7 @@ internal fun DialogWithThirdButtonPreview() {
cancelText = "Cancel",
submitText = "Delete",
thirdButtonText = "Other",
onSubmitClicked = {},
onSubmitClick = {},
)
}
}

View file

@ -39,7 +39,7 @@ fun Slider(
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
// @IntRange(from = 0)
steps: Int = 0,
onValueChangeFinished: (() -> Unit)? = null,
onValueChangeFinish: (() -> Unit)? = null,
colors: SliderColors = SliderDefaults.colors(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
) {
@ -50,7 +50,7 @@ fun Slider(
enabled = enabled,
valueRange = valueRange,
steps = steps,
onValueChangeFinished = onValueChangeFinished,
onValueChangeFinished = onValueChangeFinish,
colors = colors,
interactionSource = interactionSource,
)

View file

@ -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 = { },
)
}

View file

@ -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 = {},
)
}

View file

@ -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 = {},
)
}

View file

@ -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 = {},
)
}

View file

@ -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)

View file

@ -56,7 +56,7 @@ open class MediaViewerNode @AssistedInject constructor(
MediaViewerView(
state = state,
modifier = modifier,
onBackPressed = this::navigateUp
onBackClick = this::navigateUp
)
}
}

View file

@ -84,7 +84,7 @@ import kotlin.time.Duration
@Composable
fun MediaViewerView(
state: MediaViewerState,
onBackPressed: () -> Unit,
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
) {
val snackbarHostState = rememberSnackbarHostState(snackbarMessage = state.snackbarMessage)
@ -99,9 +99,9 @@ fun MediaViewerView(
showOverlay = showOverlay,
state = state,
onDismiss = {
onBackPressed()
onBackClick()
},
onShowOverlayChanged = {
onShowOverlayChange = {
showOverlay = it
}
)
@ -109,7 +109,7 @@ fun MediaViewerView(
MediaViewerTopBar(
actionsEnabled = state.downloadedMedia is AsyncData.Success,
mimeType = state.mediaInfo.mimeType,
onBackPressed = onBackPressed,
onBackClick = onBackClick,
canDownload = state.canDownload,
canShare = state.canShare,
eventSink = state.eventSink
@ -123,7 +123,7 @@ private fun MediaViewerPage(
showOverlay: Boolean,
state: MediaViewerState,
onDismiss: () -> Unit,
onShowOverlayChanged: (Boolean) -> Unit,
onShowOverlayChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
) {
fun onRetry() {
@ -135,7 +135,7 @@ private fun MediaViewerPage(
}
val currentShowOverlay by rememberUpdatedState(showOverlay)
val currentOnShowOverlayChanged by rememberUpdatedState(onShowOverlayChanged)
val currentOnShowOverlayChange by rememberUpdatedState(onShowOverlayChange)
val flickState = rememberFlickToDismissState(dismissThresholdRatio = 0.1f, rotateOnDrag = false)
DismissFlickEffects(
@ -145,7 +145,7 @@ private fun MediaViewerPage(
onDismiss()
},
onDragging = {
currentOnShowOverlayChanged(false)
currentOnShowOverlayChange(false)
}
)
@ -171,7 +171,7 @@ private fun MediaViewerPage(
LaunchedEffect(playableState) {
if (playableState is PlayableState.Playable) {
currentOnShowOverlayChanged(playableState.isShowingControls)
currentOnShowOverlayChange(playableState.isShowingControls)
}
}
@ -182,7 +182,7 @@ private fun MediaViewerPage(
mediaInfo = state.mediaInfo,
onClick = {
if (playableState is PlayableState.NotPlayable) {
currentOnShowOverlayChanged(!currentShowOverlay)
currentOnShowOverlayChange(!currentShowOverlay)
}
},
)
@ -263,7 +263,7 @@ private fun MediaViewerTopBar(
canDownload: Boolean,
canShare: Boolean,
mimeType: String,
onBackPressed: () -> Unit,
onBackClick: () -> Unit,
eventSink: (MediaViewerEvents) -> Unit,
) {
TopAppBar(
@ -271,7 +271,7 @@ private fun MediaViewerTopBar(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = Color.Transparent.copy(0.6f),
),
navigationIcon = { BackButton(onClick = onBackPressed) },
navigationIcon = { BackButton(onClick = onBackClick) },
actions = {
IconButton(
enabled = actionsEnabled,
@ -386,6 +386,6 @@ private fun backgroundColorFor(flickState: FlickToDismissState): Color {
internal fun MediaViewerViewPreview(@PreviewParameter(MediaViewerStateProvider::class) state: MediaViewerState) = ElementPreviewDark {
MediaViewerView(
state = state,
onBackPressed = {}
onBackClick = {}
)
}

View file

@ -53,7 +53,7 @@ class MediaViewerViewTest {
aMediaViewerState(
eventSink = eventsRecorder
),
onBackPressed = callback,
onBackClick = callback,
)
rule.pressBack()
}
@ -127,7 +127,7 @@ class MediaViewerViewTest {
mediaInfo = anImageMediaInfo(),
eventSink = eventsRecorder
),
onBackPressed = callback,
onBackClick = callback,
)
val imageContentDescription = rule.activity.getString(CommonStrings.common_image)
rule.onNodeWithContentDescription(imageContentDescription).performTouchInput { swipeDown() }
@ -166,12 +166,12 @@ class MediaViewerViewTest {
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setMediaViewerView(
state: MediaViewerState,
onBackPressed: () -> Unit = EnsureNeverCalled(),
onBackClick: () -> Unit = EnsureNeverCalled(),
) {
setContent {
MediaViewerView(
state = state,
onBackPressed = onBackPressed,
onBackClick = onBackClick,
)
}
}

View file

@ -38,7 +38,7 @@ fun PermissionsView(
title = stringResource(id = CommonStrings.common_permission),
content = state.permission.toDialogContent(),
submitText = stringResource(id = CommonStrings.action_open_settings),
onSubmitClicked = {
onSubmitClick = {
state.eventSink.invoke(PermissionsEvents.OpenSystemSettingAndCloseDialog)
},
onDismiss = { state.eventSink.invoke(PermissionsEvents.CloseDialog) },

View file

@ -82,7 +82,7 @@ fun RoomSelectView(
if (isForwarding) return
SelectedRooms(
selectedRooms = selectedRooms,
onRoomRemoved = ::onRoomRemoved,
onRemoveRoom = ::onRoomRemoved,
modifier = Modifier.padding(vertical = 16.dp)
)
}
@ -192,7 +192,7 @@ fun RoomSelectView(
@Composable
private fun SelectedRooms(
selectedRooms: ImmutableList<RoomSummaryDetails>,
onRoomRemoved: (RoomSummaryDetails) -> Unit,
onRemoveRoom: (RoomSummaryDetails) -> Unit,
modifier: Modifier = Modifier,
) {
LazyRow(
@ -201,7 +201,7 @@ private fun SelectedRooms(
horizontalArrangement = Arrangement.spacedBy(32.dp)
) {
items(selectedRooms, key = { it.roomId.value }) { roomSummary ->
SelectedRoom(roomSummary = roomSummary, onRoomRemoved = onRoomRemoved)
SelectedRoom(roomSummary = roomSummary, onRemoveRoom = onRemoveRoom)
}
}
}

View file

@ -106,8 +106,8 @@ fun TextComposer(
onDeleteVoiceMessage: () -> Unit,
onError: (Throwable) -> Unit,
onTyping: (Boolean) -> Unit,
onSuggestionReceived: (Suggestion?) -> Unit,
onRichContentSelected: ((Uri) -> Unit)?,
onReceiveSuggestion: (Suggestion?) -> Unit,
onSelectRichContent: ((Uri) -> Unit)?,
modifier: Modifier = Modifier,
showTextFormatting: Boolean = false,
subcomposing: Boolean = false,
@ -116,15 +116,15 @@ fun TextComposer(
is TextEditorState.Markdown -> state.state.text.value()
is TextEditorState.Rich -> state.richTextEditorState.messageMarkdown
}
val onSendClicked = {
val onSendClick = {
onSendMessage()
}
val onPlayVoiceMessageClicked = {
val onPlayVoiceMessageClick = {
onVoicePlayerEvent(VoiceMessagePlayerEvent.Play)
}
val onPauseVoiceMessageClicked = {
val onPauseVoiceMessageClick = {
onVoicePlayerEvent(VoiceMessagePlayerEvent.Pause)
}
@ -169,7 +169,7 @@ fun TextComposer(
resolveRoomMentionDisplay = { TextDisplay.Custom(mentionSpanProvider.getMentionSpanFor("@room", "#")) },
onError = onError,
onTyping = onTyping,
onRichContentSelected = onRichContentSelected,
onSelectRichContent = onSelectRichContent,
)
}
}
@ -188,9 +188,9 @@ fun TextComposer(
state = state.state,
subcomposing = subcomposing,
onTyping = onTyping,
onSuggestionReceived = onSuggestionReceived,
onReceiveSuggestion = onReceiveSuggestion,
richTextEditorStyle = style,
onRichContentSelected = onRichContentSelected,
onSelectRichContent = onSelectRichContent,
)
}
}
@ -201,7 +201,7 @@ fun TextComposer(
val sendButton = @Composable {
SendButton(
canSendMessage = canSendMessage,
onClick = onSendClicked,
onClick = onSendClick,
composerMode = composerMode,
)
}
@ -251,8 +251,8 @@ fun TextComposer(
waveform = voiceMessageState.waveform,
playbackProgress = voiceMessageState.playbackProgress,
time = voiceMessageState.time,
onPlayClick = onPlayVoiceMessageClicked,
onPauseClick = onPauseVoiceMessageClicked,
onPlayClick = onPlayVoiceMessageClick,
onPauseClick = onPauseVoiceMessageClick,
onSeek = onSeekVoiceMessage,
)
is VoiceMessageState.Recording ->
@ -302,15 +302,15 @@ fun TextComposer(
SoftKeyboardEffect(showTextFormatting, onRequestFocus) { it }
}
val latestOnSuggestionReceived by rememberUpdatedState(onSuggestionReceived)
val latestOnReceiveSuggestion by rememberUpdatedState(onReceiveSuggestion)
if (state is TextEditorState.Rich) {
val menuAction = state.richTextEditorState.menuAction
LaunchedEffect(menuAction) {
if (menuAction is MenuAction.Suggestion) {
val suggestion = Suggestion(menuAction.suggestionPattern)
latestOnSuggestionReceived(suggestion)
latestOnReceiveSuggestion(suggestion)
} else {
latestOnSuggestionReceived(null)
latestOnReceiveSuggestion(null)
}
}
}
@ -481,7 +481,7 @@ private fun TextInput(
resolveMentionDisplay: (text: String, url: String) -> TextDisplay,
onError: (Throwable) -> Unit,
onTyping: (Boolean) -> Unit,
onRichContentSelected: ((Uri) -> Unit)?,
onSelectRichContent: ((Uri) -> Unit)?,
) {
TextInputBox(
composerMode = composerMode,
@ -502,7 +502,7 @@ private fun TextInput(
resolveMentionDisplay = resolveMentionDisplay,
resolveRoomMentionDisplay = resolveRoomMentionDisplay,
onError = onError,
onRichContentSelected = onRichContentSelected,
onRichContentSelected = onSelectRichContent,
onTyping = onTyping,
)
}
@ -842,8 +842,8 @@ private fun ATextComposer(
onDeleteVoiceMessage = {},
onError = {},
onTyping = {},
onSuggestionReceived = {},
onRichContentSelected = null,
onReceiveSuggestion = {},
onSelectRichContent = null,
)
}

View file

@ -104,14 +104,14 @@ private fun CreateLinkWithTextDialog(
TextFieldListItem(
placeholder = stringResource(id = CommonStrings.common_text),
text = linkText,
onTextChanged = { linkText = it },
onTextChange = { linkText = it },
)
}
item {
TextFieldListItem(
placeholder = stringResource(id = R.string.rich_text_editor_url_placeholder),
text = linkUrl,
onTextChanged = { linkUrl = it },
onTextChange = { linkUrl = it },
)
}
}
@ -142,7 +142,7 @@ private fun CreateLinkWithoutTextDialog(
TextFieldListItem(
placeholder = stringResource(id = R.string.rich_text_editor_url_placeholder),
text = linkUrl,
onTextChanged = { linkUrl = it },
onTextChange = { linkUrl = it },
)
}
}
@ -167,7 +167,7 @@ private fun EditLinkDialog(
onDismissRequest()
}
fun onRemoveClicked() {
fun onRemoveClick() {
onRemoveLinkRequest()
onDismissRequest()
}
@ -182,7 +182,7 @@ private fun EditLinkDialog(
TextFieldListItem(
placeholder = stringResource(id = R.string.rich_text_editor_url_placeholder),
text = linkUrl,
onTextChanged = { linkUrl = it },
onTextChange = { linkUrl = it },
)
}
item {
@ -193,7 +193,7 @@ private fun EditLinkDialog(
color = ElementTheme.colors.textCriticalPrimary
)
},
onClick = ::onRemoveClicked,
onClick = ::onRemoveClick,
)
}
}

View file

@ -52,9 +52,9 @@ fun MarkdownTextInput(
state: MarkdownTextEditorState,
subcomposing: Boolean,
onTyping: (Boolean) -> Unit,
onSuggestionReceived: (Suggestion?) -> Unit,
onReceiveSuggestion: (Suggestion?) -> Unit,
richTextEditorStyle: RichTextEditorStyle,
onRichContentSelected: ((Uri) -> Unit)?,
onSelectRichContent: ((Uri) -> Unit)?,
) {
val canUpdateState = !subcomposing
@ -106,18 +106,18 @@ fun MarkdownTextInput(
state.lineCount = lineCount
state.currentMentionSuggestion = editable?.checkSuggestionNeeded()
onSuggestionReceived(state.currentMentionSuggestion)
onReceiveSuggestion(state.currentMentionSuggestion)
}
onSelectionChangeListener = { selStart, selEnd ->
state.selection = selStart..selEnd
state.currentMentionSuggestion = editableText.checkSuggestionNeeded()
onSuggestionReceived(state.currentMentionSuggestion)
onReceiveSuggestion(state.currentMentionSuggestion)
}
if (onRichContentSelected != null) {
if (onSelectRichContent != null) {
ViewCompat.setOnReceiveContentListener(
this,
arrayOf("image/*"),
ReceiveUriContentListener { onRichContentSelected(it) }
ReceiveUriContentListener { onSelectRichContent(it) }
)
}
state.requestFocusAction = { this.requestFocus() }
@ -188,9 +188,9 @@ internal fun MarkdownTextInputPreview() {
state = aMarkdownTextEditorState(),
subcomposing = false,
onTyping = {},
onSuggestionReceived = {},
onReceiveSuggestion = {},
richTextEditorStyle = style,
onRichContentSelected = {},
onSelectRichContent = {},
)
}
}

View file

@ -189,9 +189,9 @@ class MarkdownTextInputTest {
state = state,
subcomposing = subcomposing,
onTyping = onTyping,
onSuggestionReceived = onSuggestionReceived,
onReceiveSuggestion = onSuggestionReceived,
richTextEditorStyle = style,
onRichContentSelected = null,
onSelectRichContent = null,
)
}
}

View file

@ -49,7 +49,7 @@ class TroubleshootNotificationsNode @AssistedInject constructor(
val state = presenter.present()
TroubleshootNotificationsView(
state = state,
onBackPressed = ::onDone,
onBackClick = ::onDone,
modifier = modifier,
)
}

View file

@ -44,7 +44,7 @@ import io.element.android.libraries.troubleshoot.api.test.NotificationTroublesho
@Composable
fun TroubleshootNotificationsView(
state: TroubleshootNotificationsState,
onBackPressed: () -> Unit,
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
) {
OnLifecycleEvent { _, event ->
@ -60,7 +60,7 @@ fun TroubleshootNotificationsView(
PreferencePage(
modifier = modifier,
onBackPressed = onBackPressed,
onBackClick = onBackClick,
title = stringResource(id = R.string.troubleshoot_notifications_screen_title),
) {
TroubleshootNotificationsContent(state)
@ -70,7 +70,7 @@ fun TroubleshootNotificationsView(
@Composable
private fun TroubleshootTestView(
testState: NotificationTroubleshootTestState,
onQuickFixClicked: () -> Unit,
onQuickFixClick: () -> Unit,
) {
if ((testState.status as? Status.Idle)?.visible == false) return
ListItem(
@ -119,7 +119,7 @@ private fun TroubleshootTestView(
trailingContent = ListItemContent.Custom {
Button(
text = stringResource(id = R.string.troubleshoot_notifications_screen_quick_fix_action),
onClick = onQuickFixClicked
onClick = onQuickFixClick
)
}
)
@ -135,7 +135,7 @@ private fun TroubleshootNotificationsContent(state: TroubleshootNotificationsSta
is AsyncAction.Failure -> {
TestSuiteView(
testSuiteState = state.testSuiteState,
onQuickFixClicked = {
onQuickFixClick = {
state.eventSink(TroubleshootNotificationsEvents.QuickFix(it))
}
)
@ -199,13 +199,13 @@ private fun RunTestButton(state: TroubleshootNotificationsState) {
@Composable
private fun TestSuiteView(
testSuiteState: TroubleshootTestSuiteState,
onQuickFixClicked: (Int) -> Unit,
onQuickFixClick: (Int) -> Unit,
) {
testSuiteState.tests.forEachIndexed { index, testState ->
TroubleshootTestView(
testState = testState,
onQuickFixClicked = {
onQuickFixClicked(index)
onQuickFixClick = {
onQuickFixClick(index)
},
)
}
@ -218,6 +218,6 @@ internal fun TroubleshootNotificationsViewPreview(
) = ElementPreview {
TroubleshootNotificationsView(
state = state,
onBackPressed = {},
onBackClick = {},
)
}

View file

@ -45,7 +45,7 @@ class TroubleshootNotificationsViewTest {
state = aTroubleshootNotificationsState(
eventSink = eventsRecorder
),
onBackPressed = it,
onBackClick = it,
)
rule.pressBack()
}
@ -112,12 +112,12 @@ class TroubleshootNotificationsViewTest {
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setTroubleshootNotificationsView(
state: TroubleshootNotificationsState,
onBackPressed: () -> Unit = EnsureNeverCalled(),
onBackClick: () -> Unit = EnsureNeverCalled(),
) {
setContent {
TroubleshootNotificationsView(
state = state,
onBackPressed = onBackPressed,
onBackClick = onBackClick,
)
}
}