diff --git a/compose-custom-ui-example/app/build.gradle b/compose-custom-ui-example/app/build.gradle index fc4e4c70..0e9a2467 100644 --- a/compose-custom-ui-example/app/build.gradle +++ b/compose-custom-ui-example/app/build.gradle @@ -71,7 +71,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version") - def scanbotSdkVersion = "9.0.1" + def scanbotSdkVersion = "10.0.0.123-STAGING-SNAPSHOT" implementation("io.scanbot:sdk-package-4:$scanbotSdkVersion") implementation("io.scanbot:rtu-ui-v2-bundle:$scanbotSdkVersion") diff --git a/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/DocumentCleanupScreen.kt b/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/DocumentCleanupScreen.kt new file mode 100644 index 00000000..01681dee --- /dev/null +++ b/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/DocumentCleanupScreen.kt @@ -0,0 +1,176 @@ +@file:kotlin.OptIn(ExperimentalPermissionsApi::class) + +package io.scanbot.example.compose + +import android.graphics.BitmapFactory +import android.net.Uri +import android.util.Log +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.result.PickVisualMediaRequest +import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.systemBarsPadding +import androidx.compose.material3.Button +import androidx.compose.material3.LinearProgressIndicator +import androidx.compose.material3.Slider +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableFloatStateOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.unit.dp +import androidx.navigation.NavHostController +import com.google.accompanist.permissions.ExperimentalPermissionsApi +import io.scanbot.sdk.image.ImageRef +import io.scanbot.sdk.imageprocessing.DocumentCleanupConfiguration +import io.scanbot.sdk.ui_v2.document.DocumentCleanupCustomUI +import io.scanbot.sdk.ui_v2.document.screen.documentcleanup.DocumentCleanupActionController +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext + +/** + * Interactive demo screen for [DocumentCleanupCustomUI]. The user picks an image from the + * gallery, paints a mask on top of it and the masked regions are cleaned up by the SDK. + * + * For a code-only snippet (no image picker, no navigation), see + * [io.scanbot.example.compose.doc_code_snippet.document.DocumentCleanupCustomUISnippet]. + */ +@Composable +fun DocumentCleanupScreen(navController: NavHostController) { + val context = LocalContext.current + val scope = rememberCoroutineScope() + + var inputImage by remember { mutableStateOf(null) } + val controller = remember { mutableStateOf(null) } + val brushSize = remember { mutableFloatStateOf(40f) } + var inProgress by remember { mutableStateOf(false) } + + val pickImageLauncher = rememberLauncherForActivityResult( + ActivityResultContracts.PickVisualMedia() + ) { uri: Uri? -> + if (uri == null) return@rememberLauncherForActivityResult + scope.launch { + val newImage = withContext(Dispatchers.IO) { + runCatching { + context.contentResolver.openInputStream(uri)?.use { stream -> + BitmapFactory.decodeStream(stream) + } + }.getOrNull()?.let { ImageRef.fromBitmap(it) } + } + if (newImage != null) { + inputImage?.close() + inputImage = newImage + } else { + Log.e("DocumentCleanupScreen", "Failed to load image from $uri") + } + } + } + + Column(modifier = Modifier.fillMaxSize().systemBarsPadding()) { + Box(modifier = Modifier.fillMaxWidth().weight(1f)) { + val image = inputImage + if (image != null) { + DocumentCleanupCustomUI( + image = image, + modifier = Modifier.fillMaxSize(), + documentCleanupConfiguration = DocumentCleanupConfiguration( + keepText = true, + maxUndoRedoStackSize = 10, + ), + brushSize = brushSize.floatValue.dp, + brushColor = Color.Red.copy(alpha = 0.5f), + onActionControllerCreated = { controller.value = it }, + onResultImageChanged = { + Log.d("DocumentCleanupScreen", "New result image received") + }, + onProgressChanged = { inProgress = it }, + onError = { error -> + Log.e("DocumentCleanupScreen", "Cleanup error", error) + }, + ) + if (inProgress) { + LinearProgressIndicator( + modifier = Modifier + .fillMaxWidth() + .align(Alignment.TopCenter), + ) + } + } else { + Box(modifier = Modifier.fillMaxSize()) { + Text( + text = "Pick an image to start cleanup", + modifier = Modifier.padding(16.dp), + ) + } + } + } + + Column(modifier = Modifier.fillMaxWidth().padding(8.dp)) { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Button( + modifier = Modifier.weight(1f), + onClick = { + pickImageLauncher.launch( + PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly) + ) + }, + ) { Text("Pick image") } + } + + Spacer(modifier = Modifier.height(8.dp)) + + val activeController = controller.value + val canUndo = activeController?.canUndoFlow?.collectAsState()?.value ?: false + val canRedo = activeController?.canRedoFlow?.collectAsState()?.value ?: false + val progress = activeController?.progressFlow?.collectAsState()?.value ?: false + + Row(modifier = Modifier.fillMaxWidth()) { + Button( + modifier = Modifier.weight(1f), + enabled = canUndo && !progress, + onClick = { activeController?.undo() }, + ) { Text("Undo") } + Button( + modifier = Modifier.weight(1f), + enabled = canRedo && !progress, + onClick = { activeController?.redo() }, + ) { Text("Redo") } + Button( + modifier = Modifier.weight(1f), + enabled = canUndo && !progress, + onClick = { activeController?.reset() }, + ) { Text("Reset") } + } + + Text( + modifier = Modifier.padding(top = 8.dp), + text = "Brush size: ${brushSize.floatValue.toInt()} dp", + ) + Slider( + value = brushSize.floatValue, + onValueChange = { brushSize.floatValue = it }, + valueRange = 8f..120f, + ) + } + } +} diff --git a/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/MainActivity.kt b/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/MainActivity.kt index 652d676e..1412e7bd 100644 --- a/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/MainActivity.kt +++ b/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/MainActivity.kt @@ -72,6 +72,7 @@ sealed class Screen(val route: String) { object BarcodeFindAndPick : Screen("BarcodeFindAndPick") object DocumentScanner1 : Screen("DocumentScanner1") + object DocumentCleanup1 : Screen("DocumentCleanup1") object MrzScanner1 : Screen("MrzScanner1") data class BarcodeDetail(val data: String, val format: String) : Screen("barcodeDetail/{data}/{format}") { @@ -90,6 +91,7 @@ fun AppNavHost(navController: NavHostController) { NavHost(navController = navController, startDestination = Screen.Menu.route) { composable(Screen.Menu.route) { MenuScreen(navController) } composable(Screen.DocumentScanner1.route) { DocumentScannerScreen(navController) } + composable(Screen.DocumentCleanup1.route) { DocumentCleanupScreen(navController) } composable(Screen.MrzScanner1.route) { MrzScannerScreen(navController) } composable( route = "barcodeDetail/{data}/{format}", @@ -122,6 +124,11 @@ fun MenuScreen(navController: NavHostController) { Screen.DocumentScanner1.route, "" ), + Triple( + "Document Cleanup", + Screen.DocumentCleanup1.route, + "" + ), Triple( "MRZ Scanner", Screen.MrzScanner1.route, diff --git a/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/doc_code_snippet/document/DocumentCleanupSnippet.kt b/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/doc_code_snippet/document/DocumentCleanupSnippet.kt new file mode 100644 index 00000000..dc6c7534 --- /dev/null +++ b/compose-custom-ui-example/app/src/main/java/io/scanbot/example/compose/doc_code_snippet/document/DocumentCleanupSnippet.kt @@ -0,0 +1,131 @@ +package io.scanbot.example.compose.doc_code_snippet.document + +import android.util.Log +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Button +import androidx.compose.material3.LinearProgressIndicator +import androidx.compose.material3.Slider +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableFloatStateOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp +import io.scanbot.sdk.image.ImageRef +import io.scanbot.sdk.imageprocessing.DocumentCleanupConfiguration +import io.scanbot.sdk.ui_v2.document.DocumentCleanupCustomUI +import io.scanbot.sdk.ui_v2.document.screen.documentcleanup.DocumentCleanupActionController + +// @Tag("Document Cleanup Custom UI Composable") +/** + * Renders the `DocumentCleanupCustomUI` composable on top of the supplied [image]. + * + * The composable wraps the `DocumentCleanup` classic API and gives the host application + * full control over the surrounding chrome (top bar, bottom bar, undo / redo / reset + * controls, brush-size slider, etc.). + * + * Use the [DocumentCleanupActionController] exposed via `onActionControllerCreated` to + * trigger undo / redo / reset programmatically and to observe the current operation + * progress and undo / redo availability. + */ +@Composable +fun DocumentCleanupCustomUISnippet(image: ImageRef) { + val controller = remember { mutableStateOf(null) } + val brushSize = remember { mutableFloatStateOf(40f) } + var inProgress by remember { mutableStateOf(false) } + + Column(modifier = Modifier.fillMaxSize()) { + Box(modifier = Modifier.fillMaxWidth().weight(1f)) { + DocumentCleanupCustomUI( + image = image, + modifier = Modifier.fillMaxSize(), + // SDK-level cleanup configuration: keepText, undo/redo stack size, etc. + documentCleanupConfiguration = DocumentCleanupConfiguration( + keepText = true, + maxUndoRedoStackSize = 10, + ), + // Background color behind the image canvas + backgroundColor = Color.Black, + // Diameter of the drawing brush + brushSize = brushSize.floatValue.dp, + // Brush stroke preview color + brushColor = Color.Red.copy(alpha = 0.5f), + // Maximum zoom scale supported by pinch-to-zoom + maxZoomScale = 10f, + // Capture the action controller to trigger undo / redo / reset and observe state. + onActionControllerCreated = { controller.value = it }, + // Triggered after every successful cleanup, undo, redo or reset. + // The provided ImageRef is owned by the composable - DO NOT close it. + onResultImageChanged = { newImage -> + Log.d("DocumentCleanupCustomUI", "New result image: $newImage") + }, + // Invoked when a heavy cleanup operation starts (true) or finishes (false). + onProgressChanged = { inProgress = it }, + // Invoked on SDK setup or cleanup failures. + onError = { error -> + Log.e("DocumentCleanupCustomUI", "Cleanup error: ${error.message}") + }, + ) + + if (inProgress) { + LinearProgressIndicator( + modifier = Modifier + .fillMaxWidth() + .align(Alignment.TopCenter), + ) + } + } + + Column(modifier = Modifier.fillMaxWidth().padding(8.dp)) { + val activeController = controller.value + val canUndo = activeController?.canUndoFlow?.collectAsState()?.value ?: false + val canRedo = activeController?.canRedoFlow?.collectAsState()?.value ?: false + val progress = activeController?.progressFlow?.collectAsState()?.value ?: false + + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Button( + modifier = Modifier.weight(1f), + enabled = canUndo && !progress, + onClick = { activeController?.undo() }, + ) { Text("Undo") } + Button( + modifier = Modifier.weight(1f), + enabled = canRedo && !progress, + onClick = { activeController?.redo() }, + ) { Text("Redo") } + Button( + modifier = Modifier.weight(1f), + enabled = canUndo && !progress, + onClick = { activeController?.reset() }, + ) { Text("Reset") } + } + + Spacer(modifier = Modifier.height(8.dp)) + + Text(text = "Brush size: ${brushSize.floatValue.toInt()} dp") + Slider( + value = brushSize.floatValue, + onValueChange = { brushSize.floatValue = it }, + valueRange = 8f..120f, + ) + } + } +} +// @EndTag("Document Cleanup Custom UI Composable") diff --git a/data-capture-ready-to-use-ui-example/app/build.gradle b/data-capture-ready-to-use-ui-example/app/build.gradle index 3d44e1e0..0a720317 100644 --- a/data-capture-ready-to-use-ui-example/app/build.gradle +++ b/data-capture-ready-to-use-ui-example/app/build.gradle @@ -70,7 +70,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version") - def scanbotSdkVersion = "9.0.1" + def scanbotSdkVersion = "10.0.0.123-STAGING-SNAPSHOT" implementation("io.scanbot:sdk-package-4:$scanbotSdkVersion") implementation("io.scanbot:rtu-ui-v2-bundle:$scanbotSdkVersion") diff --git a/document-scanner-ready-to-use-ui-example/app/build.gradle b/document-scanner-ready-to-use-ui-example/app/build.gradle index b861c16e..06fa8155 100644 --- a/document-scanner-ready-to-use-ui-example/app/build.gradle +++ b/document-scanner-ready-to-use-ui-example/app/build.gradle @@ -37,7 +37,7 @@ android { } } -def scanbotSdkVersion = "9.0.1" +def scanbotSdkVersion = "10.0.0.124-STAGING-SNAPSHOT" dependencies { diff --git a/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/ImageStraighteningSnippet.kt b/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/ImageStraighteningSnippet.kt index 614af4d4..8999b028 100644 --- a/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/ImageStraighteningSnippet.kt +++ b/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/ImageStraighteningSnippet.kt @@ -1,7 +1,6 @@ package com.example.scanbot.doc_code_snippet -import android.app.Activity import android.content.Intent import android.os.Bundle import android.util.Log @@ -12,16 +11,12 @@ import com.example.scanbot.utils.getUrisFromGalleryResult import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import io.scanbot.common.onFailure import io.scanbot.common.onSuccess -import io.scanbot.page.PageImageSource import io.scanbot.sdk.ScanbotSDK -import io.scanbot.sdk.docprocessing.Document import io.scanbot.sdk.documentscanner.DocumentStraighteningMode import io.scanbot.sdk.documentscanner.DocumentStraighteningParameters import io.scanbot.sdk.geometry.AspectRatio import io.scanbot.sdk.image.ImageRef -import io.scanbot.sdk.util.isDefault import io.scanbot.sdk.util.toImageRef @@ -34,7 +29,6 @@ class ImageStraighteningSnippet : AppCompatActivity() { } private val scanbotSDK = ScanbotSDK(this@ImageStraighteningSnippet) - private val context = this private val pictureForDocDetectionResult = this.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { activityResult -> @@ -63,13 +57,13 @@ class ImageStraighteningSnippet : AppCompatActivity() { // @Tag("Direct Document straightening on image") fun startStraightening(imageRef: ImageRef) { - scanbotSDK.createDocumentEnhancer().onSuccess { enhancer -> + scanbotSDK.createDocumentStraightener().onSuccess { enhancer -> val params = DocumentStraighteningParameters( straighteningMode = DocumentStraighteningMode.STRAIGHTEN, // Expected aspect ratios for the documents. Comment if unknown. aspectRatios = listOf(AspectRatio(3.0, 4.0)) ) - enhancer.straighten(imageRef, params).onSuccess { result -> + enhancer.run(imageRef, params).onSuccess { result -> // result.straightenedImage is an ImageRef of the straightened image, you can display it in the UI or save it to storage } } @@ -88,6 +82,4 @@ class ImageStraighteningSnippet : AppCompatActivity() { ) pictureForDocDetectionResult.launch(Intent.createChooser(imageIntent, "Select Picture")) } - } - diff --git a/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/rtu_ui/DocumentCleanupScreenSnippet.kt b/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/rtu_ui/DocumentCleanupScreenSnippet.kt new file mode 100644 index 00000000..8574a51e --- /dev/null +++ b/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/rtu_ui/DocumentCleanupScreenSnippet.kt @@ -0,0 +1,128 @@ +package com.example.scanbot.doc_code_snippet.rtu_ui + + +import android.os.Bundle +import androidx.activity.result.ActivityResultLauncher +import androidx.appcompat.app.AppCompatActivity +import androidx.compose.ui.graphics.Color +import io.scanbot.common.onCancellation +import io.scanbot.common.onFailure +import io.scanbot.common.onSuccess +// @Tag("Document Cleanup Screen") +import io.scanbot.sdk.ui_v2.common.ScanbotColor +import io.scanbot.sdk.ui_v2.document.DocumentScannerActivity +import io.scanbot.sdk.ui_v2.document.configuration.DocumentScanningFlow + + +/** + * Configures and launches the Scanbot Document Scanner RTU UI v2 with a customized + * Document Cleanup screen. The cleanup screen is opened from the Review screen via the + * `documentCleanupButton` and lets the user manually erase parts of a scanned page. + */ +class DocumentCleanupScreenSnippet : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + // In the real application, you should call this function on a button click. + startScanning() + } + + private val documentScannerResult: ActivityResultLauncher by lazy { + registerForActivityResult(DocumentScannerActivity.ResultContract()) { result -> + result.onSuccess { document -> + // Handle the scanned document. Cleanup edits are persisted on the page. + }.onCancellation { + // The user closed the scanner without confirming. + }.onFailure { + when (it) { + is io.scanbot.common.Result.InvalidLicenseError -> { + // Indicates that the Scanbot SDK license is invalid. + } + + else -> { + // Handle other errors. + } + } + } + } + } + + fun startScanning() { + // Create the default configuration object. + val configuration = DocumentScanningFlow().apply { + + // The Document Cleanup screen is reachable from the Review screen via the + // `documentCleanupButton`. Make sure the review screen is enabled and the button + // is visible. + // NOTE: toolBar only shows 5 items minimum, and dynamically hides the rest in a popup menu. + // On a standard smartphone device, the cleanup button is usually reachable only from the 'More' menu. + screens.review.apply { + enabled = true + + toolBar.documentCleanupButton.barButton.visible = true + + // Optionally style the button. + toolBar.documentCleanupButton.barButton.title.color = + ScanbotColor(color = Color.White) + // OR - optionally style the relevant popup-menu item. + toolBar.documentCleanupButton.popupMenuItem.title.color = + ScanbotColor(color = Color.Black) + } + + // Retrieve the cleanup screen configuration from the main configuration object. + screens.cleanup.apply { + + // Customize the top bar. + topBarTitle.text = "Clean up the page" + topBarBackButton.text = "Cancel" + topBarConfirmButton.text = "Done" + + // Background color of the canvas behind the image. + backgroundColor = ScanbotColor(value = "#222222") + + // Configure the bottom bar buttons (undo / redo / reset). + bottomBar.undoButton.title.text = "Undo" + bottomBar.redoButton.title.text = "Redo" + bottomBar.resetButton.title.text = "Reset" + + // Configure the stroke-size scrollbar. + bottomBar.strokeSizeScrollbar.apply { + visible = true + minStrokeSize = 1 + maxStrokeSize = 50 + title.text = "Brush size" + } + + // Customize the stroke-size indicator (the round preview of the current brush). + strokeSizeIndicator.apply { + backgroundColor = ScanbotColor(value = "#00C853") + borderColor = ScanbotColor(value = "#FFFFFF") + opacity = 0.9 + } + + // Optional: show an introduction screen the first time the user opens cleanup. + introduction.showAutomatically = true + + // Customize the alert dialogs shown for Reset and for cancelling with unsaved + // changes. + resetAllEditsAlertDialog.title.text = "Reset all edits?" + resetAllEditsAlertDialog.subtitle.text = + "This will revert all cleanup operations on this page." + + discardChangesAlertDialog.title.text = "Discard changes?" + discardChangesAlertDialog.subtitle.text = + "Your cleanup edits on this page will be lost." + } + + // Optionally customize text shown by the cleanup screen via the shared localization + // object (useful when not using string resources). + localization.documentCleanupScreenTitle = "Clean up the page" + localization.documentCleanupUndoButtonTitle = "Undo" + localization.documentCleanupRedoButtonTitle = "Redo" + localization.documentCleanupResetButtonTitle = "Reset" + } + + // Start the scanner activity. + documentScannerResult.launch(configuration) + } +} +// @EndTag("Document Cleanup Screen") diff --git a/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/rtu_ui/ReviewScreenSnippet.kt b/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/rtu_ui/ReviewScreenSnippet.kt index df902088..0f93106c 100644 --- a/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/rtu_ui/ReviewScreenSnippet.kt +++ b/document-scanner-ready-to-use-ui-example/app/src/main/java/com/example/scanbot/doc_code_snippet/rtu_ui/ReviewScreenSnippet.kt @@ -1,12 +1,10 @@ package com.example.scanbot.doc_code_snippet.rtu_ui -import android.app.Activity import android.os.Bundle import androidx.activity.result.ActivityResultLauncher import androidx.appcompat.app.AppCompatActivity import androidx.compose.ui.graphics.Color -import io.scanbot.common.Result import io.scanbot.common.onCancellation import io.scanbot.common.onFailure import io.scanbot.common.onSuccess @@ -57,7 +55,7 @@ class ReviewScreenSnippet : AppCompatActivity() { zoomButton.visible = false // Hide the add button. - bottomBar.addButton.visible = false + toolBar.addButton.barButton.visible = false } // Retrieve the instance of the reorder pages configuration from the main configuration object. screens.reorderPages.apply { @@ -78,10 +76,10 @@ class ReviewScreenSnippet : AppCompatActivity() { screens.review.apply { // Show the retake button. - bottomBar.retakeButton.visible = true + toolBar.retakeButton.barButton.visible = true // Configure the retake title color. - bottomBar.retakeButton.title.color = ScanbotColor(color = Color.Black) + toolBar.retakeButton.barButton.title.color = ScanbotColor(color = Color.Black) } }