Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Make Shapes private and use them from CustomShapes #95

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import androidx.compose.ui.unit.dp
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
import com.infomaniak.swisstransfer.ui.images.icons.Add
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.Dimens
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.Shapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme

@Composable
Expand Down Expand Up @@ -74,7 +74,7 @@ private fun CoreButton(
Button(
modifier = modifier.height(buttonSize.height),
colors = style.buttonColors(),
shape = Shapes.medium,
shape = CustomShapes.medium,
enabled = enabled,
onClick = onClick,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ import com.infomaniak.library.filetypes.FileType
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages
import com.infomaniak.swisstransfer.ui.images.icons.CrossThick
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.LocalIsDarkMode
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.Shapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow
Expand Down Expand Up @@ -104,7 +104,7 @@ private fun FileItemContent(
onClick = onClick,
modifier = Modifier.aspectRatio(164 / 152f),
colors = CardDefaults.cardColors(containerColor = SwissTransferTheme.materialColors.background),
shape = Shapes.small,
shape = CustomShapes.small,
border = BorderStroke(width = 1.dp, SwissTransferTheme.materialColors.outlineVariant)
) {
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import androidx.compose.ui.unit.dp
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
import com.infomaniak.swisstransfer.ui.images.icons.Add
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.Shapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme

@Composable
Expand All @@ -62,8 +62,8 @@ fun SwissTransferFab(
}

enum class FabType(val shape: CornerBasedShape, val customSize: Dp?) {
NORMAL(Shapes.medium, null),
BIG(Shapes.large, 80.dp),
NORMAL(CustomShapes.medium, null),
BIG(CustomShapes.large, 80.dp),
}

@Preview(name = "Light mode")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.Dimens
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.Shapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme

@Composable
Expand All @@ -48,8 +48,8 @@ fun TransferTypeButton(
modifier = Modifier
.padding(Margin.XSmall)
.height(Dimens.LargeButtonHeight)
.border(width = 1.dp, color = borderColor, shape = Shapes.small),
shape = Shapes.small,
.border(width = 1.dp, color = borderColor, shape = CustomShapes.small),
shape = CustomShapes.small,
colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent, contentColor = contentColor),
onClick = onClick,
contentPadding = PaddingValues(Margin.Medium),
Expand Down Expand Up @@ -78,4 +78,3 @@ private fun TransferTypeButtonPreview() {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
package com.infomaniak.swisstransfer.ui.theme

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.ui.unit.dp

object CustomShapes {
val None = RoundedCornerShape(0)
val Rounded = RoundedCornerShape(50)
val extraSmall = RoundedCornerShape(4.dp)
val small = RoundedCornerShape(8.dp)
val medium = RoundedCornerShape(16.dp)
val large = RoundedCornerShape(24.dp)
}
30 changes: 0 additions & 30 deletions app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Shapes.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Shapes
import androidx.compose.material3.adaptive.WindowAdaptiveInfo
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.runtime.*
Expand Down Expand Up @@ -85,3 +86,11 @@ data class CustomColorScheme(
val transferTypeProximityContainer: Color = Color.Unspecified,
val transferTypeProximityOnContainer: Color = Color.Unspecified,
)

private val Shapes = Shapes(
extraSmall = CustomShapes.extraSmall,
small = CustomShapes.small,
medium = CustomShapes.medium,
large = CustomShapes.large,
// extraLarge: uses default values, for the bottom sheet corners
)
Loading