Updated on 2026-08-14
This commit is contained in:
parent
8beb80f5a7
commit
43d6e92a89
26 changed files with 639 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ package com.tangem.core.ui.components.notifications
|
|||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import coil.compose.SubcomposeAsyncImage
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.LocalIndication
|
||||
|
|
@ -86,6 +87,7 @@ fun Notification(
|
|||
subtitleColor = subtitleColor,
|
||||
showArrowIcon = isEnabled && config.shouldShowArrowIcon,
|
||||
hasCloseButton = config.onCloseClick != null,
|
||||
iconUrl = config.iconUrl,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -150,16 +152,29 @@ private fun MainContent(
|
|||
subtitleColor: Color,
|
||||
showArrowIcon: Boolean,
|
||||
hasCloseButton: Boolean,
|
||||
iconUrl: String? = null,
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
iconResId = iconResId,
|
||||
tint = iconTint,
|
||||
modifier = Modifier
|
||||
.size(size = iconSize)
|
||||
.align(alignment = Alignment.Top)
|
||||
.testTag(NotificationTestTags.ICON),
|
||||
)
|
||||
if (iconUrl != null) {
|
||||
UrlIcon(
|
||||
iconUrl = iconUrl,
|
||||
fallbackIconResId = iconResId,
|
||||
fallbackIconTint = iconTint,
|
||||
modifier = Modifier
|
||||
.size(size = iconSize)
|
||||
.align(alignment = Alignment.Top)
|
||||
.testTag(NotificationTestTags.ICON),
|
||||
)
|
||||
} else {
|
||||
Icon(
|
||||
iconResId = iconResId,
|
||||
tint = iconTint,
|
||||
modifier = Modifier
|
||||
.size(size = iconSize)
|
||||
.align(alignment = Alignment.Top)
|
||||
.testTag(NotificationTestTags.ICON),
|
||||
)
|
||||
}
|
||||
|
||||
SpacerW(width = TangemTheme.dimens.spacing10)
|
||||
|
||||
|
|
@ -212,6 +227,30 @@ private fun Icon(@DrawableRes iconResId: Int, tint: Color?, modifier: Modifier =
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun UrlIcon(
|
||||
iconUrl: String,
|
||||
@DrawableRes fallbackIconResId: Int,
|
||||
fallbackIconTint: Color?,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
SubcomposeAsyncImage(
|
||||
model = iconUrl,
|
||||
contentDescription = null,
|
||||
modifier = modifier.clip(CircleShape),
|
||||
loading = {
|
||||
CircleShimmer(modifier = Modifier.matchParentSize())
|
||||
},
|
||||
error = {
|
||||
Icon(
|
||||
iconResId = fallbackIconResId,
|
||||
tint = fallbackIconTint,
|
||||
modifier = Modifier.matchParentSize(),
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun TextsBlock(
|
||||
title: TextReference?,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
*
|
||||
* @property subtitle subtitle
|
||||
* @property iconResId icon resource id
|
||||
* @property iconUrl icon URL for remote images
|
||||
* @property title title
|
||||
* @property backgroundResId background resource id
|
||||
* @property buttonsState buttons state
|
||||
|
|
@ -21,6 +22,7 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
data class NotificationConfig(
|
||||
val subtitle: TextReference,
|
||||
@DrawableRes val iconResId: Int,
|
||||
val iconUrl: String? = null,
|
||||
val title: TextReference? = null,
|
||||
@DrawableRes val backgroundResId: Int? = null,
|
||||
val buttonsState: ButtonsState? = null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue