Skip to content

Commit

Permalink
[#1618] Settings redesign (#1658)
Browse files Browse the repository at this point in the history
* [#1618] About redesign

* [#1618] Whats new redesign

* [#1618] Delete screen redesign

* [#1618] Export private data refactor

* [#1618] Seed recovery refactor

* [#1618] Seed Redesign

* [#1618] Feedback Redesign

* [#1618] Popup implementation

* [#1618] Localization fixes

* [#1618] Code cleanup

* [#1618] Code cleanup

* [#1618] Code cleanup

* [#1618] Documentation update

* [#1618] Code cleanup

* [#1618] Design hotfixes

* [#1618] Code cleanup

* [#1618] Test hotfixes

* [#1618] Test hotfixes

* Code cleanup

* Changelogs entries update

* Address few review comments

* Fix UI tests

* Fix bottom widget version name in WhatsNew

* Update Spanish texts

* Fix ktlint warnings

* Test hotfix

* Test hotfix

* Code cleanup

* Design hotfixes for small screens

---------

Co-authored-by: Honza <[email protected]>
  • Loading branch information
Milan-Cerovsky and HonzaR authored Nov 14, 2024
1 parent af5ed30 commit 425052f
Show file tree
Hide file tree
Showing 103 changed files with 2,507 additions and 2,462 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2
- The in-app update logic has been fixed and is now correctly requested with every app launch
- The Not enough space and In-app udpate screens have been redesigned
- External links now open in in-app browser
- All the Settings screens have been redesigned

### Fixed
- Address book toast now correctly shows on send screen when adding both new and known addresses to text field
Expand Down
1 change: 1 addition & 0 deletions docs/whatsNew/WHATS_NEW_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ directly impact users rather than highlighting other key architectural updates.*
- The in-app update logic has been fixed and is now correctly requested with every app launch
- The Not enough space and In-app udpate screens have been redesigned
- External links now open in in-app browser
- All the Settings screens have been redesigned

### Fixed
- Address book toast now correctly shows on send screen when adding both new and known addresses to text field
Expand Down
1 change: 1 addition & 0 deletions docs/whatsNew/WHATS_NEW_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ directly impact users rather than highlighting other key architectural updates.*
- The in-app update logic has been fixed and is now correctly requested with every app launch
- The Not enough space and In-app udpate screens have been redesigned
- External links now open in in-app browser
- All the Settings screens have been redesigned

### Fixed
- Address book toast now correctly shows on send screen when adding both new and known addresses to text field
Expand Down
9 changes: 9 additions & 0 deletions tools/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,27 @@ style:
ignoreAnnotated:
- 'Preview'
- 'PreviewScreens'
- 'PreviewScreenSizes'
MagicNumber:
active: true
ignoreAnnotated:
- 'Preview'
- 'PreviewScreens'
- 'PreviewScreenSizes'

complexity:
LongMethod:
active: false
ignoreAnnotated:
- 'Preview'
- 'PreviewScreens'
- 'PreviewScreenSizes'
LongParameterList:
active: false
ignoreAnnotated:
- 'Preview'
- 'PreviewScreens'
- 'PreviewScreenSizes'

Compose:
ModifierMissing:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package co.electriccoin.zcash.ui.design.component

import androidx.annotation.DrawableRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.isSystemInDarkTheme
Expand All @@ -13,12 +14,13 @@ import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
Expand All @@ -39,7 +41,7 @@ fun ZashiButton(
) {
ZashiButton(
text = state.text.getValue(),
leadingIcon = state.leadingIconVector,
icon = state.icon,
onClick = state.onClick,
modifier = modifier,
enabled = state.isEnabled,
Expand All @@ -55,7 +57,7 @@ fun ZashiButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
leadingIcon: Painter? = null,
@DrawableRes icon: Int? = null,
enabled: Boolean = true,
isLoading: Boolean = false,
colors: ZashiButtonColors = ZashiButtonDefaults.primaryColors(),
Expand All @@ -65,11 +67,12 @@ fun ZashiButton(
object : ZashiButtonScope {
@Composable
override fun LeadingIcon() {
if (leadingIcon != null) {
if (icon != null) {
Image(
painter = leadingIcon,
painter = painterResource(icon),
contentDescription = null,
modifier = Modifier.size(20.dp)
modifier = Modifier.size(20.dp),
colorFilter = ColorFilter.tint(LocalContentColor.current)
)
}
}
Expand Down Expand Up @@ -98,14 +101,16 @@ fun ZashiButton(
}
}

val borderColor = if (enabled) colors.borderColor else colors.disabledBorderColor

Button(
onClick = onClick,
modifier = modifier,
shape = RoundedCornerShape(12.dp),
contentPadding = PaddingValues(horizontal = 10.dp),
enabled = enabled,
colors = colors.toButtonColors(),
border = colors.borderColor.takeIf { it != Color.Unspecified }?.let { BorderStroke(1.dp, it) },
border = borderColor.takeIf { it != Color.Unspecified }?.let { BorderStroke(1.dp, it) },
content = {
content(scope)
}
Expand Down Expand Up @@ -142,9 +147,10 @@ object ZashiButtonDefaults {
) = ZashiButtonColors(
containerColor = containerColor,
contentColor = contentColor,
borderColor = Color.Unspecified,
disabledContainerColor = disabledContainerColor,
disabledContentColor = disabledContentColor,
borderColor = Color.Unspecified
disabledBorderColor = Color.Unspecified
)

@Composable
Expand All @@ -156,9 +162,10 @@ object ZashiButtonDefaults {
) = ZashiButtonColors(
containerColor = containerColor,
contentColor = contentColor,
borderColor = Color.Unspecified,
disabledContainerColor = disabledContainerColor,
disabledContentColor = disabledContentColor,
borderColor = Color.Unspecified
disabledBorderColor = Color.Unspecified
)

@Composable
Expand All @@ -170,9 +177,10 @@ object ZashiButtonDefaults {
) = ZashiButtonColors(
containerColor = containerColor,
contentColor = contentColor,
borderColor = Color.Unspecified,
disabledContainerColor = disabledContainerColor,
disabledContentColor = disabledContentColor,
borderColor = Color.Unspecified
disabledBorderColor = Color.Unspecified
)

@Composable
Expand All @@ -187,23 +195,25 @@ object ZashiButtonDefaults {
contentColor = contentColor,
disabledContainerColor = disabledContainerColor,
disabledContentColor = disabledContentColor,
borderColor = borderColor
borderColor = borderColor,
disabledBorderColor = Color.Unspecified
)
}

@Immutable
data class ZashiButtonColors(
val containerColor: Color,
val contentColor: Color,
val borderColor: Color,
val disabledContainerColor: Color,
val disabledContentColor: Color,
val borderColor: Color,
val disabledBorderColor: Color,
)

@Immutable
data class ButtonState(
val text: StringResource,
val leadingIconVector: Painter? = null,
@DrawableRes val icon: Int? = null,
val isEnabled: Boolean = true,
val isLoading: Boolean = false,
val onClick: () -> Unit = {},
Expand Down Expand Up @@ -239,7 +249,7 @@ private fun PrimaryWithIconPreview() =
ZashiButton(
modifier = Modifier.fillMaxWidth(),
text = "Primary",
leadingIcon = painterResource(id = android.R.drawable.ic_secure),
icon = android.R.drawable.ic_secure,
onClick = {},
)
}
Expand Down
Loading

0 comments on commit 425052f

Please sign in to comment.