Updated on 2026-08-14
This commit is contained in:
parent
304e8d7e2e
commit
4d331c622d
2 changed files with 10 additions and 27 deletions
|
|
@ -3,7 +3,9 @@ package com.tangem.core.ui.components.text
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import androidx.compose.animation.core.*
|
import androidx.compose.animation.core.*
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.State
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.geometry.Size
|
import androidx.compose.ui.geometry.Size
|
||||||
import androidx.compose.ui.graphics.*
|
import androidx.compose.ui.graphics.*
|
||||||
|
|
@ -38,22 +40,14 @@ fun rememberBladeAnimation(): BladeAnimation {
|
||||||
@Suppress("MagicNumber")
|
@Suppress("MagicNumber")
|
||||||
@Composable
|
@Composable
|
||||||
fun TextStyle.applyBladeBrush(isEnabled: Boolean, textColor: Color): TextStyle {
|
fun TextStyle.applyBladeBrush(isEnabled: Boolean, textColor: Color): TextStyle {
|
||||||
val offsetState = LocalBladeAnimation.current.offsetState
|
if (!isEnabled) return this.copy(color = textColor)
|
||||||
val offset = if (isEnabled) offsetState.value else 0f
|
|
||||||
|
|
||||||
val brush = remember(offset, textColor, isEnabled) {
|
val offsetState = LocalBladeAnimation.current.offsetState
|
||||||
|
val offset = offsetState.value
|
||||||
|
|
||||||
|
val brush = remember(offset, textColor) {
|
||||||
object : ShaderBrush() {
|
object : ShaderBrush() {
|
||||||
override fun createShader(size: Size): Shader {
|
override fun createShader(size: Size): Shader {
|
||||||
if (!isEnabled) {
|
|
||||||
// Solid color via the same shader path (LinearGradientShader needs >= 2 colors).
|
|
||||||
return LinearGradientShader(
|
|
||||||
colors = listOf(textColor, textColor),
|
|
||||||
from = Offset.Zero,
|
|
||||||
to = Offset(size.width, size.height),
|
|
||||||
tileMode = TileMode.Clamp,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
val center = Offset(size.width / 2f, size.height / 2f)
|
val center = Offset(size.width / 2f, size.height / 2f)
|
||||||
val diagonal = sqrt(size.width * size.width + size.height * size.height)
|
val diagonal = sqrt(size.width * size.width + size.height * size.height)
|
||||||
// Subtle diagonal angle, similar to iOS shimmer
|
// Subtle diagonal angle, similar to iOS shimmer
|
||||||
|
|
|
||||||
|
|
@ -190,23 +190,12 @@ internal class WalletTokenCurrencyItemConverter(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is CryptoCurrencyStatus.Loading -> TangemTokenRowUM.EndContentUM.Loading
|
is CryptoCurrencyStatus.Loading -> TangemTokenRowUM.EndContentUM.Loading
|
||||||
is CryptoCurrencyStatus.MissedDerivation -> TangemTokenRowUM.EndContentUM.Content(
|
is CryptoCurrencyStatus.MissedDerivation,
|
||||||
text = stringReference(StringsSigns.DASH_SIGN),
|
|
||||||
)
|
|
||||||
is CryptoCurrencyStatus.Unreachable,
|
is CryptoCurrencyStatus.Unreachable,
|
||||||
is CryptoCurrencyStatus.NoAmount,
|
is CryptoCurrencyStatus.NoAmount,
|
||||||
-> {
|
-> {
|
||||||
TangemTokenRowUM.EndContentUM.Content(
|
TangemTokenRowUM.EndContentUM.Content(
|
||||||
text = styledResourceReference(
|
text = stringReference(StringsSigns.DASH_SIGN),
|
||||||
id = R.string.common_unreachable,
|
|
||||||
spanStyleReference = { SpanStyle(color = TangemTheme.colors2.text.status.attention) },
|
|
||||||
),
|
|
||||||
endIcons = persistentListOf(
|
|
||||||
TangemIconUM.Icon(
|
|
||||||
iconRes = R.drawable.ic_attention_default_24,
|
|
||||||
tintReference = { TangemTheme.colors2.graphic.status.attention },
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue