Updated on 2026-08-14

This commit is contained in:
Tangem 2023-09-11 16:57:06 +04:00
parent 42e2ed6309
commit e817699522
17 changed files with 103 additions and 97 deletions

View file

@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
@ -134,8 +133,8 @@ internal fun DetailsRadioButtonElement(title: String, subtitle: String, selected
onClick = null,
modifier = Modifier.padding(end = 20.dp),
colors = RadioButtonDefaults.colors(
unselectedColor = colorResource(id = R.color.icon_secondary),
selectedColor = colorResource(id = R.color.icon_accent),
unselectedColor = TangemTheme.colors.icon.secondary,
selectedColor = TangemTheme.colors.icon.accent,
),
)
@ -143,13 +142,13 @@ internal fun DetailsRadioButtonElement(title: String, subtitle: String, selected
Text(
text = title,
style = TangemTheme.typography.subtitle1,
color = colorResource(id = R.color.text_primary_1),
color = TangemTheme.colors.text.primary1,
)
Spacer(modifier = Modifier.size(4.dp))
Text(
text = subtitle,
style = TangemTheme.typography.body2,
color = colorResource(id = R.color.text_secondary),
color = TangemTheme.colors.text.secondary,
)
}
}

View file

@ -1,22 +1,12 @@
package com.tangem.tap.features.details.ui.common
import androidx.compose.animation.animateColor
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.animateDp
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.animation.core.*
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.indication
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable
@ -25,17 +15,16 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.tangem.wallet.R
import com.tangem.core.ui.res.TangemTheme
@Suppress("MagicNumber")
@Composable
fun TangemSwitch(
onCheckedChange: (Boolean) -> Unit,
checkedColor: Color = colorResource(id = R.color.control_checked),
uncheckedColor: Color = colorResource(id = R.color.icon_informative),
checkedColor: Color = TangemTheme.colors.icon.accent,
uncheckedColor: Color = TangemTheme.colors.icon.informative,
size: Dp = 48.dp,
checked: Boolean = false,
enabled: Boolean = true,

View file

@ -1,12 +1,17 @@
package com.tangem.tap.features.details.ui.resetcard
import androidx.compose.foundation.*
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Icon
import androidx.compose.material.IconToggleButton
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
@ -37,15 +42,19 @@ private fun ResetCardView(state: ResetCardScreenState) {
.verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.SpaceBetween,
) {
Box {
Image(
painter = painterResource(id = R.drawable.ill_reset_background),
contentDescription = null,
modifier = Modifier.offset(y = (-82).dp),
ScreenTitle(titleRes = R.string.card_settings_reset_card_to_factory)
Box(
modifier = Modifier
.weight(1f)
.padding(horizontal = 21.dp),
contentAlignment = Alignment.CenterStart,
) {
Icon(
painter = painterResource(id = R.drawable.img_alert),
contentDescription = "",
tint = Color.Unspecified,
)
ScreenTitle(titleRes = R.string.card_settings_reset_card_to_factory)
}
Spacer(modifier = Modifier.weight(1f))
Column(
modifier = Modifier.offset(y = (-32).dp),
verticalArrangement = Arrangement.Bottom,

View file

@ -12,7 +12,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
@ -61,8 +60,8 @@ internal fun WalletConnectScreen(
private fun AddSessionFab(onAddSession: () -> Unit, modifier: Modifier = Modifier) {
FloatingActionButton(
onClick = onAddSession,
backgroundColor = colorResource(id = R.color.button_primary),
contentColor = colorResource(id = R.color.icon_primary_2),
backgroundColor = TangemTheme.colors.button.primary,
contentColor = TangemTheme.colors.icon.primary2,
shape = RoundedCornerShape(16.dp),
modifier = modifier,
) {
@ -78,7 +77,7 @@ private fun EmptyScreen(state: WalletConnectScreenState) {
if (state.isLoading) {
LinearProgressIndicator(
modifier = Modifier.fillMaxWidth(),
color = colorResource(id = R.color.icon_accent),
color = TangemTheme.colors.icon.accent,
)
}
Column(
@ -91,7 +90,7 @@ private fun EmptyScreen(state: WalletConnectScreenState) {
Image(
painter = painterResource(id = R.drawable.ic_walletconnect),
contentDescription = "",
colorFilter = ColorFilter.tint(colorResource(id = R.color.icon_inactive)),
colorFilter = ColorFilter.tint(TangemTheme.colors.icon.inactive),
contentScale = ContentScale.FillWidth,
modifier = Modifier.width(width = 100.dp),
)
@ -99,7 +98,7 @@ private fun EmptyScreen(state: WalletConnectScreenState) {
Text(
text = stringResource(id = R.string.wallet_connect_subtitle),
style = TangemTheme.typography.body2,
color = colorResource(id = R.color.text_tertiary),
color = TangemTheme.colors.text.tertiary,
)
}
}
@ -111,7 +110,7 @@ private fun WalletConnectSessions(state: WalletConnectScreenState) {
modifier = Modifier
.fillMaxWidth()
.height(2.dp),
color = colorResource(id = R.color.icon_accent),
color = TangemTheme.colors.icon.accent,
)
} else {
Spacer(modifier = Modifier.height(2.dp))
@ -132,7 +131,7 @@ private fun WalletConnectSessions(state: WalletConnectScreenState) {
Text(
text = session.description,
style = TangemTheme.typography.subtitle1,
color = colorResource(id = R.color.text_primary_1),
color = TangemTheme.colors.text.primary1,
modifier = Modifier.weight(1f),
)
IconButton(
@ -144,7 +143,7 @@ private fun WalletConnectSessions(state: WalletConnectScreenState) {
Icon(
painter = painterResource(id = R.drawable.ic_cross_rounded_24),
contentDescription = "",
tint = colorResource(id = R.color.icon_warning),
tint = TangemTheme.colors.icon.warning,
)
}
}

View file

@ -122,6 +122,7 @@ class DisclaimerFragment : BaseFragment(R.layout.fragment_disclaimer), StoreSubs
webView.loadLocalTermsOfServices()
}
else -> {
webView.setBackgroundColor(resources.getColor(R.color.transparent, null))
webView.loadUrl(disclaimer.getUri().toString())
}
}

View file

@ -1,5 +1,7 @@
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#007AFF" android:pathData="M4.915,7.735C8.827,4.088 15.173,4.088 19.085,7.735L19.555,8.171C19.753,8.353 19.753,8.648 19.555,8.831L17.946,10.333C17.847,10.421 17.692,10.421 17.593,10.333L16.943,9.726C14.213,7.181 9.787,7.181 7.057,9.726L6.364,10.374C6.265,10.462 6.11,10.462 6.011,10.374L4.395,8.878C4.197,8.695 4.197,8.401 4.395,8.218L4.915,7.735ZM22.415,10.84L23.851,12.177C24.049,12.359 24.049,12.654 23.851,12.837L17.382,18.863C17.184,19.046 16.869,19.046 16.677,18.863L12.09,14.586C12.04,14.539 11.96,14.539 11.91,14.586L7.323,18.863C7.125,19.046 6.809,19.046 6.617,18.863L0.149,12.837C-0.05,12.654 -0.05,12.359 0.149,12.177L1.585,10.84C1.783,10.657 2.099,10.657 2.29,10.84L6.877,15.116C6.927,15.163 7.007,15.163 7.057,15.116L11.644,10.84C11.842,10.657 12.158,10.657 12.35,10.84L16.937,15.116C16.986,15.163 17.067,15.163 17.116,15.116L21.703,10.84C21.902,10.657 22.217,10.657 22.415,10.84Z"/>
<path
android:fillColor="@color/accent"
android:pathData="M4.915,7.735C8.827,4.088 15.173,4.088 19.085,7.735L19.555,8.171C19.753,8.353 19.753,8.648 19.555,8.831L17.946,10.333C17.847,10.421 17.692,10.421 17.593,10.333L16.943,9.726C14.213,7.181 9.787,7.181 7.057,9.726L6.364,10.374C6.265,10.462 6.11,10.462 6.011,10.374L4.395,8.878C4.197,8.695 4.197,8.401 4.395,8.218L4.915,7.735ZM22.415,10.84L23.851,12.177C24.049,12.359 24.049,12.654 23.851,12.837L17.382,18.863C17.184,19.046 16.869,19.046 16.677,18.863L12.09,14.586C12.04,14.539 11.96,14.539 11.91,14.586L7.323,18.863C7.125,19.046 6.809,19.046 6.617,18.863L0.149,12.837C-0.05,12.654 -0.05,12.359 0.149,12.177L1.585,10.84C1.783,10.657 2.099,10.657 2.29,10.84L6.877,15.116C6.927,15.163 7.007,15.163 7.057,15.116L11.644,10.84C11.842,10.657 12.158,10.657 12.35,10.84L16.937,15.116C16.986,15.163 17.067,15.163 17.116,15.116L21.703,10.84C21.902,10.657 22.217,10.657 22.415,10.84Z" />
</vector>

View file

@ -1,24 +0,0 @@
<vector android:autoMirrored="true" android:height="344dp"
android:viewportHeight="344" android:viewportWidth="233"
android:width="233dp" xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.3" android:pathData="M49,-262L49,-262A184,184 0,0 1,233 -78L233,160A184,184 0,0 1,49 344L49,344A184,184 0,0 1,-135 160L-135,-78A184,184 0,0 1,49 -262z">
<aapt:attr name="android:fillColor">
<gradient android:centerX="149.32" android:centerY="383.08"
android:gradientRadius="337.25" android:type="radial">
<item android:color="#FFFF9900" android:offset="0"/>
<item android:color="#00FF9900" android:offset="1"/>
</gradient>
</aapt:attr>
</path>
<path android:fillAlpha="0.5" android:pathData="M49,-182L49,-182A150,150 0,0 1,199 -32L199,160A150,150 0,0 1,49 310L49,310A150,150 0,0 1,-101 160L-101,-32A150,150 0,0 1,49 -182z">
<aapt:attr name="android:fillColor">
<gradient android:centerX="73" android:centerY="498"
android:gradientRadius="371.06" android:type="radial">
<item android:color="#FFDA1717" android:offset="0"/>
<item android:color="#03DA1717" android:offset="1"/>
<item android:color="#00FF0000" android:offset="1"/>
</gradient>
</aapt:attr>
</path>
<path android:fillColor="#DE1010" android:fillType="evenOdd" android:pathData="M72.88,249.79C72.88,253.27 70.53,255.96 66.66,255.96H31.34C27.47,255.96 25.12,253.27 25.12,249.79C25.12,248.71 25.39,247.62 26.01,246.6L43.69,215.79C44.85,213.71 46.9,212.67 49,212.67C51.1,212.67 53.12,213.71 54.31,215.79L71.99,246.6C72.56,247.6 72.88,248.71 72.88,249.79ZM49.02,240.74C47.84,240.74 47.18,240.06 47.15,238.85L46.86,226.45C46.84,225.24 47.72,224.38 49,224.38C50.23,224.38 51.19,225.27 51.16,226.48L50.82,238.85C50.8,240.08 50.14,240.74 49.02,240.74ZM49.02,248.37C47.66,248.37 46.47,247.28 46.47,245.93C46.47,244.57 47.63,243.47 49.02,243.47C50.39,243.47 51.55,244.54 51.55,245.93C51.55,247.3 50.37,248.37 49.02,248.37Z"/>
</vector>

View file

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="80dp"
android:height="80dp"
android:autoMirrored="true"
android:viewportWidth="80"
android:viewportHeight="80">
<group>
<clip-path android:pathData="M0,0h80v80h-80z" />
<path
android:fillAlpha="0.12"
android:fillColor="@color/icon_warning"
android:fillType="evenOdd"
android:pathData="M40,80C62.091,80 80,62.091 80,40C80,17.909 62.091,0 40,0C17.909,0 0,17.909 0,40C0,62.091 17.909,80 40,80ZM40,70C56.569,70 70,56.569 70,40C70,23.431 56.569,10 40,10C23.431,10 10,23.431 10,40C10,56.569 23.431,70 40,70Z"
android:strokeAlpha="0.12" />
<path
android:fillColor="@color/icon_warning"
android:pathData="M36.667,50H43.333V56.667H36.667V50ZM36.667,23.333H43.333V43.333H36.667V23.333ZM40,6.667C21.567,6.667 6.667,21.667 6.667,40C6.667,48.84 10.179,57.319 16.43,63.57C19.525,66.665 23.2,69.121 27.244,70.796C31.288,72.471 35.623,73.333 40,73.333C48.841,73.333 57.319,69.821 63.57,63.57C69.822,57.319 73.333,48.84 73.333,40C73.333,35.623 72.471,31.288 70.796,27.244C69.121,23.2 66.666,19.525 63.57,16.43C60.475,13.334 56.8,10.879 52.756,9.204C48.712,7.529 44.377,6.667 40,6.667ZM40,66.667C32.928,66.667 26.145,63.857 21.144,58.856C16.143,53.855 13.333,47.072 13.333,40C13.333,32.928 16.143,26.145 21.144,21.144C26.145,16.143 32.928,13.333 40,13.333C47.072,13.333 53.855,16.143 58.856,21.144C63.857,26.145 66.667,32.928 66.667,40C66.667,47.072 63.857,53.855 58.856,58.856C53.855,63.857 47.072,66.667 40,66.667Z" />
</group>
</vector>

View file

@ -21,6 +21,8 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_baseline_arrow_back_24"
app:navigationIconTint="@color/icon_primary_1"
app:titleTextColor="@color/text_primary_1"
app:title="@string/disclaimer_title" />
</com.google.android.material.appbar.AppBarLayout>
@ -29,7 +31,7 @@
android:id="@+id/cl_details_confirm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:background="@color/background_secondary"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView

View file

@ -79,6 +79,5 @@
<color name="text_tertiary">#919191</color>
<color name="background_splash">#000000</color>
<color name="transparent">#00000000</color>
</resources>

View file

@ -1,6 +1,6 @@
<resources>
<style name="BaseAppTheme" parent="Theme.MaterialComponents.Light.NoActionBar" />
<style name="BaseAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar" />
<style name="AppTheme" parent="BaseAppTheme">
<item name="colorPrimary">@color/menu_accent_color</item>

View file

@ -4,6 +4,7 @@ import androidx.compose.material.Colors
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import com.tangem.core.ui.res.TangemColorPalette.Amaranth
import com.tangem.core.ui.res.TangemColorPalette.Azure
import com.tangem.core.ui.res.TangemColorPalette.Black
import com.tangem.core.ui.res.TangemColorPalette.Dark1
import com.tangem.core.ui.res.TangemColorPalette.Dark2
@ -11,7 +12,6 @@ import com.tangem.core.ui.res.TangemColorPalette.Dark4
import com.tangem.core.ui.res.TangemColorPalette.Dark6
import com.tangem.core.ui.res.TangemColorPalette.Light4
import com.tangem.core.ui.res.TangemColorPalette.Light5
import com.tangem.core.ui.res.TangemColorPalette.Meadow
import com.tangem.core.ui.res.TangemColorPalette.Tangerine
import com.tangem.core.ui.res.TangemColorPalette.White
@ -22,7 +22,7 @@ enum class IconColorType(val lightColor: Color, val darkColor: Color) {
SECONDARY(lightColor = Dark2, darkColor = Dark1),
INFORMATIVE(lightColor = Light5, darkColor = Dark2),
INACTIVE(lightColor = Light4, darkColor = Dark4),
ACCENT(lightColor = Meadow, darkColor = Meadow),
ACCENT(lightColor = Azure, darkColor = Azure),
WARNING(lightColor = Amaranth, darkColor = Amaranth),
ATTENTION(lightColor = Tangerine, darkColor = Tangerine),
}

View file

@ -33,16 +33,16 @@ object TangemColorPalette {
// endregion Green
// region Blue
val Cobalt = Color(0xFF0029FF)
val Azure = Color(0xFF007AFF)
val Azure = Color(0xFF0099FF)
// endregion Blue
// region Red
val Amaranth = Color(0xFFDE1010)
val Flamingo = Color(0xFFED7979)
val Amaranth = Color(0xFFFF3333)
val Flamingo = Color(0xFFFF5B5B)
// endregion Red
// region Yellow
val Tangerine = Color(0xFFFFB71B)
val Mustard = Color(0xFFFDDE55)
// endregion Yellow
}

View file

@ -39,9 +39,9 @@ class TangemColors internal constructor(
secondary: Color,
tertiary: Color,
disabled: Color,
accent: Color = TangemColorPalette.Meadow,
warning: Color = TangemColorPalette.Amaranth,
attention: Color = TangemColorPalette.Tangerine,
warning: Color,
attention: Color,
accent: Color = TangemColorPalette.Azure,
constantWhite: Color = TangemColorPalette.White,
) {
var primary1 by mutableStateOf(primary1)
@ -80,9 +80,9 @@ class TangemColors internal constructor(
secondary: Color,
informative: Color,
inactive: Color,
accent: Color = TangemColorPalette.Meadow,
warning: Color = TangemColorPalette.Amaranth,
attention: Color = TangemColorPalette.Tangerine,
warning: Color,
attention: Color,
accent: Color = TangemColorPalette.Azure,
) {
var primary1 by mutableStateOf(primary1)
private set

View file

@ -98,6 +98,8 @@ private fun lightThemeColors(): TangemColors {
secondary = TangemColorPalette.Dark2,
tertiary = TangemColorPalette.Dark1,
disabled = TangemColorPalette.Light4,
warning = TangemColorPalette.Amaranth,
attention = TangemColorPalette.Tangerine,
),
icon = TangemColors.Icon(
primary1 = TangemColorPalette.Black,
@ -105,6 +107,8 @@ private fun lightThemeColors(): TangemColors {
secondary = TangemColorPalette.Dark2,
informative = TangemColorPalette.Light5,
inactive = TangemColorPalette.Light4,
warning = TangemColorPalette.Amaranth,
attention = TangemColorPalette.Tangerine,
),
button = TangemColors.Button(
primary = TangemColorPalette.Dark6,
@ -146,6 +150,8 @@ private fun darkThemeColors(): TangemColors {
secondary = TangemColorPalette.Light5,
tertiary = TangemColorPalette.Dark1,
disabled = TangemColorPalette.Dark3,
warning = TangemColorPalette.Flamingo,
attention = TangemColorPalette.Mustard,
),
icon = TangemColors.Icon(
primary1 = TangemColorPalette.White,
@ -153,6 +159,8 @@ private fun darkThemeColors(): TangemColors {
secondary = TangemColorPalette.Dark1,
informative = TangemColorPalette.Dark2,
inactive = TangemColorPalette.Dark4,
warning = TangemColorPalette.Flamingo,
attention = TangemColorPalette.Mustard,
),
button = TangemColors.Button(
primary = TangemColorPalette.Light1,

View file

@ -32,6 +32,7 @@ dependencies {
/** Other libraries */
implementation(deps.compose.shimmer)
implementation(deps.compose.accompanist.webView)
implementation(deps.compose.accompanist.systemUiController)
/** DI */
implementation(deps.hilt.android)

View file

@ -1,25 +1,29 @@
package com.tangem.feature.referral
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.transition.TransitionInflater
import com.tangem.core.ui.components.SystemBarsEffect
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.screen.ComposeFragment
import com.tangem.core.ui.theme.AppThemeModeHolder
import com.tangem.feature.referral.presentation.R
import com.tangem.feature.referral.router.ReferralRouter
import com.tangem.feature.referral.ui.ReferralScreen
import com.tangem.feature.referral.viewmodels.ReferralViewModel
import dagger.hilt.android.AndroidEntryPoint
import java.lang.ref.WeakReference
import javax.inject.Inject
@AndroidEntryPoint
class ReferralFragment : Fragment() {
class ReferralFragment : ComposeFragment() {
@Inject
override lateinit var appThemeModeHolder: AppThemeModeHolder
private val viewModel by viewModels<ReferralViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
@ -29,19 +33,17 @@ class ReferralFragment : Fragment() {
exitTransition = inflater.inflateTransition(R.transition.fade)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
@Composable
override fun ScreenContent(modifier: Modifier) {
viewModel.setRouter(ReferralRouter(fragmentManager = WeakReference(parentFragmentManager)))
viewModel.onScreenOpened()
return ComposeView(inflater.context).apply {
isTransitionGroup = true
setContent {
TangemTheme {
ReferralScreen(
modifier = Modifier.systemBarsPadding(),
stateHolder = viewModel.uiState,
)
}
}
}
val backgroundColor = TangemTheme.colors.background.secondary
SystemBarsEffect { setSystemBarsColor(backgroundColor) }
ReferralScreen(
modifier = Modifier.systemBarsPadding(),
stateHolder = viewModel.uiState,
)
}
}