Updated on 2026-08-14
BIN
core/ui/src/main/res/drawable-hdpi/img_tangem_pay_visa.webp
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
core/ui/src/main/res/drawable-xhdpi/img_tangem_pay_visa.webp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
core/ui/src/main/res/drawable-xxhdpi/img_tangem_pay_visa.webp
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
core/ui/src/main/res/drawable-xxxhdpi/img_tangem_pay_visa.webp
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
|
@ -2,6 +2,7 @@ package com.tangem.features.tangempay.ui
|
|||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.core.EaseInOut
|
||||
import androidx.compose.animation.core.FastOutSlowInEasing
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.Image
|
||||
|
|
@ -59,6 +60,7 @@ import com.tangem.features.tangempay.entity.TangemPayCardDetailsUM
|
|||
import com.tangem.features.tangempay.model.CardDataType
|
||||
|
||||
private const val TEXT_WIDTH_PADDING = 2
|
||||
private const val FREEZE_ANIMATION_DURATION_MS = 600
|
||||
private val CustomCardBlockColor = Color(0x1F828282)
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
|
|
@ -122,15 +124,7 @@ internal fun TangemPayCard(state: TangemPayCardDetailsUM, modifier: Modifier = M
|
|||
@Composable
|
||||
private fun TangemPayCardDetailsHiddenBlock(state: TangemPayCardDetailsUM, modifier: Modifier = Modifier) {
|
||||
Box(modifier = modifier.fillMaxSize()) {
|
||||
val imageResId = when (state.cardFrozenState) {
|
||||
TangemPayCardFrozenState.Frozen -> R.drawable.img_tangem_pay_visa_frozen
|
||||
else -> R.drawable.img_tangem_pay_visa
|
||||
}
|
||||
Image(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
painter = painterResource(id = imageResId),
|
||||
contentDescription = null,
|
||||
)
|
||||
TangemPayCardBackground(cardFrozenState = state.cardFrozenState)
|
||||
CardTopBlock()
|
||||
|
||||
if (state.isActionsAvailable) {
|
||||
|
|
@ -208,6 +202,37 @@ private fun TangemPayCardDetailsHiddenBlock(state: TangemPayCardDetailsUM, modif
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TangemPayCardBackground(cardFrozenState: TangemPayCardFrozenState, modifier: Modifier = Modifier) {
|
||||
val isFrozen = cardFrozenState == TangemPayCardFrozenState.Frozen
|
||||
val freezeProgress by animateFloatAsState(
|
||||
targetValue = if (isFrozen) 1f else 0f,
|
||||
animationSpec = tween(
|
||||
durationMillis = FREEZE_ANIMATION_DURATION_MS,
|
||||
easing = FastOutSlowInEasing,
|
||||
),
|
||||
label = "freezeProgress",
|
||||
)
|
||||
|
||||
Box(modifier = modifier.fillMaxSize()) {
|
||||
Image(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
painter = painterResource(R.drawable.img_tangem_pay_visa),
|
||||
contentDescription = null,
|
||||
)
|
||||
|
||||
if (isFrozen || freezeProgress > 0f) {
|
||||
Image(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.graphicsLayer { alpha = freezeProgress },
|
||||
painter = painterResource(R.drawable.img_tangem_pay_visa_frozen),
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CardTopBlock(modifier: Modifier = Modifier) {
|
||||
Row(
|
||||
|
|
|
|||
|
|
@ -139,7 +139,6 @@ private fun CardBackground(
|
|||
val w = size.width
|
||||
val h = size.height
|
||||
val radiusScaleRightCorner = h / 2f
|
||||
val radiusScaleLeftCorner = h / 1.27f
|
||||
|
||||
drawRect(
|
||||
brush = Brush.radialGradient(
|
||||
|
|
@ -151,24 +150,11 @@ private fun CardBackground(
|
|||
),
|
||||
Color.Transparent,
|
||||
),
|
||||
center = Offset(w - 20f, h * .05f),
|
||||
center = Offset(w / 2, h * .05f),
|
||||
radius = radiusScaleRightCorner,
|
||||
tileMode = TileMode.Clamp,
|
||||
),
|
||||
)
|
||||
|
||||
if (!isReissuing) {
|
||||
drawRect(
|
||||
brush = Brush.radialGradient(
|
||||
colors = listOf(
|
||||
Color(0xFF2881FF).copy(.25f),
|
||||
Color.Transparent,
|
||||
),
|
||||
center = Offset(0f, h + h * .1f),
|
||||
radius = radiusScaleLeftCorner,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
.border(
|
||||
width = 1.dp,
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 219 KiB |