From 78e10fd57e2efd6b92f424ac5bfdb31ada1d7808 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 22 Aug 2024 15:27:34 +0100 Subject: [PATCH 1/7] fix: if layout is portrait, draw Text even if no scanInstructions are provided. Context: To avoid UI bug reported. References: https://outsystemsrd.atlassian.net/browse/RMET-3379 --- .../plugins/barcode/view/OSBARCScannerActivity.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt index d420a92..9a64486 100644 --- a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt +++ b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt @@ -523,7 +523,8 @@ class OSBARCScannerActivity : ComponentActivity() { ScanInstructions( modifier = Modifier .fillMaxWidth(), - parameters + parameters, + true ) ScanScreenAim(screenHeight, borderPadding, borderPadding, isPhone, true) @@ -618,7 +619,8 @@ class OSBARCScannerActivity : ComponentActivity() { top = borderPadding, bottom = if (isPhone) NoPadding else textToRectPadding ), - parameters + parameters, + false ) ScanScreenAim(screenHeight, NoPadding, borderPadding, isPhone, isPortrait) @@ -761,16 +763,17 @@ class OSBARCScannerActivity : ComponentActivity() { * This component will only be rendered if scan parameters instructs so. * @param modifier the custom modifier for the whole view * @param parameters the scan parameters + * @param isPortrait identifies if the layout is portrait or landscape */ @Composable - fun ScanInstructions(modifier: Modifier, parameters: OSBARCScanParameters) { - if (!parameters.scanInstructions.isNullOrEmpty()) { + fun ScanInstructions(modifier: Modifier, parameters: OSBARCScanParameters, isPortrait: Boolean) { + if (!parameters.scanInstructions.isNullOrBlank() || isPortrait) { Box( modifier = Modifier .background(ScannerBackgroundBlack) ) { Text( - text = parameters.scanInstructions, + text = parameters.scanInstructions ?: "", modifier = modifier, color = ScanInstructionsWhite, textAlign = TextAlign.Center From b73b83b81a5795410229e74598e84159b3df7ef4 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 22 Aug 2024 15:43:39 +0100 Subject: [PATCH 2/7] chore: set lib to a dev version to test References: https://outsystemsrd.atlassian.net/browse/RMET-3379 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d6ccf5a..784fdf5 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 com.github.outsystems osbarcode-android - 1.1.2 + 1.1.3-dev From 5ea2c4e0d677174830049b3eedd493fc0429e8ae Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 22 Aug 2024 16:04:54 +0100 Subject: [PATCH 3/7] chore: update changelog and set lib version References: https://outsystemsrd.atlassian.net/browse/RMET-3379 --- CHANGELOG.md | 5 +++++ pom.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 690a48f..45fa819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The changes documented here do not include those from the original repository. +## [1.1.3] + +### 22-08-2024 +- Fix: Avoid UI bug on background when layout is portrait (https://outsystemsrd.atlassian.net/browse/RMET-3379). + ## [1.1.2] ### 21-05-2024 diff --git a/pom.xml b/pom.xml index 784fdf5..efbe475 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 com.github.outsystems osbarcode-android - 1.1.3-dev + 1.1.3 From dc69cccff9a5c015ac4ca7b649d63dfd19fa03d2 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 22 Aug 2024 17:49:35 +0100 Subject: [PATCH 4/7] refactor: switch order or if condition References: https://outsystemsrd.atlassian.net/browse/RMET-3379 --- .../outsystems/plugins/barcode/view/OSBARCScannerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt index 9a64486..368d517 100644 --- a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt +++ b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt @@ -767,7 +767,7 @@ class OSBARCScannerActivity : ComponentActivity() { */ @Composable fun ScanInstructions(modifier: Modifier, parameters: OSBARCScanParameters, isPortrait: Boolean) { - if (!parameters.scanInstructions.isNullOrBlank() || isPortrait) { + if (isPortrait || !parameters.scanInstructions.isNullOrBlank()) { Box( modifier = Modifier .background(ScannerBackgroundBlack) From d2bc459c9f6ee0ff1d4d23c10051de6e626fa815 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 22 Aug 2024 19:44:27 +0100 Subject: [PATCH 5/7] fix: use Box to fix background instead of writing the text anyways References: https://outsystemsrd.atlassian.net/browse/RMET-3379 --- .../barcode/view/OSBARCScannerActivity.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt index 368d517..99d707d 100644 --- a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt +++ b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt @@ -520,11 +520,17 @@ class OSBARCScannerActivity : ComponentActivity() { verticalArrangement = Arrangement.Center ) { + Box( + modifier = Modifier + .fillMaxWidth() + .weight(1f, fill = true) + .background(ScannerBackgroundBlack) + ) + ScanInstructions( modifier = Modifier .fillMaxWidth(), - parameters, - true + parameters ) ScanScreenAim(screenHeight, borderPadding, borderPadding, isPhone, true) @@ -619,8 +625,7 @@ class OSBARCScannerActivity : ComponentActivity() { top = borderPadding, bottom = if (isPhone) NoPadding else textToRectPadding ), - parameters, - false + parameters ) ScanScreenAim(screenHeight, NoPadding, borderPadding, isPhone, isPortrait) @@ -763,17 +768,16 @@ class OSBARCScannerActivity : ComponentActivity() { * This component will only be rendered if scan parameters instructs so. * @param modifier the custom modifier for the whole view * @param parameters the scan parameters - * @param isPortrait identifies if the layout is portrait or landscape */ @Composable - fun ScanInstructions(modifier: Modifier, parameters: OSBARCScanParameters, isPortrait: Boolean) { - if (isPortrait || !parameters.scanInstructions.isNullOrBlank()) { + fun ScanInstructions(modifier: Modifier, parameters: OSBARCScanParameters) { + if (!parameters.scanInstructions.isNullOrBlank()) { Box( modifier = Modifier .background(ScannerBackgroundBlack) ) { Text( - text = parameters.scanInstructions ?: "", + text = parameters.scanInstructions, modifier = modifier, color = ScanInstructionsWhite, textAlign = TextAlign.Center From 6af41f148fc3ac2eee3395bba66ac76e4916bed5 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 22 Aug 2024 19:45:44 +0100 Subject: [PATCH 6/7] chore: update changelog References: https://outsystemsrd.atlassian.net/browse/RMET-3379 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index efbe475..14abd14 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 com.github.outsystems osbarcode-android - 1.1.3 + 1.1.3-dev2 From 16f99590a2f2f9877771434c2371cad2d563dd88 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 22 Aug 2024 20:09:43 +0100 Subject: [PATCH 7/7] chore: set lib version References: https://outsystemsrd.atlassian.net/browse/RMET-3379 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 14abd14..efbe475 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 com.github.outsystems osbarcode-android - 1.1.3-dev2 + 1.1.3