diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlighterText.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt similarity index 91% rename from app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlighterText.kt rename to app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt index a672ee6bb..af73f2e9e 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlighterText.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt @@ -45,7 +45,7 @@ private val HORIZONTAL_PADDING @Composable get() = with(LocalDensity.current) { private const val ROTATION_ANGLE_DEGREE = -3f @Composable -fun HighlighterText( +fun HighlightedText( templateRes: Int, argumentRes: Int, style: TextStyle, @@ -57,20 +57,20 @@ fun HighlighterText( val argument = stringResource(argumentRes) val text = String.format(template, argument) - val highlighterColor = SwissTransferTheme.colors.highlighterColor + val highlightedColor = SwissTransferTheme.colors.highlightedColor - var highlighterPath by remember { mutableStateOf(null) } + var highlightedPath by remember { mutableStateOf(null) } Text( text = text, style = style, onTextLayout = { layoutResult -> val boundingBoxes = layoutResult.getArgumentBoundingBoxes(text, argument) - highlighterPath = boundingBoxes.transformForHighlighterStyle(verticalPadding, horizontalPadding, angleDegrees) + highlightedPath = boundingBoxes.transformForHighlightedStyle(verticalPadding, horizontalPadding, angleDegrees) }, modifier = Modifier.drawBehind { - highlighterPath?.let { - drawPath(it, style = Fill, color = highlighterColor) + highlightedPath?.let { + drawPath(it, style = Fill, color = highlightedColor) } } ) @@ -81,17 +81,17 @@ private fun TextLayoutResult.getArgumentBoundingBoxes(text: String, argument: St return getBoundingBoxesForRange(start = startIndex, end = startIndex + argument.count()) } -private fun List.transformForHighlighterStyle( +private fun List.transformForHighlightedStyle( verticalPadding: Float, horizontalPadding: Float, angleDegrees: Float, ): Path = Path().apply { forEach { boundingBox -> - addPath(boundingBox.transformForHighlighterStyle(verticalPadding, horizontalPadding, angleDegrees)) + addPath(boundingBox.transformForHighlightedStyle(verticalPadding, horizontalPadding, angleDegrees)) } } -private fun Rect.transformForHighlighterStyle(verticalPadding: Float, horizontalPadding: Float, angleDegrees: Float): Path { +private fun Rect.transformForHighlightedStyle(verticalPadding: Float, horizontalPadding: Float, angleDegrees: Float): Path { return getRotatedRectanglePath( Rect( left = left - horizontalPadding, @@ -173,7 +173,7 @@ private fun Preview() { SwissTransferTheme { Surface { Box(modifier = Modifier.padding(20.dp)) { - HighlighterText( + HighlightedText( templateRes = R.string.uploadProgressTitleTemplate, argumentRes = R.string.uploadProgressTitleArgument, style = SwissTransferTheme.typography.bodyMedium diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt index c52c893af..11cf43cdb 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt @@ -27,9 +27,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.tooling.preview.Preview import com.infomaniak.swisstransfer.R -import com.infomaniak.swisstransfer.ui.components.HighlighterText +import com.infomaniak.swisstransfer.ui.components.HighlightedText import com.infomaniak.swisstransfer.ui.screen.newtransfer.upload.UploadProgressAdType import com.infomaniak.swisstransfer.ui.theme.Dimens import com.infomaniak.swisstransfer.ui.theme.Margin @@ -47,7 +46,7 @@ fun ColumnScope.AdHeader(adScreenType: UploadProgressAdType) { ) { Spacer(modifier = Modifier.height(Margin.Giant)) - HighlighterText( + HighlightedText( templateRes = R.string.uploadProgressTitleTemplate, argumentRes = R.string.uploadProgressTitleArgument, style = SwissTransferTheme.typography.bodyMedium, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt index bf82e1f0b..65d2c6901 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt @@ -92,5 +92,5 @@ val CustomDarkColorScheme = CustomColorScheme( transferFilePreviewOverflow = Color(dark3), onTransferFilePreviewOverflow = Color(green_main), transferListStroke = Color(green_main), - highlighterColor = Color(green_dark), + highlightedColor = Color(green_dark), ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt index 3e8ba0dd5..a92f243d8 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt @@ -93,5 +93,5 @@ val CustomLightColorScheme = CustomColorScheme( transferFilePreviewOverflow = Color(green_dark), onTransferFilePreviewOverflow = Color(green_contrast), transferListStroke = Color(green_dark), - highlighterColor = Color(green_secondary), + highlightedColor = Color(green_secondary), ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt index 79a5005d4..0db11ea68 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt @@ -88,7 +88,7 @@ data class CustomColorScheme( val transferFilePreviewOverflow: Color = Color.Unspecified, val onTransferFilePreviewOverflow: Color = Color.Unspecified, val transferListStroke: Color = Color.Unspecified, - val highlighterColor: Color = Color.Unspecified, + val highlightedColor: Color = Color.Unspecified, ) private val Shapes = Shapes(