Merge pull request #5179 from element-hq/feature/bma/compose2025.08.00
Update Compose BOM to version 2025.12.00.
This commit is contained in:
@@ -15,6 +15,7 @@ import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import com.bumble.appyx.core.plugin.Plugin
|
||||
@@ -100,6 +101,7 @@ class PinnedMessagesListNode(
|
||||
LocalTimelineItemPresenterFactories provides timelineItemPresenterFactories,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
|
||||
val view = LocalView.current
|
||||
val state = presenter.present()
|
||||
PinnedMessagesListView(
|
||||
@@ -113,8 +115,8 @@ class PinnedMessagesListNode(
|
||||
HapticFeedbackConstants.LONG_PRESS
|
||||
)
|
||||
context.copyToClipboard(
|
||||
it.url,
|
||||
context.getString(CommonStrings.common_copied_to_clipboard)
|
||||
text = it.url,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
},
|
||||
modifier = modifier
|
||||
|
||||
@@ -123,6 +123,7 @@ fun TimelineView(
|
||||
}
|
||||
|
||||
val context = LocalContext.current
|
||||
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
|
||||
val view = LocalView.current
|
||||
// Disable reverse layout when TalkBack is enabled to avoid incorrect ordering issues seen in the current Compose UI version
|
||||
val useReverseLayout = !isTalkbackActive()
|
||||
@@ -136,8 +137,8 @@ fun TimelineView(
|
||||
HapticFeedbackConstants.LONG_PRESS
|
||||
)
|
||||
context.copyToClipboard(
|
||||
link.url,
|
||||
context.getString(CommonStrings.common_copied_to_clipboard)
|
||||
text = link.url,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -721,6 +721,7 @@ private fun DebugInfoSection(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
PreferenceCategory(showTopDivider = true) {
|
||||
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text("Internal room ID")
|
||||
@@ -736,8 +737,8 @@ private fun DebugInfoSection(
|
||||
trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Copy())),
|
||||
onClick = {
|
||||
context.copyToClipboard(
|
||||
roomId.value,
|
||||
context.getString(CommonStrings.common_copied_to_clipboard)
|
||||
text = roomId.value,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -116,11 +116,12 @@ private fun Content(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val formattedRecoveryKey = state.recoveryKeyViewState.formattedRecoveryKey
|
||||
val toastMessage = stringResource(R.string.screen_recovery_key_copied_to_clipboard)
|
||||
val clickLambda = if (formattedRecoveryKey != null) {
|
||||
{
|
||||
context.copyToClipboard(
|
||||
formattedRecoveryKey,
|
||||
context.getString(R.string.screen_recovery_key_copied_to_clipboard)
|
||||
text = formattedRecoveryKey,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
state.eventSink.invoke(SecureBackupSetupEvents.RecoveryKeyHasBeenSaved)
|
||||
}
|
||||
|
||||
@@ -73,13 +73,14 @@ private fun LineRow(
|
||||
colorationMode: ColorationMode,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val toastMessage = stringResource(CommonStrings.common_line_copied_to_clipboard)
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable(onClick = {
|
||||
context.copyToClipboard(
|
||||
text = line,
|
||||
toastMessage = context.getString(CommonStrings.common_line_copied_to_clipboard),
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -22,7 +22,7 @@ camera = "1.5.2"
|
||||
work = "2.11.0"
|
||||
|
||||
# Compose
|
||||
compose_bom = "2025.07.00"
|
||||
compose_bom = "2025.12.00"
|
||||
|
||||
# Coroutines
|
||||
coroutines = "1.10.2"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package io.element.android.libraries.designsystem.components.tooltip
|
||||
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.TooltipAnchorPosition
|
||||
import androidx.compose.material3.TooltipDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
@@ -41,8 +42,9 @@ object ElementTooltipDefaults {
|
||||
windowPadding: Dp = 12.dp,
|
||||
): PopupPositionProvider {
|
||||
val windowPaddingPx = with(LocalDensity.current) { windowPadding.roundToPx() }
|
||||
val plainTooltipPositionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(
|
||||
spacingBetweenTooltipAndAnchor = spacingBetweenTooltipAndAnchor,
|
||||
val plainTooltipPositionProvider = TooltipDefaults.rememberTooltipPositionProvider(
|
||||
positioning = TooltipAnchorPosition.Above,
|
||||
spacingBetweenTooltipAndAnchor = spacingBetweenTooltipAndAnchor
|
||||
)
|
||||
return remember(windowPaddingPx, plainTooltipPositionProvider) {
|
||||
object : PopupPositionProvider {
|
||||
|
||||
@@ -12,12 +12,12 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.SheetState
|
||||
import androidx.compose.material3.SheetValue
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun sheetStateForPreview() = SheetState(
|
||||
skipPartiallyExpanded = true,
|
||||
positionalThreshold = { 0.5f },
|
||||
velocityThreshold = { 400f },
|
||||
initialValue = SheetValue.Expanded,
|
||||
density = LocalDensity.current,
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ fun MediumTopAppBar(
|
||||
navigationIcon: @Composable () -> Unit = {},
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
|
||||
colors: TopAppBarColors = TopAppBarDefaults.mediumTopAppBarColors(),
|
||||
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(),
|
||||
scrollBehavior: TopAppBarScrollBehavior? = null
|
||||
) {
|
||||
androidx.compose.material3.MediumTopAppBar(
|
||||
|
||||
@@ -14,13 +14,13 @@ import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.SearchBar
|
||||
import androidx.compose.material3.SearchBarColors
|
||||
import androidx.compose.material3.SearchBarDefaults
|
||||
import androidx.compose.material3.TextFieldColors
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Immutable
|
||||
@@ -45,6 +45,9 @@ import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
/**
|
||||
* Ref: https://www.figma.com/design/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?node-id=1992-8350
|
||||
*/
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun <T> SearchBar(
|
||||
@@ -63,14 +66,12 @@ fun <T> SearchBar(
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
inactiveBarColors: SearchBarColors = ElementSearchBarDefaults.inactiveColors(),
|
||||
activeBarColors: SearchBarColors = ElementSearchBarDefaults.activeColors(),
|
||||
inactiveTextInputColors: TextFieldColors = ElementSearchBarDefaults.inactiveInputFieldColors(),
|
||||
activeTextInputColors: TextFieldColors = ElementSearchBarDefaults.activeInputFieldColors(),
|
||||
contentPrefix: @Composable ColumnScope.() -> Unit = {},
|
||||
contentSuffix: @Composable ColumnScope.() -> Unit = {},
|
||||
resultHandler: @Composable ColumnScope.(T) -> Unit = {},
|
||||
) {
|
||||
val focusManager = LocalFocusManager.current
|
||||
|
||||
val colors = if (active) activeBarColors else inactiveBarColors
|
||||
val updatedOnQueryChange by rememberUpdatedState(onQueryChange)
|
||||
LaunchedEffect(active) {
|
||||
if (!active) {
|
||||
@@ -107,28 +108,25 @@ fun <T> SearchBar(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
!active -> {
|
||||
{
|
||||
Icon(
|
||||
imageVector = CompoundIcons.Search(),
|
||||
contentDescription = stringResource(CommonStrings.action_search),
|
||||
tint = ElementTheme.colors.iconTertiary,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
else -> null
|
||||
},
|
||||
interactionSource = interactionSource,
|
||||
colors = if (active) activeTextInputColors else inactiveTextInputColors,
|
||||
colors = colors.inputFieldColors,
|
||||
)
|
||||
},
|
||||
expanded = active,
|
||||
onExpandedChange = onActiveChange,
|
||||
modifier = modifier.padding(horizontal = if (!active) 16.dp else 0.dp),
|
||||
shape = shape,
|
||||
colors = if (active) activeBarColors else inactiveBarColors,
|
||||
colors = colors,
|
||||
tonalElevation = tonalElevation,
|
||||
windowInsets = windowInsets,
|
||||
content = {
|
||||
@@ -163,35 +161,43 @@ object ElementSearchBarDefaults {
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun inactiveColors() = SearchBarDefaults.colors(
|
||||
containerColor = ElementTheme.materialColors.surfaceVariant,
|
||||
dividerColor = ElementTheme.materialColors.outline,
|
||||
containerColor = Color.Transparent,
|
||||
dividerColor = ElementTheme.colors.borderInteractivePrimary,
|
||||
inputFieldColors = inactiveInputFieldColors(),
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun inactiveInputFieldColors() = TextFieldDefaults.colors(
|
||||
unfocusedPlaceholderColor = ElementTheme.colors.textDisabled,
|
||||
focusedPlaceholderColor = ElementTheme.colors.textDisabled,
|
||||
unfocusedLeadingIconColor = ElementTheme.materialColors.primary,
|
||||
focusedLeadingIconColor = ElementTheme.materialColors.primary,
|
||||
unfocusedTrailingIconColor = ElementTheme.materialColors.primary,
|
||||
focusedTrailingIconColor = ElementTheme.materialColors.primary,
|
||||
unfocusedTrailingIconColor = ElementTheme.colors.iconDisabled,
|
||||
focusedTrailingIconColor = ElementTheme.colors.iconDisabled,
|
||||
focusedContainerColor = ElementTheme.colors.bgSubtleSecondary,
|
||||
unfocusedContainerColor = ElementTheme.colors.bgSubtleSecondary,
|
||||
disabledContainerColor = ElementTheme.colors.bgSubtleSecondary,
|
||||
errorContainerColor = ElementTheme.colors.bgSubtleSecondary,
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun activeColors() = SearchBarDefaults.colors(
|
||||
containerColor = Color.Transparent,
|
||||
dividerColor = ElementTheme.materialColors.outline,
|
||||
dividerColor = ElementTheme.colors.borderInteractivePrimary,
|
||||
inputFieldColors = activeInputFieldColors(),
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun activeInputFieldColors() = TextFieldDefaults.colors(
|
||||
unfocusedPlaceholderColor = ElementTheme.colors.textDisabled,
|
||||
focusedPlaceholderColor = ElementTheme.colors.textDisabled,
|
||||
unfocusedLeadingIconColor = ElementTheme.materialColors.primary,
|
||||
focusedLeadingIconColor = ElementTheme.materialColors.primary,
|
||||
unfocusedTrailingIconColor = ElementTheme.materialColors.primary,
|
||||
focusedTrailingIconColor = ElementTheme.materialColors.primary,
|
||||
unfocusedPlaceholderColor = ElementTheme.colors.textSecondary,
|
||||
focusedPlaceholderColor = ElementTheme.colors.textSecondary,
|
||||
unfocusedLeadingIconColor = ElementTheme.colors.iconPrimary,
|
||||
focusedLeadingIconColor = ElementTheme.colors.iconPrimary,
|
||||
unfocusedTrailingIconColor = ElementTheme.colors.iconTertiary,
|
||||
focusedTrailingIconColor = ElementTheme.colors.iconTertiary,
|
||||
focusedContainerColor = Color.Transparent,
|
||||
unfocusedContainerColor = Color.Transparent,
|
||||
disabledContainerColor = Color.Transparent,
|
||||
errorContainerColor = Color.Transparent,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -295,6 +301,7 @@ private fun ContentToPreview(
|
||||
resultHandler: @Composable ColumnScope.(String) -> Unit = {},
|
||||
) {
|
||||
SearchBar(
|
||||
modifier = Modifier.heightIn(max = 200.dp),
|
||||
query = query,
|
||||
active = active,
|
||||
resultState = resultState,
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package io.element.android.libraries.matrix.ui.model
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
@@ -30,7 +29,7 @@ data class InviteSender(
|
||||
@Composable
|
||||
fun annotatedString(): AnnotatedString {
|
||||
return stringResource(R.string.screen_invites_invited_you, displayName, userId.value).let { text ->
|
||||
val senderNameStart = LocalContext.current.getString(R.string.screen_invites_invited_you).indexOf("%1\$s")
|
||||
val senderNameStart = stringResource(R.string.screen_invites_invited_you).indexOf($$"%1$s")
|
||||
AnnotatedString(
|
||||
text = text,
|
||||
spanStyles = listOf(
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user