From af98889dc11e91c7102ea138e7ab6d8086709378 Mon Sep 17 00:00:00 2001 From: Pedro Bilro Date: Fri, 8 Nov 2024 11:28:10 +0000 Subject: [PATCH 1/3] RMET-3597 ::: Android 15 - Support edge-to-edge and drop Configuration for layout size (#37) * fix: edge-to-edge support for barcode scan on Android 15 References: https://outsystemsrd.atlassian.net/browse/RMET-3597 * fix: replace configuration with WindowMetrics to retrieve screen size Left orientation as-is because it only impacts close-to-square devices References: https://outsystemsrd.atlassian.net/browse/RMET-3597 * chore: Update CHANGELOG.md References: https://outsystemsrd.atlassian.net/browse/RMET-3597 * chore: set pom.xml version to dev --------- Co-authored-by: Alexandre Jacinto --- CHANGELOG.md | 5 +++++ build.gradle | 1 + pom.xml | 2 +- .../barcode/view/OSBARCScannerActivity.kt | 19 ++++++++++++++----- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2496b57..aad814a 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. +## [Unreleased] + +### 05-11-2024 +- Fix: Edge-to-edge support on Android 15 (https://outsystemsrd.atlassian.net/browse/RMET-3597) + ## [1.1.4] ### 08-10-2024 diff --git a/build.gradle b/build.gradle index 1c8922e..20ea4f3 100644 --- a/build.gradle +++ b/build.gradle @@ -108,6 +108,7 @@ dependencies { implementation "androidx.activity:activity-compose:1.4.0" implementation 'androidx.compose.material3:material3:1.0.0' implementation 'androidx.compose.material3:material3-window-size-class:1.0.0' + implementation 'androidx.window:window:1.3.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' diff --git a/pom.xml b/pom.xml index 96be72f..d998a2a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 com.github.outsystems osbarcode-android - 1.1.4 + 1.1.5-dev 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 ae61fea..8993a1f 100644 --- a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt +++ b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt @@ -77,6 +77,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.clipPath +import androidx.compose.ui.graphics.toComposeRect import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext @@ -89,6 +90,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import androidx.core.content.ContextCompat import androidx.core.view.WindowCompat +import androidx.window.layout.WindowMetricsCalculator import com.outsystems.plugins.barcode.R import com.outsystems.plugins.barcode.controller.OSBARCBarcodeAnalyzer import com.outsystems.plugins.barcode.controller.OSBARCScanLibraryFactory @@ -286,7 +288,6 @@ class OSBARCScannerActivity : ComponentActivity() { Box( modifier = Modifier .fillMaxSize() - .safeDrawingPadding() ) { AndroidView( factory = { context -> @@ -338,8 +339,13 @@ class OSBARCScannerActivity : ComponentActivity() { fun ScanScreenUI(parameters: OSBARCScanParameters, windowSizeClass: WindowSizeClass) { // actual UI on top of the camera stream val configuration = LocalConfiguration.current - screenHeight = configuration.screenHeightDp.dp - screenWidth = configuration.screenWidthDp.dp + val windowMetrics = + WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(this) + val rect = windowMetrics.bounds.toComposeRect() + with(LocalDensity.current) { + screenHeight = rect.height.toDp() + screenWidth = rect.width.toDp() + } val isPortrait = configuration.orientation == Configuration.ORIENTATION_PORTRAIT @@ -505,7 +511,8 @@ class OSBARCScannerActivity : ComponentActivity() { modifier = Modifier .fillMaxWidth() .background(ScannerBackgroundBlack) - .weight(1f, fill = true), + .weight(1f, fill = true) + .safeDrawingPadding(), ) { CloseButton( modifier = Modifier @@ -541,7 +548,8 @@ class OSBARCScannerActivity : ComponentActivity() { modifier = Modifier .fillMaxWidth() .background(ScannerBackgroundBlack) - .weight(1f, fill = true), + .weight(1f, fill = true) + .safeDrawingPadding(), ) { val showTorch = camera.cameraInfo.hasFlashUnit() val showScan = parameters.scanButton @@ -651,6 +659,7 @@ class OSBARCScannerActivity : ComponentActivity() { rightButtonsWidth = with(density) { coordinates.size.width.toDp() } } .background(ScannerBackgroundBlack) + .safeDrawingPadding() ) { CloseButton( From b6b5292311e0f43777255d20b65b2f39a71a4aad Mon Sep 17 00:00:00 2001 From: Pedro Bilro Date: Tue, 12 Nov 2024 11:26:48 +0000 Subject: [PATCH 2/3] RMET-3602 ::: Updated libs for 16KB page alignment (#38) * fix: Updated libs for 16KB page alignment References: - https://outsystemsrd.atlassian.net/browse/RMET-3602 - https://outsystemsrd.atlassian.net/wiki/spaces/RDME/pages/4426137659/iOS+18+Android+15+Assessment * fix: update pom.xml to be able to generate a new aar References: - https://outsystemsrd.atlassian.net/browse/RMET-3602 - https://outsystemsrd.atlassian.net/wiki/spaces/RDME/pages/4426137659/iOS+18+Android+15+Assessment --- CHANGELOG.md | 3 +++ build.gradle | 10 +++++----- pom.xml | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aad814a..ee20a46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ The changes documented here do not include those from the original repository. ## [Unreleased] +### 08-11-2024 +- Fix: Update libraries for supporting 16KB page size (https://outsystemsrd.atlassian.net/browse/RMET-3602) + ### 05-11-2024 - Fix: Edge-to-edge support on Android 15 (https://outsystemsrd.atlassian.net/browse/RMET-3597) diff --git a/build.gradle b/build.gradle index 20ea4f3..4587811 100644 --- a/build.gradle +++ b/build.gradle @@ -116,12 +116,12 @@ dependencies { androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.5" debugImplementation "androidx.compose.ui:ui-tooling:1.0.5" - implementation "androidx.camera:camera-camera2:1.3.0" - implementation 'androidx.camera:camera-lifecycle:1.0.2' - implementation 'androidx.camera:camera-view:1.0.0-alpha31' - implementation 'androidx.camera:camera-core:1.0.0' + implementation "androidx.camera:camera-camera2:1.4.0" + implementation 'androidx.camera:camera-lifecycle:1.4.0' + implementation 'androidx.camera:camera-view:1.4.0' + implementation 'androidx.camera:camera-core:1.4.0' implementation 'com.google.zxing:core:3.4.1' - implementation 'com.google.mlkit:barcode-scanning:17.2.0' + implementation 'com.google.mlkit:barcode-scanning:17.3.0' implementation 'com.google.code.gson:gson:2.10.1' testImplementation "org.mockito:mockito-core:4.3.0" diff --git a/pom.xml b/pom.xml index d998a2a..4ef29e7 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 com.github.outsystems osbarcode-android - 1.1.5-dev + 1.1.5-dev2 From c6d63a3141d9704de96fa59983858f1a2f2aed2b Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 14 Nov 2024 09:11:15 +0000 Subject: [PATCH 3/3] chore: set lib version to 1.1.5 References: https://outsystemsrd.atlassian.net/browse/RMET-3837 --- CHANGELOG.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee20a46..1a62968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ 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. -## [Unreleased] +## [1.1.5] ### 08-11-2024 - Fix: Update libraries for supporting 16KB page size (https://outsystemsrd.atlassian.net/browse/RMET-3602) diff --git a/pom.xml b/pom.xml index 4ef29e7..a49c315 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 com.github.outsystems osbarcode-android - 1.1.5-dev2 + 1.1.5