Updated on 2026-08-14
This commit is contained in:
parent
69c0d69adb
commit
cb6c79e11b
8 changed files with 97 additions and 41 deletions
|
|
@ -297,6 +297,7 @@
|
|||
<string name="give_permission_unlimited">Безлимитно</string>
|
||||
<string name="home_button_order">Купить</string>
|
||||
<string name="home_button_scan">Сканировать</string>
|
||||
<string name="information_generated_with_ai">Информация сгенерирована ИИ</string>
|
||||
<string name="initial_message_change_access_code_body">Чтобы изменить код доступа, приложите карту как показано выше и не убирайте до окончания операции</string>
|
||||
<string name="initial_message_change_passcode_body">Чтобы изменить пароль, приложите карту как показано выше и не убирайте до окончания операции</string>
|
||||
<string name="initial_message_create_wallet_body">Чтобы создать кошелек, приложите карту как показано выше и не убирайте до окончания операции</string>
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@
|
|||
<string name="give_permission_unlimited">Unlimited</string>
|
||||
<string name="home_button_order">Order card</string>
|
||||
<string name="home_button_scan">Scan card</string>
|
||||
<string name="information_generated_with_ai">This information was generated with AI</string>
|
||||
<string name="initial_message_change_access_code_body">To change the access code tap the card as shown above and do not remove until the end of the operation</string>
|
||||
<string name="initial_message_change_passcode_body">To change the passcode tap the card as shown above and do not remove until the end of the operation</string>
|
||||
<string name="initial_message_create_wallet_body">To create the wallet tap the card as shown above and do not remove until the end of the operation</string>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import com.tangem.core.ui.components.*
|
|||
import com.tangem.core.ui.components.buttons.common.TangemButtonSize
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.components.notifications.NotificationConfig.ButtonsState as NotificationButtonsState
|
||||
|
|
@ -51,6 +52,7 @@ import com.tangem.core.ui.components.notifications.NotificationConfig.ButtonsSta
|
|||
fun Notification(
|
||||
config: NotificationConfig,
|
||||
modifier: Modifier = Modifier,
|
||||
subtitleColor: Color = TangemTheme.colors.text.tertiary,
|
||||
containerColor: Color? = null,
|
||||
iconTint: Color? = null,
|
||||
isEnabled: Boolean = true,
|
||||
|
|
@ -68,6 +70,7 @@ fun Notification(
|
|||
iconTint = iconTint,
|
||||
title = config.title,
|
||||
subtitle = config.subtitle,
|
||||
subtitleColor = subtitleColor,
|
||||
isClickableComponent = isEnabled && config.onClick != null,
|
||||
)
|
||||
}
|
||||
|
|
@ -94,7 +97,7 @@ internal fun NotificationBaseContainer(
|
|||
Surface(
|
||||
onClick = onClick ?: {},
|
||||
modifier = modifier
|
||||
.defaultMinSize(minHeight = TangemTheme.dimens.size62)
|
||||
.defaultMinSize(minHeight = TangemTheme.dimens.size44)
|
||||
.fillMaxWidth(),
|
||||
enabled = onClick != null && isEnabled,
|
||||
shape = TangemTheme.shapes.roundedCornersXMedium,
|
||||
|
|
@ -119,15 +122,17 @@ internal fun NotificationBaseContainer(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
@Composable
|
||||
private fun MainContent(
|
||||
iconResId: Int,
|
||||
iconTint: Color?,
|
||||
title: TextReference,
|
||||
title: TextReference?,
|
||||
subtitle: TextReference,
|
||||
subtitleColor: Color,
|
||||
isClickableComponent: Boolean,
|
||||
) {
|
||||
Row {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
iconResId = iconResId,
|
||||
tint = iconTint,
|
||||
|
|
@ -138,7 +143,7 @@ private fun MainContent(
|
|||
|
||||
SpacerW(width = TangemTheme.dimens.spacing10)
|
||||
|
||||
TextsBlock(title = title, subtitle = subtitle)
|
||||
TextsBlock(title = title, subtitle = subtitle, subtitleColor = subtitleColor)
|
||||
|
||||
if (isClickableComponent) {
|
||||
SpacerWMax()
|
||||
|
|
@ -174,17 +179,23 @@ private fun Icon(@DrawableRes iconResId: Int, tint: Color?, modifier: Modifier =
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun TextsBlock(title: TextReference, subtitle: TextReference) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing2)) {
|
||||
Text(
|
||||
text = title.resolveReference(),
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
style = TangemTheme.typography.button,
|
||||
)
|
||||
private fun TextsBlock(title: TextReference?, subtitle: TextReference, subtitleColor: Color) {
|
||||
Column {
|
||||
val titleText = title?.resolveReference()
|
||||
|
||||
if (titleText != null) {
|
||||
Text(
|
||||
text = titleText,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
style = TangemTheme.typography.button,
|
||||
)
|
||||
|
||||
SpacerH(height = TangemTheme.dimens.spacing2)
|
||||
}
|
||||
|
||||
Text(
|
||||
text = subtitle.resolveReference(),
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
color = subtitleColor,
|
||||
style = TangemTheme.typography.caption2,
|
||||
)
|
||||
}
|
||||
|
|
@ -363,5 +374,9 @@ private class NotificationConfigProvider : CollectionPreviewParameterProvider<No
|
|||
),
|
||||
onCloseClick = {},
|
||||
),
|
||||
NotificationConfig(
|
||||
subtitle = resourceReference(id = R.string.information_generated_with_ai),
|
||||
iconResId = R.drawable.ic_magic_28,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -6,9 +6,9 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
/**
|
||||
* Notification component state
|
||||
*
|
||||
* @property title title
|
||||
* @property subtitle subtitle
|
||||
* @property iconResId icon resource id
|
||||
* @property title title
|
||||
* @property backgroundResId background resource id
|
||||
* @property buttonsState buttons state
|
||||
* @property onClick lambda be invoked when notification is clicked
|
||||
|
|
@ -17,9 +17,9 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
data class NotificationConfig(
|
||||
val title: TextReference,
|
||||
val subtitle: TextReference,
|
||||
@DrawableRes val iconResId: Int,
|
||||
val title: TextReference? = null,
|
||||
@DrawableRes val backgroundResId: Int? = null,
|
||||
val buttonsState: ButtonsState? = null,
|
||||
val onClick: (() -> Unit)? = null,
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
|
|||
import androidx.compose.foundation.layout.defaultMinSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.ripple.rememberRipple
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -33,8 +33,8 @@ import com.tangem.core.ui.extensions.wrappedList
|
|||
import com.tangem.core.ui.res.LocalIsInDarkTheme
|
||||
import com.tangem.core.ui.res.TangemColorPalette.Dark6
|
||||
import com.tangem.core.ui.res.TangemColorPalette.Light4
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
/**
|
||||
* Custom notification with image background
|
||||
|
|
@ -85,17 +85,22 @@ fun NotificationWithBackground(config: NotificationConfig, modifier: Modifier =
|
|||
linkTo(titleRef.top, subtitleRef.bottom, bias = 0.1f)
|
||||
},
|
||||
)
|
||||
Text(
|
||||
text = config.title.resolveReference(),
|
||||
style = TangemTheme.typography.button,
|
||||
color = TangemTheme.colors.text.constantWhite,
|
||||
modifier = Modifier.constrainAs(titleRef) {
|
||||
top.linkTo(parent.top, spacing12)
|
||||
start.linkTo(iconRef.end, spacing12)
|
||||
end.linkTo(closeIconRef.start, spacing2)
|
||||
width = Dimension.fillToConstraints
|
||||
},
|
||||
)
|
||||
|
||||
val titleText = config.title?.resolveReference()
|
||||
if (titleText != null) {
|
||||
Text(
|
||||
text = titleText,
|
||||
style = TangemTheme.typography.button,
|
||||
color = TangemTheme.colors.text.constantWhite,
|
||||
modifier = Modifier.constrainAs(titleRef) {
|
||||
top.linkTo(parent.top, spacing12)
|
||||
start.linkTo(iconRef.end, spacing12)
|
||||
end.linkTo(closeIconRef.start, spacing2)
|
||||
width = Dimension.fillToConstraints
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Text(
|
||||
text = config.subtitle.resolveReference(),
|
||||
style = TangemTheme.typography.caption2,
|
||||
|
|
|
|||
|
|
@ -63,11 +63,16 @@ private fun Content(config: NotificationConfig) {
|
|||
.weight(1f)
|
||||
.padding(TangemTheme.dimens.spacing12),
|
||||
) {
|
||||
Text(
|
||||
text = config.title.resolveReference(),
|
||||
style = TangemTheme.typography.button,
|
||||
color = OxkPromoColor,
|
||||
)
|
||||
val titleText = config.title?.resolveReference()
|
||||
|
||||
if (titleText != null) {
|
||||
Text(
|
||||
text = titleText,
|
||||
style = TangemTheme.typography.button,
|
||||
color = OxkPromoColor,
|
||||
)
|
||||
}
|
||||
|
||||
Text(
|
||||
text = config.subtitle.resolveReference(),
|
||||
style = TangemTheme.typography.caption2,
|
||||
|
|
|
|||
9
core/ui/src/main/res/drawable/ic_magic_28.xml
Normal file
9
core/ui/src/main/res/drawable/ic_magic_28.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28"
|
||||
android:viewportHeight="28">
|
||||
<path
|
||||
android:pathData="M13.364,6.647C13.217,6.647 13.137,6.557 13.115,6.422C12.774,4.599 12.808,4.509 10.833,4.16C10.685,4.126 10.606,4.047 10.606,3.901C10.606,3.766 10.685,3.676 10.833,3.653C12.808,3.305 12.774,3.215 13.115,1.392C13.137,1.257 13.217,1.167 13.364,1.167C13.512,1.167 13.591,1.257 13.614,1.392C13.955,3.215 13.92,3.305 15.896,3.653C16.032,3.676 16.123,3.766 16.123,3.901C16.123,4.047 16.032,4.126 15.896,4.16C13.92,4.509 13.955,4.599 13.614,6.422C13.591,6.557 13.512,6.647 13.364,6.647ZM7.87,14.388C7.666,14.388 7.518,14.242 7.484,14.017C7.121,11.012 6.974,10.934 3.886,10.439C3.648,10.405 3.5,10.281 3.5,10.056C3.5,9.854 3.648,9.718 3.841,9.685C6.951,9.1 7.121,9.111 7.484,6.106C7.518,5.881 7.666,5.735 7.87,5.735C8.086,5.735 8.234,5.881 8.256,6.095C8.654,9.145 8.767,9.246 11.9,9.685C12.093,9.707 12.241,9.854 12.241,10.056C12.241,10.27 12.093,10.405 11.9,10.439C8.767,11.035 8.665,11.035 8.256,14.039C8.234,14.242 8.086,14.388 7.87,14.388ZM15.566,26.833C15.271,26.833 15.056,26.619 15.01,26.316C14.159,20.161 13.308,19.339 7.178,18.54C6.849,18.507 6.633,18.281 6.633,17.978C6.633,17.685 6.849,17.46 7.178,17.426C13.319,16.751 14.204,15.806 15.01,9.64C15.056,9.336 15.271,9.133 15.566,9.133C15.862,9.133 16.077,9.336 16.134,9.64C16.94,15.806 17.814,16.751 23.966,17.426C24.284,17.46 24.5,17.685 24.5,17.978C24.5,18.281 24.284,18.507 23.966,18.54C17.814,19.215 16.94,20.161 16.134,26.316C16.077,26.619 15.862,26.833 15.566,26.833Z"
|
||||
android:fillColor="#000000" />
|
||||
</vector>
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
package com.tangem.features.markets.details.impl.ui.components
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
@ -13,9 +10,13 @@ import com.tangem.core.ui.components.SpacerH
|
|||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheet
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetTitle
|
||||
import com.tangem.core.ui.components.notifications.Notification
|
||||
import com.tangem.core.ui.components.notifications.NotificationConfig
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.features.markets.details.impl.ui.state.InfoBottomSheetContent
|
||||
import com.tangem.features.markets.impl.R
|
||||
import dev.jeziellago.compose.markdowntext.MarkdownText
|
||||
|
||||
@Composable
|
||||
|
|
@ -26,14 +27,12 @@ internal fun InfoBottomSheet(config: TangemBottomSheetConfig) {
|
|||
config = config,
|
||||
skipPartiallyExpanded = false,
|
||||
addBottomInsets = false,
|
||||
title = {
|
||||
TangemBottomSheetTitle(title = it.title)
|
||||
},
|
||||
title = { TangemBottomSheetTitle(title = it.title) },
|
||||
content = {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(horizontal = TangemTheme.dimens.spacing28),
|
||||
.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
) {
|
||||
MarkdownText(
|
||||
markdown = it.body.resolveReference(),
|
||||
|
|
@ -44,8 +43,29 @@ internal fun InfoBottomSheet(config: TangemBottomSheetConfig) {
|
|||
color = TangemTheme.colors.text.secondary,
|
||||
),
|
||||
)
|
||||
|
||||
AdditionalInfoNotification(
|
||||
modifier = Modifier
|
||||
.padding(top = TangemTheme.dimens.spacing12, bottom = TangemTheme.dimens.spacing16)
|
||||
.fillMaxWidth(),
|
||||
)
|
||||
|
||||
SpacerH(bottomBarHeight)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AdditionalInfoNotification(modifier: Modifier = Modifier) {
|
||||
Notification(
|
||||
config = NotificationConfig(
|
||||
subtitle = TextReference.Res(id = R.string.information_generated_with_ai),
|
||||
iconResId = R.drawable.ic_magic_28,
|
||||
),
|
||||
modifier = modifier,
|
||||
subtitleColor = TangemTheme.colors.text.primary1,
|
||||
containerColor = TangemTheme.colors.button.disabled,
|
||||
iconTint = TangemTheme.colors.icon.accent,
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue