diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt index 52f63d211..f5d1b892e 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt @@ -74,31 +74,6 @@ fun HighlightedText( ) } -@Composable -fun HighlightedText( - modifier: Modifier = Modifier, - templateRes: Int, - argumentRes: Int, - style: TextStyle, - verticalPadding: Float = VERTICAL_PADDING, - horizontalPadding: Float = HORIZONTAL_PADDING, - angleDegrees: Double = ROTATION_ANGLE_DEGREE, -) { - var isHighlighted by rememberSaveable { mutableStateOf(false) } - LaunchedEffect(Unit) { isHighlighted = true } - - HighlightedTextCore( - templateRes, - argumentRes, - style, - modifier, - verticalPadding, - horizontalPadding, - angleDegrees, - { isHighlighted }, - ) -} - @Composable private fun HighlightedTextCore( templateRes: Int, @@ -108,7 +83,7 @@ private fun HighlightedTextCore( verticalPadding: Float, horizontalPadding: Float, angleDegrees: Double, - isHighlighted: () -> Boolean + isHighlighted: () -> Boolean, ) { val template = stringResource(templateRes) val argument = stringResource(argumentRes) @@ -259,12 +234,16 @@ private fun areOnDifferentLines(previousRect: Rect, currentRect: Rect) = previou @Composable private fun Preview() { SwissTransferTheme { + var isHighlighted by rememberSaveable { mutableStateOf(false) } + LaunchedEffect(Unit) { isHighlighted = true } + Surface { Box(modifier = Modifier.padding(20.dp)) { HighlightedText( templateRes = R.string.uploadProgressTitleTemplate, argumentRes = R.string.uploadProgressTitleArgument, style = SwissTransferTheme.typography.bodyMedium, + isHighlighted = { isHighlighted } ) } } 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 9e4bdd397..4d209ba71 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 @@ -23,7 +23,8 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Surface import androidx.compose.material3.Text -import androidx.compose.runtime.Composable +import androidx.compose.runtime.* +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign @@ -44,12 +45,16 @@ fun ColumnScope.AdHeader(adScreenType: UploadProgressAdType) { .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, ) { + var isHighlighted by rememberSaveable { mutableStateOf(false) } + LaunchedEffect(Unit) { isHighlighted = true } + Spacer(Modifier.height(Margin.Giant)) HighlightedText( templateRes = R.string.uploadProgressTitleTemplate, argumentRes = R.string.uploadProgressTitleArgument, style = SwissTransferTheme.typography.bodyMedium, + isHighlighted = { isHighlighted } ) Spacer(Modifier.height(Margin.Huge))