Skip to content

Commit

Permalink
Replaced some deprecated stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Waboodoo committed Dec 19, 2024
1 parent a7e6f7e commit 8e93c43
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fun CertPinningContent(
PinItem(
pin = pin,
modifier = Modifier
.animateItemPlacement()
.animateItem()
.clickable {
onPinClicked(pin.id)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private fun ShortcutLinearList(
textColor = textColor,
textStyle = textStyle,
modifier = Modifier
.animateItemPlacement()
.animateItem()
.combinedClickable(
onLongClick = if (isLongClickingEnabled) {
{
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 8e93c43

Please sign in to comment.