Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-24 22:35:09 +04:00
commit ec06f2e51c
20 changed files with 260 additions and 101 deletions

View file

@ -93,7 +93,7 @@
},
{
"name": "TWI_1377_MANAGE_FUNDS",
"version": "5.40"
"version": "6.0"
},
{
"name": "AND_15009_SWAP_PROVIDER_FILTER_ENABLED",

View file

@ -10,7 +10,6 @@ import androidx.compose.material3.ButtonColors
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import com.tangem.core.ui.R
@ -190,7 +189,6 @@ fun PrimaryButtonIconStart(
enabled: Boolean = true,
tint: Color? = null,
size: TangemButtonSize = TangemButtonSize.Default,
shape: Shape = size.toShape(),
) {
TangemButton(
modifier = modifier,
@ -205,7 +203,6 @@ fun PrimaryButtonIconStart(
showProgress = showProgress,
textStyle = TangemTheme.typography.subtitle1,
size = size,
shape = shape,
)
}
// endregion PrimaryButton
@ -219,7 +216,6 @@ fun SecondaryButton(
showProgress: Boolean = false,
enabled: Boolean = true,
size: TangemButtonSize = TangemButtonSize.Default,
shape: Shape = size.toShape(),
) {
TangemButton(
modifier = modifier,
@ -230,7 +226,6 @@ fun SecondaryButton(
enabled = enabled,
showProgress = showProgress,
size = size,
shape = shape,
textStyle = TangemTheme.typography.subtitle1,
)
}
@ -248,7 +243,6 @@ fun SecondaryButtonIconEnd(
enabled: Boolean = true,
tint: Color? = null,
size: TangemButtonSize = TangemButtonSize.Default,
shape: Shape = size.toShape(),
) {
TangemButton(
modifier = modifier,
@ -263,7 +257,6 @@ fun SecondaryButtonIconEnd(
showProgress = showProgress,
textStyle = TangemTheme.typography.subtitle1,
size = size,
shape = shape,
)
}
@ -280,7 +273,6 @@ fun SecondaryButtonIconStart(
enabled: Boolean = true,
iconTint: Color? = null,
size: TangemButtonSize = TangemButtonSize.Default,
shape: Shape = size.toShape(),
) {
TangemButton(
modifier = modifier,
@ -295,7 +287,6 @@ fun SecondaryButtonIconStart(
showProgress = showProgress,
textStyle = TangemTheme.typography.subtitle1,
size = size,
shape = shape,
)
}
// endregion SecondaryButton

View file

@ -6,6 +6,7 @@ import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.TextAutoSize
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
@ -14,7 +15,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
@ -42,7 +42,6 @@ fun TangemButton(
size: TangemButtonSize = TangemButtonSize.Default,
elevation: ButtonElevation = TangemButtonsDefaults.elevation,
textStyle: TextStyle = TangemTheme.typography.button,
shape: Shape = size.toShape(),
iconPadding: Dp = size.toIconPadding(),
animateContentChange: Boolean = false,
) {
@ -57,7 +56,7 @@ fun TangemButton(
},
enabled = enabled,
elevation = elevation,
shape = shape,
shape = CircleShape,
colors = colors,
contentPadding = size.toContentPadding(icon = icon),
) {

View file

@ -3,7 +3,6 @@ package com.tangem.core.ui.components.buttons.common
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.res.TangemTheme
@ -32,19 +31,6 @@ internal fun TangemButtonSize.toHeightDp(): Dp = when (this) {
TangemButtonSize.Small -> 24.dp
}
@Composable
@ReadOnlyComposable
internal fun TangemButtonSize.toShape(): Shape = when (this) {
TangemButtonSize.Default -> TangemTheme.shapes.roundedCornersXMedium
TangemButtonSize.WideAction -> TangemTheme.shapes.roundedCornersMedium
TangemButtonSize.Text -> TangemTheme.shapes.roundedCornersSmall
TangemButtonSize.Selector -> TangemTheme.shapes.roundedCornersSmall
TangemButtonSize.Action -> TangemTheme.shapes.roundedCornersMedium
TangemButtonSize.TwoLines -> TangemTheme.shapes.roundedCornersXMedium
TangemButtonSize.RoundedAction -> TangemTheme.shapes.roundedCornersLarge
TangemButtonSize.Small -> TangemTheme.shapes.roundedCornersXMedium
}
@Composable
@ReadOnlyComposable
internal fun TangemButtonSize.toIconPadding(): Dp = when (this) {

View file

@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Surface
@ -43,7 +44,6 @@ import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalDensity
@ -104,7 +104,6 @@ internal fun TangemHoldToConfirmButton(
colors: ButtonColors = TangemButtonsDefaults.primaryButtonColors,
size: TangemButtonSize = TangemButtonSize.Default,
textStyle: TextStyle = TangemTheme.typography.button,
shape: Shape = size.toShape(),
) {
val coroutineScope = rememberCoroutineScope()
val state = rememberHoldToConfirmState()
@ -162,14 +161,14 @@ internal fun TangemHoldToConfirmButton(
onConfirm = onConfirm,
),
),
shape = shape,
shape = CircleShape,
color = containerColor,
) {
HoldToConfirmButtonContent(
modifier = Modifier
.fillMaxWidth()
.heightIn(min = buttonHeight)
.clip(shape),
.clip(CircleShape),
contentPadding = contentPadding,
state = state,
shouldShowProgress = shouldShowProgress,

View file

@ -6,7 +6,7 @@ import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.TextAutoSize
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.material3.CircularProgressIndicator
@ -229,19 +229,14 @@ private fun TangemButtonIcon(tangemIconUM: TangemIconUM?, isVisible: Boolean, si
/**
* Defines the shape of the Tangem button.
*/
@Deprecated("All buttons are rounded by design")
enum class TangemButtonShape {
Default,
Rounded,
;
@ReadOnlyComposable
@Composable
internal fun toShape(size: TangemButtonSize) = RoundedCornerShape(
when (this) {
Default -> size.toShapeRadius()
Rounded -> 100.dp
},
)
@Suppress("UnusedParameter")
internal fun toShape(size: TangemButtonSize) = CircleShape
}
/**
@ -309,18 +304,6 @@ enum class TangemButtonSize {
-> TangemTheme.dimens2.x7
}
@ReadOnlyComposable
@Composable
internal fun toShapeRadius() = when (this) {
X7,
X8,
X9,
X10,
-> TangemTheme.dimens2.x2
X12 -> TangemTheme.dimens2.x3
X15 -> TangemTheme.dimens2.x4
}
@ReadOnlyComposable
@Composable
internal fun toTextStyle(): TextStyle = when (this) {

View file

@ -14,7 +14,7 @@ import com.tangem.core.ui.extensions.TextReference
* @param isEnabled Boolean indicating whether the button is enabled.
* @param isLoading Boolean indicating whether the button is in a loading state.
* @param size TangemButtonSize defining the size of the button.
* @param shape TangemButtonShape defining the shape of the button.
* @param shape TangemButtonShape defining the shape of the button. UPD all buttons are rounded.
* @param type TangemButtonType defining the style type of the button.
* @param onClick Lambda to be invoked when the button is clicked.
* @param onLongClick Lambda to be invoked when the button is long-clicked.

View file

@ -18,6 +18,7 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
@ -256,7 +257,7 @@ private fun TangemMessageContent(
}
// The close button is drawn over the top-end corner, so in the leading-content layout the texts
// reserve trailing space to never run under it; trailing-content layouts are kept untouched
val isCloseSpaceReserved = hasCloseButton && leadingContent != null && content == null
val isCloseSpaceReserved = hasCloseButton && content == null
Row(
horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens2.x2),
modifier = Modifier.padding(TangemTheme.dimens2.x1),
@ -280,7 +281,8 @@ private fun TangemMessageContent(
text = title.resolveAnnotatedReference(),
style = TangemTheme.typography2.bodySemibold16,
color = TangemTheme.colors2.text.neutral.primary,
maxLines = 1,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
textAlign = textAlign,
modifier = Modifier.testTag(NotificationTestTags.TITLE),
)

View file

@ -96,16 +96,15 @@ fun TangemTopNavigation(
end = 16.dp,
),
content = {
// Each optional slot caches its last non-null content so the spring exit transition
// still has something to render after the caller flips it back to `null`.
val displayedStart = rememberLastNonNull(startButton)
AnimatedVisibility(
modifier = Modifier.layoutId(SlotId.Start),
visible = startButton != null,
enter = slotEnter,
exit = slotExit,
) {
displayedStart?.invoke()
Box(modifier = Modifier.layoutId(SlotId.Start)) {
AnimatedVisibility(
visible = startButton != null,
enter = slotEnter,
exit = slotExit,
) {
displayedStart?.invoke()
}
}
Column(
@ -121,30 +120,32 @@ fun TangemTopNavigation(
}
val displayedGroup = rememberLastNonNull(endButtonsGroup)
AnimatedVisibility(
modifier = Modifier.layoutId(SlotId.Group),
visible = endButtonsGroup != null,
enter = slotEnter,
exit = slotExit,
) {
displayedGroup?.let { group ->
TangemSurface(isMaterial = true, shape = CircleShape) {
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
content = group,
)
Box(modifier = Modifier.layoutId(SlotId.Group)) {
AnimatedVisibility(
visible = endButtonsGroup != null,
enter = slotEnter,
exit = slotExit,
) {
displayedGroup?.let { group ->
TangemSurface(isMaterial = true, shape = CircleShape) {
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
content = group,
)
}
}
}
}
val displayedEnd = rememberLastNonNull(endButton)
AnimatedVisibility(
modifier = Modifier.layoutId(SlotId.End),
visible = endButton != null,
enter = slotEnter,
exit = slotExit,
) {
displayedEnd?.invoke()
Box(modifier = Modifier.layoutId(SlotId.End)) {
AnimatedVisibility(
visible = endButton != null,
enter = slotEnter,
exit = slotExit,
) {
displayedEnd?.invoke()
}
}
},
) { measurables, constraints ->