diff --git a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/certpinning/CertPinningContent.kt b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/certpinning/CertPinningContent.kt index dc70ee089..f3266f336 100644 --- a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/certpinning/CertPinningContent.kt +++ b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/certpinning/CertPinningContent.kt @@ -43,7 +43,7 @@ fun CertPinningContent( PinItem( pin = pin, modifier = Modifier - .animateItemPlacement() + .animateItem() .clickable { onPinClicked(pin.id) }, diff --git a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/editor/scripting/codesnippets/CodeSnippetPickerContent.kt b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/editor/scripting/codesnippets/CodeSnippetPickerContent.kt index 47d003aa6..6aae6f975 100644 --- a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/editor/scripting/codesnippets/CodeSnippetPickerContent.kt +++ b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/editor/scripting/codesnippets/CodeSnippetPickerContent.kt @@ -78,7 +78,7 @@ fun CodeSnippetPickerContent( is ItemWrapper.CodeSnippet -> { with(itemWrapper.codeSnippetItem) { CodeSnippetItem( - modifier = Modifier.animateItemPlacement(), + modifier = Modifier.animateItem(), title = title.localize(), description = description?.localize(), onDocumentationButtonClicked = docRef?.let { @@ -94,7 +94,7 @@ fun CodeSnippetPickerContent( } is ItemWrapper.Section -> { Section( - modifier = Modifier.animateItemPlacement(), + modifier = Modifier.animateItem(), title = itemWrapper.sectionItem.title.localize(), icon = itemWrapper.sectionItem.icon, expanded = itemWrapper.expanded, diff --git a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/MainActivity.kt b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/MainActivity.kt index 967920b7d..f59e07463 100644 --- a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/MainActivity.kt +++ b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/MainActivity.kt @@ -9,7 +9,6 @@ import androidx.activity.result.contract.ActivityResultContract import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.navigationBarsPadding -import androidx.compose.foundation.text.ClickableText import androidx.compose.material3.AlertDialog import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -18,8 +17,12 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.LinkAnnotation +import androidx.compose.ui.text.LinkInteractionListener import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.TextLinkStyles import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.withLink import androidx.compose.ui.text.withStyle import androidx.core.view.WindowCompat import ch.rmy.android.framework.extensions.finishWithoutAnimation @@ -144,20 +147,22 @@ class MainActivity : BaseComposeActivity() { append(stringResource(R.string.error_realm_unavailable)) } append(" ") - pushStringAnnotation(tag = "releases", annotation = RELEASES) - withStyle(style = SpanStyle(color = MaterialTheme.colorScheme.primary)) { + withLink( + LinkAnnotation.Url( + RELEASES, + styles = TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)), + linkInteractionListener = object : LinkInteractionListener { + override fun onClick(link: LinkAnnotation) { + context.openURL(RELEASES) + onDismissed() + } + }, + ) + ) { append(RELEASES) } - pop() } - ClickableText( - text, - onClick = { offset -> - text.getStringAnnotations(tag = "releases", start = offset, end = offset).firstOrNull()?.let { - context.openURL(it.item) - } - }, - ) + Text(text) }, confirmButton = { TextButton(onClick = onDismissed) { diff --git a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/ShortcutList.kt b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/ShortcutList.kt index cce7a3dfb..bb9db46da 100644 --- a/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/ShortcutList.kt +++ b/HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/activities/main/ShortcutList.kt @@ -131,7 +131,7 @@ private fun ShortcutLinearList( textColor = textColor, textStyle = textStyle, modifier = Modifier - .animateItemPlacement() + .animateItem() .combinedClickable( onLongClick = if (isLongClickingEnabled) { { @@ -237,7 +237,7 @@ private fun ShortcutGrid( textColor = textColor, textStyle = textStyle, modifier = Modifier - .animateItemPlacement() + .animateItem() .combinedClickable( interactionSource = remember { MutableInteractionSource() }, indication = ripple(bounded = false, radius = 48.dp),