From 4bd9c48446df5eb472f349d5e812e36dcab1f2d9 Mon Sep 17 00:00:00 2001 From: Chintan Soni <114917119+chintan-soni-cko@users.noreply.github.com> Date: Mon, 16 Oct 2023 12:53:23 +0100 Subject: [PATCH] PIMOB: 2196: Borderstroke issue fixed (#248) --- .../example/frames/ui/screen/CVVTokenizationScreen.kt | 7 ++++++- .../frames/mapper/InputFieldStyleToViewStyleMapper.kt | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/example_app_frames/src/main/java/com/checkout/example/frames/ui/screen/CVVTokenizationScreen.kt b/example_app_frames/src/main/java/com/checkout/example/frames/ui/screen/CVVTokenizationScreen.kt index 21c5cdbf..683e8749 100644 --- a/example_app_frames/src/main/java/com/checkout/example/frames/ui/screen/CVVTokenizationScreen.kt +++ b/example_app_frames/src/main/java/com/checkout/example/frames/ui/screen/CVVTokenizationScreen.kt @@ -17,6 +17,7 @@ import com.checkout.frames.cvvinputfield.api.CVVComponentApi import com.checkout.frames.cvvinputfield.api.CVVComponentMediator import com.checkout.frames.cvvinputfield.models.CVVComponentConfig import com.checkout.frames.cvvinputfield.style.DefaultCVVInputFieldStyle +import com.checkout.frames.model.BorderStroke import com.checkout.frames.model.CornerRadius import com.checkout.frames.model.Padding import com.checkout.frames.model.Shape @@ -25,7 +26,7 @@ import com.checkout.frames.style.component.base.ContainerStyle import com.checkout.frames.style.component.base.InputFieldStyle import com.checkout.frames.style.component.base.TextStyle -@Suppress("MagicNumber") +@Suppress("MagicNumber", "LongMethod") @Composable fun CVVTokenizationScreen(navController: NavHostController) { val cvvTokenizationViewModel: CVVTokenizationViewModel = viewModel() @@ -78,6 +79,10 @@ fun CVVTokenizationScreen(navController: NavHostController) { color = PaymentFormConstants.backgroundColor, shape = Shape.Circle, cornerRadius = CornerRadius(9), + borderStroke = BorderStroke( + width = 2, + color = 0XFF00CC2D, + ), ), ), ) diff --git a/frames/src/main/java/com/checkout/frames/mapper/InputFieldStyleToViewStyleMapper.kt b/frames/src/main/java/com/checkout/frames/mapper/InputFieldStyleToViewStyleMapper.kt index 943e8cac..67ee6a8e 100644 --- a/frames/src/main/java/com/checkout/frames/mapper/InputFieldStyleToViewStyleMapper.kt +++ b/frames/src/main/java/com/checkout/frames/mapper/InputFieldStyleToViewStyleMapper.kt @@ -2,6 +2,7 @@ package com.checkout.frames.mapper import android.annotation.SuppressLint import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -26,6 +27,7 @@ import com.checkout.frames.utils.extensions.disabledIndicatorColor import com.checkout.frames.utils.extensions.errorIndicatorColor import com.checkout.frames.utils.extensions.focusedIndicatorColor import com.checkout.frames.utils.extensions.toComposeShape +import com.checkout.frames.utils.extensions.toComposeStroke import com.checkout.frames.utils.extensions.toComposeTextStyle import com.checkout.frames.utils.extensions.unfocusedIndicatorColor import com.checkout.frames.view.TextLabel @@ -51,12 +53,14 @@ internal class InputFieldStyleToViewStyleMapper( @SuppressLint("ModifierFactoryExtensionFunction") private fun provideModifier(containerStyle: ContainerStyle): Modifier = with(containerStyle) { var modifier = Modifier.background(Color.Transparent) - + val composeShape = shape.toComposeShape(cornerRadius) height?.let { modifier = modifier.height(it.dp) } modifier = width?.let { modifier.width(it.dp) } ?: modifier.fillMaxWidth() margin?.let { modifier = modifier.padding(it.start.dp, it.top.dp, it.end.dp, it.bottom.dp) } padding?.let { modifier = modifier.padding(it.start.dp, it.top.dp, it.end.dp, it.bottom.dp) } + borderStroke?.let { modifier = modifier.border(it.toComposeStroke(), composeShape) } + return modifier }