Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ExampleApplication : Application(), CoroutineScope {

launch {
// Clear all previously created documents in storage
ScanbotSDK(this@ExampleApplication).getSdkComponent()!!.provideDocumentStorage().deleteAll()
ScanbotSDK(this@ExampleApplication).documentApi.deleteAllDocuments()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class BarcodeResultActivity : AppCompatActivity() {
BarcodeItemBinding.inflate(layoutInflater, binding.scannedItems, false)
.also {
item.sourceImage?.let { image ->
it.image.setImageBitmap(image.toBitmap()?.getOrNull())
it.image.setImageBitmap(image.toBitmap().getOrNull())
}
it.barcodeFormat.text = item.format.name
it.docFormat.text = item.extractedDocument?.let {
Expand Down
2 changes: 1 addition & 1 deletion classic-components-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ allprojects {

jvmToolchainVersion = 17

scanbotSdkVersion = "8.0.0.61-STAGING-SNAPSHOT"
scanbotSdkVersion = "8.0.0.64-STAGING-SNAPSHOT"

androidCoreKtxVersion = "1.6.0"
constraintLayoutVersion = "2.0.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ExampleApplication : Application(), CoroutineScope {

launch {
getAppStorageDir(this@ExampleApplication).deleteRecursively()
ScanbotSDK(this@ExampleApplication).getSdkComponent()!!.provideDocumentStorage().deleteAll()
ScanbotSDK(this@ExampleApplication).documentApi.deleteAllDocuments()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ import io.scanbot.sdk.ScanbotSDK
import io.scanbot.sdk.camera.*
import io.scanbot.sdk.document.DocumentAutoSnappingController
import io.scanbot.sdk.document.DocumentScannerFrameHandler
import io.scanbot.sdk.documentscanner.DocumentDetectionResult
import io.scanbot.sdk.documentscanner.DocumentDetectionStatus
import io.scanbot.sdk.documentscanner.DocumentScanner
import io.scanbot.sdk.documentscanner.DocumentScannerParameters
import io.scanbot.sdk.documentscanner.DocumentScanningResult
import io.scanbot.sdk.geometry.AspectRatio
import io.scanbot.sdk.image.ImageRef
import io.scanbot.sdk.imageprocessing.ScanbotSdkImageProcessor
Expand Down Expand Up @@ -128,14 +130,14 @@ class MainActivity : AppCompatActivity(), DocumentScannerFrameHandler.ResultHand
}

override fun handle(
result: Result<DocumentScannerFrameHandler.DetectedFrame>,
result: Result<DocumentDetectionResult>,
frame: FrameHandler.Frame
): Boolean {
// Here you are continuously notified about document scanning results.
// For example, you can show a user guidance text depending on the current scanning status.
result.onSuccess { value ->
userGuidanceHint.post {
showUserGuidance(value.detectionStatus)
showUserGuidance(value.status)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import io.scanbot.sdk.camera.FrameHandler
import io.scanbot.sdk.camera.PictureCallback
import io.scanbot.sdk.document.DocumentAutoSnappingController
import io.scanbot.sdk.document.DocumentScannerFrameHandler
import io.scanbot.sdk.documentscanner.DocumentDetectionResult
import io.scanbot.sdk.documentscanner.DocumentDetectionStatus
import io.scanbot.sdk.documentscanner.DocumentScanner
import io.scanbot.sdk.image.ImageRef
Expand Down Expand Up @@ -172,14 +173,14 @@ class MainActivity : AppCompatActivity(), DocumentScannerFrameHandler.ResultHand
}

override fun handle(
result: Result<DocumentScannerFrameHandler.DetectedFrame>,
result: Result<DocumentDetectionResult>,
frame: FrameHandler.Frame
): Boolean {
// Here you are continuously notified about document scanning results.
// For example, you can show a user guidance text depending on the current scanning status.
result.onSuccess { data ->
userGuidanceHint.post {
showUserGuidance(data.detectionStatus)
showUserGuidance(data.status)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CheckScannerActivity : AppCompatActivity() {
frameHandler = attach(cameraView, checkScanner)
frameHandler.addResultHandler { result, frame ->
result.onSuccess { scanningResult ->
if (scanningResult?.status == CheckMagneticInkStripScanningStatus.SUCCESS) {
if (scanningResult.status == CheckMagneticInkStripScanningStatus.SUCCESS) {
frameHandler.isEnabled = false
startActivity(
CheckScannerResultActivity.newIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DocumentCameraActivity : AppCompatActivity() {
// For example, you can show a user guidance text depending on the current scanning status.
result.onSuccess { data ->
userGuidanceHint.post {
showUserGuidance(data.detectionStatus)
showUserGuidance(data.status)
}
}
false // typically you need to return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ExampleApplication : Application(), CoroutineScope {

launch {
// Clear all previously created documents in storage
ScanbotSDK(this@ExampleApplication).getSdkComponent()!!.provideDocumentStorage().deleteAll()
ScanbotSDK(this@ExampleApplication).documentApi.deleteAllDocuments()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class MrzStillImageScanningActivity : AppCompatActivity() {
applyEdgeToEdge(findViewById(R.id.root_view))

docScannerResultLauncher =
registerForActivityResultOk(DocumentScannerActivity.ResultContract()) { resultEntity ->
val document = resultEntity.result!!
registerForActivityResultOk(DocumentScannerActivity.ResultContract()) { document ->
page = document.pageAtIndex(0) ?: kotlin.run {
Log.e(Const.LOG_TAG, "Error obtaining scanned page!")
this@MrzStillImageScanningActivity.showToast("Error obtaining scanned page!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ExampleApplication : Application(), CoroutineScope {
launch {
getAppStorageDir(this@ExampleApplication).deleteRecursively()
// Clear all previously created documents in storage
ScanbotSDK(this@ExampleApplication).getSdkComponent()!!.provideDocumentStorage().deleteAll()
ScanbotSDK(this@ExampleApplication).documentApi.deleteAllDocuments()
}
}
}
2 changes: 1 addition & 1 deletion data-capture-ready-to-use-ui-example/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")

def scanbotSdkVersion = "8.0.0.61-STAGING-SNAPSHOT"
def scanbotSdkVersion = "8.0.0.64-STAGING-SNAPSHOT"

implementation("io.scanbot:sdk-package-4:$scanbotSdkVersion")
implementation("io.scanbot:rtu-ui-v2-bundle:$scanbotSdkVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Application : Application(), CoroutineScope {

launch {
// Leaving as is to clean end-users' storage for next several app updates.
ScanbotSDK(this@Application).getSdkComponent()!!.provideDocumentStorage().deleteAll()
ScanbotSDK(this@Application).documentApi.deleteAllDocuments()
SharingCopier.clear(this@Application)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import io.scanbot.common.onSuccess
import io.scanbot.example.databinding.*
import io.scanbot.example.fragments.*
import io.scanbot.example.util.*
Expand Down Expand Up @@ -175,15 +176,15 @@ class MainActivity : AppCompatActivity() {

init {
creditCardUiResultLauncher =
registerForActivityResult(CreditCardScannerActivity.ResultContract()) { resultEntity: CreditCardScannerActivity.Result ->
if (resultEntity.resultOk) {
resultEntity.result?.creditCard?.let {
registerForActivityResult(CreditCardScannerActivity.ResultContract()) { resultEntity ->
resultEntity.onSuccess { result ->
result.creditCard?.let {
val creditCard = CreditCard(it)
val cardNumber: String = creditCard.cardNumber.value.text
val cardholderName: String = creditCard.cardholderName?.value?.text ?: ""
val expiryDate: String? = creditCard.expiryDate?.value?.text
Toast.makeText(
this,
this@MainActivity,
"Card Number: $cardNumber, Cardholder Name: $cardholderName, Expiry Date: $expiryDate",
Toast.LENGTH_LONG
).show()
Expand All @@ -193,25 +194,20 @@ class MainActivity : AppCompatActivity() {

mrzDefaultUiResultLauncher =
registerForActivityResultOk(MrzScannerActivity.ResultContract()) { resultEntity ->
if (resultEntity.resultOk) {
resultEntity.result?.mrzDocument?.let {
showMrzDialog(it)
}
resultEntity.mrzDocument?.let {
showMrzDialog(it)
}
}

textDataScannerResultLauncher =
registerForActivityResult(TextPatternScannerActivity.ResultContract()) { resultEntity: TextPatternScannerActivity.Result ->
if (resultEntity.resultOk) {
resultEntity.result?.rawText?.let {
Toast.makeText(this, it, Toast.LENGTH_LONG).show()
}
registerForActivityResultOk(TextPatternScannerActivity.ResultContract()) { resultEntity ->
resultEntity.rawText.let {
Toast.makeText(this, it, Toast.LENGTH_LONG).show()
}
}

vinScannerResultLauncher =
registerForActivityResultOk(VinScannerActivity.ResultContract()) { resultEntity ->
val vinScanResult = resultEntity.result!!
registerForActivityResultOk(VinScannerActivity.ResultContract()) { vinScanResult ->
Toast.makeText(
this@MainActivity,
"VIN Scanned: ${vinScanResult.textResult.rawText}",
Expand All @@ -221,12 +217,12 @@ class MainActivity : AppCompatActivity() {

dataExtractorResultLauncher =
registerForActivityResultOk(DocumentDataExtractorActivity.ResultContract()) { resultEntity ->
handleDocumentDataExtractorResult(listOfNotNull(resultEntity.result))
handleDocumentDataExtractorResult(listOfNotNull(resultEntity))
}

checkScannerResultLauncher =
registerForActivityResultOk(CheckScannerActivity.ResultContract()) { resultEntity ->
handleCheckScannerResult(resultEntity.result!!)
handleCheckScannerResult(resultEntity)
}
}
}
Loading