#1420 Code cleanup

Closes #1420
This commit is contained in:
Milan Cerovsky 2024-09-05 12:05:20 +02:00
parent db652d6a39
commit 95ac835b9c
15 changed files with 307 additions and 293 deletions

View File

@ -27,7 +27,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.Role
@ -52,22 +51,22 @@ fun RadioButton(
) {
Row(
modifier =
modifier
.clip(RoundedCornerShape(12.dp))
.clickable(
indication = rememberRipple(),
interactionSource = remember { MutableInteractionSource() },
onClick = state.onClick,
role = Role.Button,
)
.padding(horizontal = 20.dp)
.then(
if (testTag != null) {
Modifier.testTag(testTag)
} else {
Modifier
}
),
modifier
.clip(RoundedCornerShape(12.dp))
.clickable(
indication = rememberRipple(),
interactionSource = remember { MutableInteractionSource() },
onClick = state.onClick,
role = Role.Button,
)
.padding(horizontal = 20.dp)
.then(
if (testTag != null) {
Modifier.testTag(testTag)
} else {
Modifier
}
),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
@ -84,12 +83,12 @@ fun RadioButton(
style = ZcashTheme.extendedTypography.radioButton,
color = ZcashTheme.colors.textPrimary,
modifier =
Modifier.padding(
top = 14.dp,
bottom = if (state.subtitle == null) 14.dp else 0.dp,
start = 0.dp,
end = ZcashTheme.dimens.spacingDefault
)
Modifier.padding(
top = 14.dp,
bottom = if (state.subtitle == null) 14.dp else 0.dp,
start = 0.dp,
end = ZcashTheme.dimens.spacingDefault
)
)
if (state.subtitle != null) {
@ -99,11 +98,11 @@ fun RadioButton(
fontWeight = FontWeight.Normal,
color = ZcashTheme.zashiColors.textTertiary,
modifier =
Modifier.padding(
bottom = 6.dp,
start = 0.dp,
end = ZcashTheme.dimens.spacingDefault
)
Modifier.padding(
bottom = 6.dp,
start = 0.dp,
end = ZcashTheme.dimens.spacingDefault
)
)
}
}
@ -161,29 +160,30 @@ data class RadioButtonState(
@Suppress("UnusedPrivateMember")
@PreviewScreens
@Composable
private fun RadioButtonPreview() = ZcashTheme {
BlankBgColumn {
var isChecked by remember { mutableStateOf(false) }
private fun RadioButtonPreview() =
ZcashTheme {
BlankBgColumn {
var isChecked by remember { mutableStateOf(false) }
RadioButton(
modifier = Modifier.fillMaxWidth(),
state =
RadioButtonState(
text = stringRes("test"),
isChecked = isChecked,
onClick = { isChecked = !isChecked },
),
trailingContent = {
Text(text = "Trailing text")
}
)
RadioButton(
state =
RadioButtonState(
text = stringRes("test"),
isChecked = true,
onClick = {},
),
)
RadioButton(
modifier = Modifier.fillMaxWidth(),
state =
RadioButtonState(
text = stringRes("test"),
isChecked = isChecked,
onClick = { isChecked = !isChecked },
),
trailingContent = {
Text(text = "Trailing text")
}
)
RadioButton(
state =
RadioButtonState(
text = stringRes("test"),
isChecked = true,
onClick = {},
),
)
}
}
}

View File

@ -193,8 +193,11 @@ class WalletRepositoryImpl(
// complete quickly, it isn't guaranteed to complete before persistExistingWallet()
// unless a mutex is used here.
persistWalletMutex.withLock {
StandardPreferenceKeys.ONBOARDING_STATE.putValue(standardPreferenceProvider(), onboardingState
.toNumber())
StandardPreferenceKeys.ONBOARDING_STATE.putValue(
standardPreferenceProvider(),
onboardingState
.toNumber()
)
}
}
}

View File

@ -100,18 +100,16 @@ class WalletViewModel(
private val standardPreferenceProvider: StandardPreferenceProvider,
private val getAvailableServers: GetDefaultServersProvider
) : AndroidViewModel(application) {
/*
* Using the Mutex may be overkill, but it ensures that if multiple calls are accidentally made
* that they have a consistent ordering.
*/
*/
private val persistWalletMutex = Mutex()
val navigationCommand = MutableSharedFlow<String>()
val backNavigationCommand = MutableSharedFlow<Unit>()
/**
* Synchronizer that is retained long enough to survive configuration changes.
*/
@ -419,11 +417,10 @@ class WalletViewModel(
)
}
else -> {
BalanceState.Available(
totalBalance = snapshot.totalBalance(),
spendableBalance = snapshot.spendableBalance(),
else -> {
BalanceState.Available(
totalBalance = snapshot.totalBalance(),
spendableBalance = snapshot.spendableBalance(),
exchangeRate = exchangeRateUsd
)
}

View File

@ -41,6 +41,7 @@ import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
import co.electriccoin.zcash.ui.design.component.BlankBgScaffold
import co.electriccoin.zcash.ui.design.component.SmallTopAppBar
import co.electriccoin.zcash.ui.design.component.TopAppBarHideBalancesNavigation
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.fixture.BalanceStateFixture
import co.electriccoin.zcash.ui.fixture.WalletSnapshotFixture
@ -49,7 +50,6 @@ import co.electriccoin.zcash.ui.screen.account.fixture.TransactionsFixture
import co.electriccoin.zcash.ui.screen.account.model.TransactionUiState
import co.electriccoin.zcash.ui.screen.balances.model.StatusAction
import co.electriccoin.zcash.ui.screen.exchangerate.widget.StyledExchangeOptIn
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import kotlinx.datetime.Clock
@Suppress("UnusedPrivateMember")

View File

@ -35,7 +35,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
@ -98,10 +97,10 @@ fun ChooseServerView(
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding =
PaddingValues(
top = paddingValues.calculateTopPadding() + ZcashTheme.dimens.spacingDefault,
bottom = paddingValues.calculateBottomPadding() + ZcashTheme.dimens.spacingDefault,
)
PaddingValues(
top = paddingValues.calculateTopPadding() + ZcashTheme.dimens.spacingDefault,
bottom = paddingValues.calculateBottomPadding() + ZcashTheme.dimens.spacingDefault,
)
) {
if (state.fastest.servers.isEmpty() && state.fastest.isLoading) {
item {
@ -127,9 +126,9 @@ fun ChooseServerView(
private fun ServerLoading() {
Column(
modifier =
Modifier
.fillMaxWidth()
.padding(16.dp),
Modifier
.fillMaxWidth()
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
LottieProgress(
@ -190,9 +189,9 @@ fun ChooseServerBottomBar(saveButtonState: ButtonState) {
ZashiButton(
state = saveButtonState,
modifier =
Modifier
.padding(horizontal = 24.dp)
.fillMaxWidth()
Modifier
.padding(horizontal = 24.dp)
.fillMaxWidth()
)
}
}
@ -205,11 +204,11 @@ private fun ChooseServerTopAppBar(
SmallTopAppBar(
titleText = stringResource(id = R.string.choose_server_title),
subTitle =
when (subTitleState) {
TopAppBarSubTitleState.Disconnected -> stringResource(id = R.string.disconnected_label)
TopAppBarSubTitleState.Restoring -> stringResource(id = R.string.restoring_wallet_label)
TopAppBarSubTitleState.None -> null
},
when (subTitleState) {
TopAppBarSubTitleState.Disconnected -> stringResource(id = R.string.disconnected_label)
TopAppBarSubTitleState.Restoring -> stringResource(id = R.string.restoring_wallet_label)
TopAppBarSubTitleState.None -> null
},
modifier = Modifier.testTag(CHOOSE_SERVER_TOP_APP_BAR),
showTitleLogo = true,
navigationAction = {
@ -239,16 +238,16 @@ private fun LazyListScope.serverListItems(state: ServerListState) {
is ServerState.Custom ->
CustomServerRadioButton(
modifier =
Modifier
.fillMaxWidth()
.padding(start = 4.dp, end = 4.dp)
.then(
if (item.radioButtonState.isChecked) {
Modifier.background(ZcashTheme.zashiColors.bgSecondary, RoundedCornerShape(12.dp))
} else {
Modifier
}
),
Modifier
.fillMaxWidth()
.padding(start = 4.dp, end = 4.dp)
.then(
if (item.radioButtonState.isChecked) {
Modifier.background(ZcashTheme.zashiColors.bgSecondary, RoundedCornerShape(12.dp))
} else {
Modifier
}
),
state = item
)
@ -256,28 +255,30 @@ private fun LazyListScope.serverListItems(state: ServerListState) {
RadioButton(
state = item.radioButtonState,
modifier =
Modifier
.fillMaxWidth()
.padding(horizontal = 4.dp)
.then(
if (item.radioButtonState.isChecked && item.badge == null) {
Modifier.background(ZcashTheme.zashiColors.bgSecondary, RoundedCornerShape(12.dp))
} else {
Modifier
}
),
Modifier
.fillMaxWidth()
.padding(horizontal = 4.dp)
.then(
if (item.radioButtonState.isChecked && item.badge == null) {
Modifier.background(ZcashTheme.zashiColors.bgSecondary, RoundedCornerShape(12.dp))
} else {
Modifier
}
),
checkedContent = {
if (item.badge == null) {
RadioButtonCheckedContent(item.radioButtonState)
} else {
Image(
painter = painterResource(
id = if (isSystemInDarkTheme()) {
drawable.ic_radio_button_checked_variant_dark
} else {
drawable.ic_radio_button_checked_variant
}
),
painter =
painterResource(
id =
if (isSystemInDarkTheme()) {
drawable.ic_radio_button_checked_variant_dark
} else {
drawable.ic_radio_button_checked_variant
}
),
contentDescription = item.radioButtonState.text.getValue(),
)
}
@ -386,13 +387,13 @@ private fun CustomServerRadioButton(
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus(true) }),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri, imeAction = ImeAction.Done),
modifier =
Modifier
.fillMaxWidth()
.padding(
start = 52.dp,
end = 20.dp,
bottom = 16.dp
)
Modifier
.fillMaxWidth()
.padding(
start = 52.dp,
end = 20.dp,
bottom = 16.dp
)
)
}
}
@ -409,57 +410,8 @@ private fun ChooseServerPreview(
ServerListState.Fastest(
title = stringRes("Fastest Servers"),
servers =
if (showFastestServerLoading) {
(1..3).map {
ServerState.Default(
RadioButtonState(
text = stringRes("Some Server"),
isChecked = selectionIndex == it,
onClick = {
selectionIndex = it
},
subtitle = null,
),
badge = null
)
}
} else {
listOf()
},
retryButton =
ButtonState(
text = stringRes("Save Button"),
onClick = {},
),
isLoading = true,
)
ChooseServerView(
state =
ChooseServerState(
fastest = fastestServers,
other =
ServerListState.Other(
title = stringRes("Other Servers"),
servers =
(4..<12).map {
if (it == 5) {
ServerState.Custom(
RadioButtonState(
text = stringRes("Custom Server"),
isChecked = selectionIndex == it,
onClick = {
selectionIndex = it
}
),
newServerTextFieldState =
TextFieldState(
value = stringRes(""),
error = null,
isEnabled = true,
onValueChange = { },
),
)
} else {
if (showFastestServerLoading) {
(1..3).map {
ServerState.Default(
RadioButtonState(
text = stringRes("Some Server"),
@ -467,20 +419,69 @@ private fun ChooseServerPreview(
onClick = {
selectionIndex = it
},
subtitle = if (it == 6) stringRes("Default") else null,
subtitle = null,
),
badge = if (it == 6) stringRes("Active") else null,
badge = null
)
}
}
} else {
listOf()
},
retryButton =
ButtonState(
text = stringRes("Save Button"),
onClick = {},
),
isLoading = true,
)
ChooseServerView(
state =
ChooseServerState(
fastest = fastestServers,
other =
ServerListState.Other(
title = stringRes("Other Servers"),
servers =
(4..<12).map {
if (it == 5) {
ServerState.Custom(
RadioButtonState(
text = stringRes("Custom Server"),
isChecked = selectionIndex == it,
onClick = {
selectionIndex = it
}
),
newServerTextFieldState =
TextFieldState(
value = stringRes(""),
error = null,
isEnabled = true,
onValueChange = { },
),
)
} else {
ServerState.Default(
RadioButtonState(
text = stringRes("Some Server"),
isChecked = selectionIndex == it,
onClick = {
selectionIndex = it
},
subtitle = if (it == 6) stringRes("Default") else null,
),
badge = if (it == 6) stringRes("Active") else null,
)
}
}
),
saveButton =
ButtonState(
text = stringRes("Save Button"),
onClick = {},
),
dialogState = dialogState
),
saveButton =
ButtonState(
text = stringRes("Save Button"),
onClick = {},
),
dialogState = dialogState
),
onBack = {},
topAppBarSubTitleState = TopAppBarSubTitleState.None,
)
@ -493,14 +494,14 @@ private fun ChooseServerPreviewValidationDialog() =
ZcashTheme {
ChooseServerPreview(
dialogState =
ServerDialogState.Validation(
state =
AlertDialogState(
title = stringRes("title"),
text = stringRes("text"),
),
reason = stringRes("reason")
)
ServerDialogState.Validation(
state =
AlertDialogState(
title = stringRes("title"),
text = stringRes("text"),
),
reason = stringRes("reason")
)
)
}

View File

@ -15,9 +15,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import co.electriccoin.zcash.ui.design.component.ButtonState
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.design.util.stringRes
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
@Composable
fun BottomBar(
@ -48,9 +48,9 @@ private fun BottomBarPreview() =
ZashiButton(
state = ButtonState(text = stringRes("Save Button")),
modifier =
Modifier
.padding(horizontal = 24.dp)
.fillMaxWidth()
Modifier
.padding(horizontal = 24.dp)
.fillMaxWidth()
)
}
}

View File

@ -48,25 +48,27 @@ internal fun ZashiButton(
colors: ButtonColors = ZashiButtonDefaults.primaryButtonColors(),
content: @Composable RowScope.(ZashiButtonScope) -> Unit = ZashiButtonDefaults.content
) {
val scope = object : ZashiButtonScope {
@Composable
override fun Text() {
Text(text = text)
}
val scope =
object : ZashiButtonScope {
@Composable
override fun Text() {
Text(text = text)
}
@Composable
override fun Loading() {
if (enabled && isLoading) {
LottieProgress(
loadingRes = if (isSystemInDarkTheme()) {
R.raw.lottie_loading
} else {
R.raw.lottie_loading_white
}
)
@Composable
override fun Loading() {
if (enabled && isLoading) {
LottieProgress(
loadingRes =
if (isSystemInDarkTheme()) {
R.raw.lottie_loading
} else {
R.raw.lottie_loading_white
}
)
}
}
}
}
Button(
onClick = onClick,
@ -89,7 +91,6 @@ interface ZashiButtonScope {
}
object ZashiButtonDefaults {
val content: @Composable RowScope.(ZashiButtonScope) -> Unit
get() = { scope ->
scope.Text()

View File

@ -64,11 +64,13 @@ fun ZashiTextField(
TextFieldInternal(
value = state.value.getValue(),
onValueChange = state.onValueChange,
modifier = modifier then Modifier.border(
width = 1.dp,
color = ZcashTheme.zashiColors.stroke,
shape = ZashiTextFieldDefaults.shape
),
modifier =
modifier then
Modifier.border(
width = 1.dp,
color = ZcashTheme.zashiColors.stroke,
shape = ZashiTextFieldDefaults.shape
),
enabled = state.isEnabled,
readOnly = readOnly,
textStyle = textStyle,
@ -121,16 +123,18 @@ private fun TextFieldInternal(
modifier: Modifier = Modifier,
) {
// If color is not provided via the text style, use content color as a default
val textColor = textStyle.color.takeOrElse {
colors.textColor(enabled, isError, interactionSource).value
}
val textColor =
textStyle.color.takeOrElse {
colors.textColor(enabled, isError, interactionSource).value
}
val mergedTextStyle = textStyle.merge(TextStyle(color = textColor))
CompositionLocalProvider(LocalTextSelectionColors provides colors.selectionColors) {
BasicTextField(
value = value,
modifier = modifier
.defaultMinSize(minWidth = TextFieldDefaults.MinWidth),
modifier =
modifier
.defaultMinSize(minWidth = TextFieldDefaults.MinWidth),
onValueChange = onValueChange,
enabled = enabled,
readOnly = readOnly,
@ -177,12 +181,13 @@ private fun TextFieldColors.textColor(
): State<Color> {
val focused by interactionSource.collectIsFocusedAsState()
val targetValue = when {
!enabled -> disabledTextColor
isError -> errorTextColor
focused -> focusedTextColor
else -> unfocusedTextColor
}
val targetValue =
when {
!enabled -> disabledTextColor
isError -> errorTextColor
focused -> focusedTextColor
else -> unfocusedTextColor
}
return rememberUpdatedState(targetValue)
}
@ -195,7 +200,6 @@ internal fun TextFieldColors.cursorColor(isError: Boolean): State<Color> {
}
object ZashiTextFieldDefaults {
val shape: Shape
get() = RoundedCornerShape(8.dp)
@ -206,21 +210,24 @@ object ZashiTextFieldDefaults {
unfocusedTextColor: Color = ZcashTheme.zashiColors.textPrimary,
disabledTextColor: Color = ZcashTheme.zashiColors.textPrimary,
errorTextColor: Color = Color.Unspecified,
focusedContainerColor: Color = if (isSystemInDarkTheme()) {
ZcashTheme.zashiColors.bgSecondary
} else {
ZcashTheme.zashiColors.bgPrimary
},
unfocusedContainerColor: Color = if (isSystemInDarkTheme()) {
ZcashTheme.zashiColors.bgSecondary
} else {
ZcashTheme.zashiColors.bgPrimary
},
disabledContainerColor: Color = if (isSystemInDarkTheme()) {
ZcashTheme.zashiColors.bgSecondary
} else {
ZcashTheme.zashiColors.bgPrimary
},
focusedContainerColor: Color =
if (isSystemInDarkTheme()) {
ZcashTheme.zashiColors.bgSecondary
} else {
ZcashTheme.zashiColors.bgPrimary
},
unfocusedContainerColor: Color =
if (isSystemInDarkTheme()) {
ZcashTheme.zashiColors.bgSecondary
} else {
ZcashTheme.zashiColors.bgPrimary
},
disabledContainerColor: Color =
if (isSystemInDarkTheme()) {
ZcashTheme.zashiColors.bgSecondary
} else {
ZcashTheme.zashiColors.bgPrimary
},
errorContainerColor: Color = Color.Unspecified,
cursorColor: Color = Color.Unspecified,
errorCursorColor: Color = Color.Unspecified,
@ -257,60 +264,63 @@ object ZashiTextFieldDefaults {
unfocusedSuffixColor: Color = Color.Unspecified,
disabledSuffixColor: Color = Color.Unspecified,
errorSuffixColor: Color = Color.Unspecified,
): TextFieldColors = TextFieldDefaults.colors(
focusedTextColor = focusedTextColor,
unfocusedTextColor = unfocusedTextColor,
disabledTextColor = disabledTextColor,
errorTextColor = errorTextColor,
focusedContainerColor = focusedContainerColor,
unfocusedContainerColor = unfocusedContainerColor,
disabledContainerColor = disabledContainerColor,
errorContainerColor = errorContainerColor,
cursorColor = cursorColor,
errorCursorColor = errorCursorColor,
selectionColors = selectionColors,
focusedIndicatorColor = focusedIndicatorColor,
unfocusedIndicatorColor = unfocusedIndicatorColor,
disabledIndicatorColor = disabledIndicatorColor,
errorIndicatorColor = errorIndicatorColor,
focusedLeadingIconColor = focusedLeadingIconColor,
unfocusedLeadingIconColor = unfocusedLeadingIconColor,
disabledLeadingIconColor = disabledLeadingIconColor,
errorLeadingIconColor = errorLeadingIconColor,
focusedTrailingIconColor = focusedTrailingIconColor,
unfocusedTrailingIconColor = unfocusedTrailingIconColor,
disabledTrailingIconColor = disabledTrailingIconColor,
errorTrailingIconColor = errorTrailingIconColor,
focusedLabelColor = focusedLabelColor,
unfocusedLabelColor = unfocusedLabelColor,
disabledLabelColor = disabledLabelColor,
errorLabelColor = errorLabelColor,
focusedPlaceholderColor = focusedPlaceholderColor,
unfocusedPlaceholderColor = unfocusedPlaceholderColor,
disabledPlaceholderColor = disabledPlaceholderColor,
errorPlaceholderColor = errorPlaceholderColor,
focusedSupportingTextColor = focusedSupportingTextColor,
unfocusedSupportingTextColor = unfocusedSupportingTextColor,
disabledSupportingTextColor = disabledSupportingTextColor,
errorSupportingTextColor = errorSupportingTextColor,
focusedPrefixColor = focusedPrefixColor,
unfocusedPrefixColor = unfocusedPrefixColor,
disabledPrefixColor = disabledPrefixColor,
errorPrefixColor = errorPrefixColor,
focusedSuffixColor = focusedSuffixColor,
unfocusedSuffixColor = unfocusedSuffixColor,
disabledSuffixColor = disabledSuffixColor,
errorSuffixColor = errorSuffixColor,
)
): TextFieldColors =
TextFieldDefaults.colors(
focusedTextColor = focusedTextColor,
unfocusedTextColor = unfocusedTextColor,
disabledTextColor = disabledTextColor,
errorTextColor = errorTextColor,
focusedContainerColor = focusedContainerColor,
unfocusedContainerColor = unfocusedContainerColor,
disabledContainerColor = disabledContainerColor,
errorContainerColor = errorContainerColor,
cursorColor = cursorColor,
errorCursorColor = errorCursorColor,
selectionColors = selectionColors,
focusedIndicatorColor = focusedIndicatorColor,
unfocusedIndicatorColor = unfocusedIndicatorColor,
disabledIndicatorColor = disabledIndicatorColor,
errorIndicatorColor = errorIndicatorColor,
focusedLeadingIconColor = focusedLeadingIconColor,
unfocusedLeadingIconColor = unfocusedLeadingIconColor,
disabledLeadingIconColor = disabledLeadingIconColor,
errorLeadingIconColor = errorLeadingIconColor,
focusedTrailingIconColor = focusedTrailingIconColor,
unfocusedTrailingIconColor = unfocusedTrailingIconColor,
disabledTrailingIconColor = disabledTrailingIconColor,
errorTrailingIconColor = errorTrailingIconColor,
focusedLabelColor = focusedLabelColor,
unfocusedLabelColor = unfocusedLabelColor,
disabledLabelColor = disabledLabelColor,
errorLabelColor = errorLabelColor,
focusedPlaceholderColor = focusedPlaceholderColor,
unfocusedPlaceholderColor = unfocusedPlaceholderColor,
disabledPlaceholderColor = disabledPlaceholderColor,
errorPlaceholderColor = errorPlaceholderColor,
focusedSupportingTextColor = focusedSupportingTextColor,
unfocusedSupportingTextColor = unfocusedSupportingTextColor,
disabledSupportingTextColor = disabledSupportingTextColor,
errorSupportingTextColor = errorSupportingTextColor,
focusedPrefixColor = focusedPrefixColor,
unfocusedPrefixColor = unfocusedPrefixColor,
disabledPrefixColor = disabledPrefixColor,
errorPrefixColor = errorPrefixColor,
focusedSuffixColor = focusedSuffixColor,
unfocusedSuffixColor = unfocusedSuffixColor,
disabledSuffixColor = disabledSuffixColor,
errorSuffixColor = errorSuffixColor,
)
}
@Suppress("UnusedPrivateMember")
@PreviewScreens
@Composable
private fun ZashiTextFieldPreview() = ZcashTheme {
ZashiTextField(
state = TextFieldState(
value = stringRes("Text")
) {}
)
}
private fun ZashiTextFieldPreview() =
ZcashTheme {
ZashiTextField(
state =
TextFieldState(
value = stringRes("Text")
) {}
)
}

View File

@ -18,12 +18,12 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import co.electriccoin.zcash.ui.R
import co.electriccoin.zcash.ui.design.component.BlankSurface
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.screen.exchangerate.BaseExchangeRateOptIn
import co.electriccoin.zcash.ui.screen.exchangerate.ZashiButton
import co.electriccoin.zcash.ui.screen.exchangerate.ZashiButtonDefaults
import co.electriccoin.zcash.ui.screen.exchangerate.ZashiTextButton
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
@Composable
fun ExchangeRateOptIn(

View File

@ -27,12 +27,12 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import co.electriccoin.zcash.ui.R
import co.electriccoin.zcash.ui.design.component.BlankSurface
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.screen.exchangerate.BaseExchangeRateOptIn
import co.electriccoin.zcash.ui.screen.exchangerate.SecondaryCard
import co.electriccoin.zcash.ui.screen.exchangerate.ZashiButton
import co.electriccoin.zcash.ui.screen.exchangerate.ZashiButtonDefaults
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
@Composable
fun SettingsExchangeRateOptIn(

View File

@ -42,12 +42,12 @@ import co.electriccoin.zcash.ui.common.extension.toKotlinLocale
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
import co.electriccoin.zcash.ui.design.component.BlankSurface
import co.electriccoin.zcash.ui.design.component.LottieProgress
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.design.util.StringResource
import co.electriccoin.zcash.ui.design.util.getValue
import co.electriccoin.zcash.ui.design.util.stringRes
import co.electriccoin.zcash.ui.fixture.ObserveFiatCurrencyResultFixture
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import kotlinx.datetime.Clock
@Suppress("LongParameterList", "ComplexCondition")

View File

@ -9,10 +9,10 @@ import cash.z.ecc.android.sdk.model.FiatCurrencyConversion
import cash.z.ecc.android.sdk.model.Zatoshi
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
import co.electriccoin.zcash.ui.design.component.BlankSurface
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.design.util.StringResource
import co.electriccoin.zcash.ui.design.util.stringRes
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import kotlinx.datetime.Clock
@Suppress("LongParameterList", "ComplexCondition")

View File

@ -24,11 +24,11 @@ import androidx.compose.ui.unit.sp
import co.electriccoin.zcash.ui.R
import co.electriccoin.zcash.ui.common.wallet.ExchangeRateState
import co.electriccoin.zcash.ui.design.component.BlankSurface
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.screen.exchangerate.SecondaryCard
import co.electriccoin.zcash.ui.screen.exchangerate.ZashiButton
import co.electriccoin.zcash.ui.screen.exchangerate.ZashiButtonDefaults
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
@Suppress("LongMethod")
@Composable

View File

@ -35,8 +35,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Popup
import co.electriccoin.zcash.ui.R
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
@Composable
internal fun StyledExchangeUnavailablePopup(

View File

@ -3,6 +3,7 @@ package co.electroniccoin.zcash.ui.screenshot
import android.app.Application
import android.content.Context
import co.electriccoin.zcash.di.coreModule
import co.electriccoin.zcash.di.providerModule
import co.electriccoin.zcash.di.repositoryModule
import co.electriccoin.zcash.di.useCaseModule
import co.electriccoin.zcash.di.viewModelModule
@ -29,6 +30,7 @@ class ZcashUiTestApplication : Application() {
androidContext(this@ZcashUiTestApplication)
modules(
coreModule,
providerModule,
repositoryModule,
useCaseModule,
viewModelModule