Updated on 2026-08-14
This commit is contained in:
parent
955719a33b
commit
806bf97028
2 changed files with 95 additions and 67 deletions
|
|
@ -5,20 +5,24 @@ import androidx.compose.foundation.background
|
|||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.defaultMinSize
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
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.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.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.layout
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
|
@ -58,80 +62,99 @@ fun ResetCardView(
|
|||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Bottom,
|
||||
verticalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier,
|
||||
modifier = modifier
|
||||
.padding(bottom = 20.dp),
|
||||
) {
|
||||
ScreenTitle(titleRes = R.string.reset_card_to_factory_navigation_title)
|
||||
}
|
||||
Spacer(
|
||||
|
||||
Column(
|
||||
modifier = modifier
|
||||
.defaultMinSize(20.dp)
|
||||
.weight(1f),
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.common_attention),
|
||||
modifier = modifier.padding(start = 20.dp, end = 20.dp),
|
||||
style = TangemTypography.headline3,
|
||||
color = colorResource(id = R.color.text_primary_1),
|
||||
)
|
||||
|
||||
Spacer(modifier = modifier.size(24.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(id = R.string.reset_card_to_factory_message),
|
||||
modifier = modifier.padding(start = 20.dp, end = 20.dp),
|
||||
style = TangemTypography.body1,
|
||||
color = colorResource(id = R.color.text_secondary),
|
||||
)
|
||||
|
||||
Spacer(modifier = modifier.size(44.dp))
|
||||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(end = 20.dp),
|
||||
.layout { measurable, constraints ->
|
||||
val placeable =
|
||||
measurable.measure(
|
||||
constraints.copy(
|
||||
// left 200.dp for min image height
|
||||
maxHeight = constraints.maxHeight - 215.dp.roundToPx(),
|
||||
// occupy all height except full image square in case of smaller text
|
||||
minHeight = constraints.maxHeight - constraints.maxWidth,
|
||||
),
|
||||
)
|
||||
layout(placeable.width, placeable.height) {
|
||||
placeable.place(0, 0)
|
||||
}
|
||||
}
|
||||
.height(IntrinsicSize.Min),
|
||||
verticalArrangement = Arrangement.Bottom,
|
||||
) {
|
||||
IconToggleButton(
|
||||
checked = state.accepted,
|
||||
onCheckedChange = state.onAcceptWarningToggleClick,
|
||||
modifier = modifier.padding(start = 20.dp, end = 20.dp),
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(
|
||||
if (state.accepted) {
|
||||
R.drawable.ic_accepted
|
||||
} else {
|
||||
R.drawable.ic_unticked
|
||||
},
|
||||
),
|
||||
contentDescription = null,
|
||||
tint = if (state.accepted) {
|
||||
colorResource(id = R.color.icon_accent)
|
||||
} else {
|
||||
colorResource(id = R.color.icon_secondary)
|
||||
},
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(id = R.string.reset_card_to_factory_warning_message),
|
||||
style = TangemTypography.body2,
|
||||
text = stringResource(id = R.string.common_attention),
|
||||
modifier = modifier.padding(start = 20.dp, end = 20.dp),
|
||||
style = TangemTypography.headline3,
|
||||
color = colorResource(id = R.color.text_primary_1),
|
||||
)
|
||||
|
||||
Spacer(modifier = modifier.size(24.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(id = R.string.reset_card_to_factory_message),
|
||||
modifier = modifier
|
||||
.padding(start = 20.dp, end = 20.dp)
|
||||
.weight(1f, false)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
style = TangemTypography.body1,
|
||||
color = colorResource(id = R.color.text_secondary),
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = modifier.size(32.dp))
|
||||
Box(
|
||||
modifier = modifier
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 32.dp),
|
||||
) {
|
||||
DetailsMainButton(
|
||||
title = stringResource(id = R.string.reset_card_to_factory_button_title),
|
||||
onClick = state.onResetButtonClick,
|
||||
enabled = state.resetButtonEnabled,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = modifier.size(44.dp))
|
||||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(end = 20.dp),
|
||||
) {
|
||||
IconToggleButton(
|
||||
checked = state.accepted,
|
||||
onCheckedChange = state.onAcceptWarningToggleClick,
|
||||
modifier = modifier.padding(start = 20.dp, end = 20.dp),
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(
|
||||
if (state.accepted) {
|
||||
R.drawable.ic_accepted
|
||||
} else {
|
||||
R.drawable.ic_unticked
|
||||
},
|
||||
),
|
||||
contentDescription = null,
|
||||
tint = if (state.accepted) {
|
||||
colorResource(id = R.color.icon_accent)
|
||||
} else {
|
||||
colorResource(id = R.color.icon_secondary)
|
||||
},
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(id = R.string.reset_card_to_factory_warning_message),
|
||||
style = TangemTypography.body2,
|
||||
color = colorResource(id = R.color.text_secondary),
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = modifier.size(32.dp))
|
||||
Box(
|
||||
modifier = modifier
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 32.dp),
|
||||
) {
|
||||
DetailsMainButton(
|
||||
title = stringResource(id = R.string.reset_card_to_factory_button_title),
|
||||
onClick = state.onResetButtonClick,
|
||||
enabled = state.resetButtonEnabled,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ import androidx.compose.foundation.layout.Row
|
|||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.selection.selectable
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.RadioButton
|
||||
import androidx.compose.material.RadioButtonDefaults
|
||||
import androidx.compose.material.Text
|
||||
|
|
@ -22,6 +23,7 @@ import androidx.compose.ui.unit.dp
|
|||
import com.tangem.tap.common.compose.TangemTypography
|
||||
import com.tangem.tap.features.details.redux.SecurityOption
|
||||
import com.tangem.tap.features.details.ui.common.DetailsMainButton
|
||||
import com.tangem.tap.features.details.ui.common.ScreenTitle
|
||||
import com.tangem.tap.features.details.ui.common.SettingsScreensScaffold
|
||||
import com.tangem.wallet.R
|
||||
|
||||
|
|
@ -33,7 +35,7 @@ fun SecurityModeScreen(
|
|||
) {
|
||||
SettingsScreensScaffold(
|
||||
content = { SecurityModeOptions(state = state, modifier = modifier) },
|
||||
titleRes = R.string.card_settings_security_mode,
|
||||
// titleRes = R.string.card_settings_security_mode,
|
||||
onBackClick = onBackPressed,
|
||||
)
|
||||
}
|
||||
|
|
@ -47,10 +49,13 @@ fun SecurityModeOptions(
|
|||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.padding(bottom = 28.dp)
|
||||
.offset(y = (-16).dp),
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(bottom = 28.dp),
|
||||
verticalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
ScreenTitle(titleRes = R.string.card_settings_security_mode, modifier.padding(bottom = 36.dp))
|
||||
|
||||
|
||||
state.availableOptions.map {
|
||||
SecurityOption(option = it, state = state, modifier = modifier)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue