Skip to content

Commit 3557529

Browse files
committed
Inline url metadata icon
1 parent 298080a commit 3557529

File tree

1 file changed

+25
-19
lines changed
  • app/src/main/java/com/babylon/wallet/android/presentation/account/composable

1 file changed

+25
-19
lines changed

app/src/main/java/com/babylon/wallet/android/presentation/account/composable/MetadataView.kt

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import androidx.compose.ui.text.TextStyle
2525
import androidx.compose.ui.text.buildAnnotatedString
2626
import androidx.compose.ui.text.style.TextAlign
2727
import androidx.compose.ui.text.style.TextOverflow
28-
import androidx.compose.ui.unit.sp
2928
import com.babylon.wallet.android.R
3029
import com.babylon.wallet.android.designsystem.theme.RadixTheme
3130
import com.babylon.wallet.android.presentation.ui.composables.ExpandableText
@@ -266,31 +265,38 @@ fun MetadataValueView(
266265
maxLines = 2
267266
)
268267

269-
MetadataType.Url -> Row(
268+
MetadataType.Url -> Text(
270269
modifier = modifier
271270
.fillMaxWidth()
272271
.clickable { context.openUrl(metadata.value) },
273-
horizontalArrangement = Arrangement.spacedBy(RadixTheme.dimensions.paddingDefault),
274-
verticalAlignment = Alignment.CenterVertically
275-
) {
276-
Text(
277-
text = metadata.value,
278-
style = RadixTheme.typography.body1StandaloneLink,
279-
color = RadixTheme.colors.blue1
280-
)
281-
Icon(
282-
painter = painterResource(id = R.drawable.ic_external_link),
283-
contentDescription = null,
284-
tint = RadixTheme.colors.gray3
285-
)
286-
}
272+
text = buildAnnotatedString {
273+
append(metadata.value)
274+
append(" ")
275+
appendInlineContent(id = "link_icon")
276+
},
277+
style = RadixTheme.typography.body1StandaloneLink,
278+
color = RadixTheme.colors.blue1,
279+
inlineContent = mapOf("link_icon" to InlineTextContent(
280+
Placeholder(
281+
RadixTheme.typography.body1StandaloneLink.fontSize,
282+
RadixTheme.typography.body1StandaloneLink.fontSize,
283+
PlaceholderVerticalAlign.TextCenter
284+
)
285+
) {
286+
Icon(
287+
painter = painterResource(id = R.drawable.ic_external_link),
288+
contentDescription = null,
289+
tint = color
290+
)
291+
})
292+
)
287293
}
288294
}
289295
}
290296

291297
private const val ASSET_METADATA_SHORT_STRING_THRESHOLD = 40
292298
private val Metadata.isRenderedInNewLine: Boolean
293299
get() = this is Metadata.Primitive && (
294-
valueType is MetadataType.Url ||
295-
(valueType is MetadataType.String && value.length > ASSET_METADATA_SHORT_STRING_THRESHOLD)
296-
)
300+
valueType is MetadataType.Url ||
301+
(valueType is MetadataType.String && value.length > ASSET_METADATA_SHORT_STRING_THRESHOLD)
302+
)

0 commit comments

Comments
 (0)