diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt index 151301144..67a2a6a43 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/appbar/action/BitwardenOverflowActionItem.kt @@ -58,6 +58,7 @@ fun BitwardenOverflowActionItem( modifier = Modifier.testTag(tag = "HeaderBarOptionsButton"), ) DropdownMenu( + shape = BitwardenTheme.shapes.menu, expanded = isOverflowMenuVisible, onDismissRequest = { isOverflowMenuVisible = false }, offset = DpOffset(x = (-12).dp, y = 0.dp), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt index 3dcff91e6..fbf6ab0ce 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCard.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Text @@ -52,7 +51,7 @@ fun BitwardenActionCard( ) { Card( modifier = modifier, - shape = RoundedCornerShape(12.dp), + shape = BitwardenTheme.shapes.actionCard, colors = bitwardenCardColors(), elevation = CardDefaults.elevatedCardElevation(), border = BorderStroke(width = 1.dp, color = BitwardenTheme.colorScheme.stroke.border), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt index 1da6f1d97..a42bee8e7 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenActionCardSmall.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon @@ -41,7 +40,7 @@ fun BitwardenActionCardSmall( ) { Card( onClick = onCardClicked, - shape = RoundedCornerShape(size = 12.dp), + shape = BitwardenTheme.shapes.actionCard, modifier = modifier, colors = bitwardenCardColors(), elevation = CardDefaults.elevatedCardElevation(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenInfoCalloutCard.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenInfoCalloutCard.kt index 63e2cdf5f..605f29a84 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenInfoCalloutCard.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/card/BitwardenInfoCalloutCard.kt @@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.card import androidx.compose.foundation.background import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -30,7 +29,7 @@ fun BitwardenInfoCalloutCard( modifier = modifier .background( color = BitwardenTheme.colorScheme.background.tertiary, - shape = RoundedCornerShape(size = 8.dp), + shape = BitwardenTheme.shapes.infoCallout, ) .padding(all = 16.dp), ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt index 0d56bc576..d0c5de307 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenBasicDialog.kt @@ -59,6 +59,7 @@ fun BitwardenBasicDialog( modifier = Modifier.testTag("AlertContentText"), ) }, + shape = BitwardenTheme.shapes.dialog, containerColor = BitwardenTheme.colorScheme.background.primary, iconContentColor = BitwardenTheme.colorScheme.icon.secondary, titleContentColor = BitwardenTheme.colorScheme.text.primary, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt index f9167f407..34fc41914 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenDateSelectButton.kt @@ -105,6 +105,7 @@ fun BitwardenDateSelectButton( initialSelectedDateMillis = currentZonedDateTime.orNow().toInstant().toEpochMilli(), ) DatePickerDialog( + shape = BitwardenTheme.shapes.dialog, colors = bitwardenDatePickerColors(), onDismissRequest = { shouldShowDialog = false }, confirmButton = { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt index e4c807334..99805b178 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenLoadingDialog.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Text @@ -49,7 +48,7 @@ fun BitwardenLoadingDialog( ), ) { Card( - shape = RoundedCornerShape(28.dp), + shape = BitwardenTheme.shapes.dialog, colors = CardDefaults.cardColors( containerColor = BitwardenTheme.colorScheme.background.primary, contentColor = BitwardenTheme.colorScheme.text.primary, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt index 8ca8ac94c..feb22d5d3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenMasterPasswordDialog.kt @@ -83,6 +83,7 @@ fun BitwardenMasterPasswordDialog( ) } }, + shape = BitwardenTheme.shapes.dialog, containerColor = BitwardenTheme.colorScheme.background.primary, iconContentColor = BitwardenTheme.colorScheme.icon.secondary, titleContentColor = BitwardenTheme.colorScheme.text.primary, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt index ee0f91768..a4098bfad 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenPinDialog.kt @@ -69,6 +69,7 @@ fun BitwardenPinDialog( autoFocus = true, ) }, + shape = BitwardenTheme.shapes.dialog, containerColor = BitwardenTheme.colorScheme.background.primary, iconContentColor = BitwardenTheme.colorScheme.icon.secondary, titleContentColor = BitwardenTheme.colorScheme.text.primary, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt index 3bf0c282f..161d88b9a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenSelectionDialog.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeightIn import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -62,7 +61,7 @@ fun BitwardenSelectionDialog( // This background is necessary for the dialog to not be transparent. .background( color = BitwardenTheme.colorScheme.background.primary, - shape = RoundedCornerShape(28.dp), + shape = BitwardenTheme.shapes.dialog, ), horizontalAlignment = Alignment.End, ) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt index 0de719360..2b383eb03 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTextEntryDialog.kt @@ -85,6 +85,7 @@ fun BitwardenTextEntryDialog( }, ) }, + shape = BitwardenTheme.shapes.dialog, containerColor = BitwardenTheme.colorScheme.background.primary, iconContentColor = BitwardenTheme.colorScheme.icon.secondary, titleContentColor = BitwardenTheme.colorScheme.text.primary, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt index dfbf38ff2..d4f7e2459 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTimePickerDialog.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -144,7 +143,7 @@ private fun TimePickerDialog( properties = DialogProperties(usePlatformDefaultWidth = false), ) { Surface( - shape = RoundedCornerShape(28.dp), + shape = BitwardenTheme.shapes.dialog, color = BitwardenTheme.colorScheme.background.primary, contentColor = BitwardenTheme.colorScheme.text.primary, modifier = Modifier diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt index 831f4200f..4ec0c34fd 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenTwoButtonDialog.kt @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeightIn import androidx.compose.foundation.layout.requiredWidthIn import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -83,7 +82,7 @@ fun BitwardenTwoButtonDialog( // This background is necessary for the dialog to not be transparent. .background( color = BitwardenTheme.colorScheme.background.primary, - shape = RoundedCornerShape(28.dp), + shape = BitwardenTheme.shapes.dialog, ), horizontalAlignment = Alignment.End, ) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/snackbar/BitwardenSnackbarHost.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/snackbar/BitwardenSnackbarHost.kt index fae7e0a7c..5c0592d00 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/snackbar/BitwardenSnackbarHost.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/snackbar/BitwardenSnackbarHost.kt @@ -24,6 +24,7 @@ fun BitwardenSnackbarHost( ) { Snackbar( snackbarData = it, + shape = BitwardenTheme.shapes.snackbar, containerColor = BitwardenTheme.colorScheme.background.alert, contentColor = BitwardenTheme.colorScheme.text.reversed, actionColor = BitwardenTheme.colorScheme.background.alert, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt index 42eada303..bbdd315a6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/BitwardenTheme.kt @@ -24,6 +24,8 @@ import com.x8bit.bitwarden.ui.platform.theme.color.darkBitwardenColorScheme import com.x8bit.bitwarden.ui.platform.theme.color.dynamicBitwardenColorScheme import com.x8bit.bitwarden.ui.platform.theme.color.lightBitwardenColorScheme import com.x8bit.bitwarden.ui.platform.theme.color.toMaterialColorScheme +import com.x8bit.bitwarden.ui.platform.theme.shape.BitwardenShapes +import com.x8bit.bitwarden.ui.platform.theme.shape.bitwardenShapes import com.x8bit.bitwarden.ui.platform.theme.type.BitwardenTypography import com.x8bit.bitwarden.ui.platform.theme.type.bitwardenTypography import com.x8bit.bitwarden.ui.platform.theme.type.toMaterialTypography @@ -40,6 +42,14 @@ object BitwardenTheme { @ReadOnlyComposable get() = LocalBitwardenColorScheme.current + /** + * Retrieves the current [BitwardenShapes]. + */ + val shapes: BitwardenShapes + @Composable + @ReadOnlyComposable + get() = LocalBitwardenShapes.current + /** * Retrieves the current [BitwardenTypography]. */ @@ -107,6 +117,7 @@ fun BitwardenTheme( CompositionLocalProvider( LocalBitwardenColorScheme provides bitwardenColorScheme, + LocalBitwardenShapes provides bitwardenShapes, LocalBitwardenTypography provides bitwardenTypography, ) { MaterialTheme( @@ -119,14 +130,20 @@ fun BitwardenTheme( } } -/** - * Provides access to the Bitwarden typography throughout the app. - */ -val LocalBitwardenTypography: ProvidableCompositionLocal = - compositionLocalOf { bitwardenTypography } - /** * Provides access to the Bitwarden colors throughout the app. */ val LocalBitwardenColorScheme: ProvidableCompositionLocal = compositionLocalOf { lightBitwardenColorScheme } + +/** + * Provides access to the Bitwarden shapes throughout the app. + */ +val LocalBitwardenShapes: ProvidableCompositionLocal = + compositionLocalOf { bitwardenShapes } + +/** + * Provides access to the Bitwarden typography throughout the app. + */ +val LocalBitwardenTypography: ProvidableCompositionLocal = + compositionLocalOf { bitwardenTypography } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/shape/BitwardenShapes.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/shape/BitwardenShapes.kt new file mode 100644 index 000000000..52bfbaaba --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/shape/BitwardenShapes.kt @@ -0,0 +1,20 @@ +package com.x8bit.bitwarden.ui.platform.theme.shape + +import androidx.compose.foundation.shape.CornerBasedShape +import androidx.compose.runtime.Immutable + +/** + * Defines all the shapes for the app. + */ +@Immutable +data class BitwardenShapes( + val actionCard: CornerBasedShape, + val coachmark: CornerBasedShape, + val content: CornerBasedShape, + val contentBottom: CornerBasedShape, + val contentTop: CornerBasedShape, + val dialog: CornerBasedShape, + val infoCallout: CornerBasedShape, + val menu: CornerBasedShape, + val snackbar: CornerBasedShape, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/shape/Shapes.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/shape/Shapes.kt new file mode 100644 index 000000000..c7c75ce65 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/theme/shape/Shapes.kt @@ -0,0 +1,19 @@ +package com.x8bit.bitwarden.ui.platform.theme.shape + +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.ui.unit.dp + +/** + * The default [BitwardenShapes] for the app. + */ +val bitwardenShapes: BitwardenShapes = BitwardenShapes( + actionCard = RoundedCornerShape(size = 12.dp), + coachmark = RoundedCornerShape(size = 8.dp), + content = RoundedCornerShape(size = 8.dp), + contentBottom = RoundedCornerShape(bottomStart = 8.dp, bottomEnd = 8.dp), + contentTop = RoundedCornerShape(topStart = 8.dp, topEnd = 8.dp), + dialog = RoundedCornerShape(size = 28.dp), + infoCallout = RoundedCornerShape(size = 8.dp), + menu = RoundedCornerShape(size = 4.dp), + snackbar = RoundedCornerShape(size = 8.dp), +) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt index 4288c172e..108e1cb76 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt @@ -20,7 +20,6 @@ import com.x8bit.bitwarden.ui.platform.base.util.orZeroWidthSpace import com.x8bit.bitwarden.ui.platform.util.toFormattedPattern import com.x8bit.bitwarden.ui.vault.feature.item.VaultItemState import com.x8bit.bitwarden.ui.vault.feature.item.model.TotpCodeItemData -import com.x8bit.bitwarden.ui.vault.feature.vault.VaultState import com.x8bit.bitwarden.ui.vault.model.VaultCardBrand import com.x8bit.bitwarden.ui.vault.model.VaultLinkedFieldType import com.x8bit.bitwarden.ui.vault.model.findVaultCardBrandWithNameOrNull