Skip to content

[EPIC-6074] acceptance DS 7.1.0 #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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 @@ -28,7 +28,6 @@ import io.scanbot.sdk.barcode.ui.BarcodeScannerView
import io.scanbot.sdk.barcode.ui.IBarcodeScannerViewCallback
import io.scanbot.sdk.camera.CaptureInfo
import io.scanbot.sdk.camera.FrameHandlerResult
import io.scanbot.sdk.ui.camera.CameraUiSettings

class BarcodeScannerViewActivity : AppCompatActivity() {
private lateinit var barcodeScannerView: BarcodeScannerView
Expand All @@ -52,7 +51,7 @@ class BarcodeScannerViewActivity : AppCompatActivity() {
} )

barcodeScannerView.apply {
initCamera(CameraUiSettings(false))
initCamera()
initScanningBehavior(scanner,
{ result ->
if (result is FrameHandlerResult.Success) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DetailedItemDataActivity : AppCompatActivity() {
is BoardingPass -> {
barcodesResult.append("\n")
.append("Boarding Pass Document\n")
.append("${barcodeDocumentFormat.name}\n")
.append("${barcodeDocumentFormat.passengerName}\n")
barcodeDocumentFormat.legs?.forEach { leg ->
leg.document.fields.forEach {
barcodesResult.append("${it.type.name}:${it.value}\n")
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 = "7.0.3"
scanbotSdkVersion = "7.1.0.1125-SNAPSHOT"

androidCoreKtxVersion = "1.6.0"
constraintLayoutVersion = "2.0.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import io.scanbot.sdk.document.DocumentScannerFrameHandler
import io.scanbot.sdk.document.ui.DocumentScannerView
import io.scanbot.sdk.document.ui.IDocumentScannerViewCallback
import io.scanbot.sdk.process.ImageProcessor
import io.scanbot.sdk.ui.camera.CameraUiSettings
import io.scanbot.sdk.ui.camera.ShutterButton
import io.scanbot.sdk.ui.view.base.configuration.CameraOrientationMode

Expand Down Expand Up @@ -68,7 +67,7 @@ class DocumentCameraActivity : AppCompatActivity() {
}

documentScannerView.apply {
initCamera(CameraUiSettings(true))
initCamera()
initScanningBehavior(documentScanner,
{ result ->
// Here you are continuously notified about document scanning results.
Expand Down
35 changes: 35 additions & 0 deletions data-capture-ready-to-use-ui-example/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 = "7.0.3"
def scanbotSdkVersion = "7.1.0.1125-SNAPSHOT"

implementation("io.scanbot:sdk-package-4:$scanbotSdkVersion")
implementation("io.scanbot:sdk-package-ui:$scanbotSdkVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,34 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import io.scanbot.example.databinding.*
import io.scanbot.example.fragments.*
import io.scanbot.genericdocument.entity.*
import io.scanbot.sap.*
import io.scanbot.sdk.*
import io.scanbot.sdk.check.*
import io.scanbot.sdk.check.entity.*
import io.scanbot.sdk.creditcard.entity.CreditCard
import io.scanbot.sdk.documentdata.*
import io.scanbot.sdk.documentdata.entity.*
import io.scanbot.sdk.creditcard.entity.*
import io.scanbot.sdk.ehicscanner.*
import io.scanbot.sdk.genericdocument.entity.*
import io.scanbot.sdk.mc.*
import io.scanbot.sdk.textpattern.ContentValidationCallback
import io.scanbot.sdk.textpattern.CustomContentValidator
import io.scanbot.sdk.ui.registerForActivityResultOk
import io.scanbot.sdk.ui.view.check.*
import io.scanbot.sdk.ui.view.check.configuration.CheckScannerConfiguration
import io.scanbot.sdk.ui.view.documentdata.*
import io.scanbot.sdk.ui.view.documentdata.configuration.DocumentDataExtractorConfiguration
import io.scanbot.sdk.ui.*
import io.scanbot.sdk.ui.view.hic.*
import io.scanbot.sdk.ui.view.hic.configuration.*
import io.scanbot.sdk.ui.view.mc.*
import io.scanbot.sdk.ui.view.mc.configuration.*
import io.scanbot.sdk.ui.view.vin.*
import io.scanbot.sdk.ui.view.vin.configuration.*
import io.scanbot.sdk.ui_v2.common.ScanbotColor
import io.scanbot.sdk.ui_v2.check.CheckScannerActivity
import io.scanbot.sdk.ui_v2.check.configuration.CheckScannerScreenConfiguration
import io.scanbot.sdk.ui_v2.check.configuration.CheckScannerUiResult
import io.scanbot.sdk.ui_v2.common.*
import io.scanbot.sdk.ui_v2.common.activity.*
import io.scanbot.sdk.ui_v2.creditcard.CreditCardScannerActivity
import io.scanbot.sdk.ui_v2.creditcard.configuration.CreditCardScannerScreenConfiguration
import io.scanbot.sdk.ui_v2.creditcard.*
import io.scanbot.sdk.ui_v2.creditcard.configuration.*
import io.scanbot.sdk.ui_v2.documentdata.*
import io.scanbot.sdk.ui_v2.documentdataextractor.configuration.*
import io.scanbot.sdk.ui_v2.mrz.*
import io.scanbot.sdk.ui_v2.mrz.configuration.*
import io.scanbot.sdk.ui_v2.textpattern.TextPatternScannerActivity
import io.scanbot.sdk.ui_v2.textpattern.configuration.TextPatternScannerScreenConfiguration
import java.util.regex.Pattern
import io.scanbot.sdk.ui_v2.textpattern.*
import io.scanbot.sdk.ui_v2.textpattern.configuration.*
import io.scanbot.sdk.ui_v2.vin.VinScannerActivity
import io.scanbot.sdk.ui_v2.vin.configuration.VinScannerScreenConfiguration

class MainActivity : AppCompatActivity() {

Expand All @@ -50,11 +45,11 @@ class MainActivity : AppCompatActivity() {
private val mrzDefaultUiResultLauncher: ActivityResultLauncher<MrzScannerScreenConfiguration>
private val creditCardUiResultLauncher: ActivityResultLauncher<CreditCardScannerScreenConfiguration>
private val textDataScannerResultLauncher: ActivityResultLauncher<TextPatternScannerScreenConfiguration>
private val vinScannerResultLauncher: ActivityResultLauncher<VinScannerConfiguration>
private val vinScannerResultLauncher: ActivityResultLauncher<VinScannerScreenConfiguration>
private val medicalCertificateScannerActivityResultLauncher: ActivityResultLauncher<MedicalCertificateScannerConfiguration>
private val ehicScannerResultLauncher: ActivityResultLauncher<HealthInsuranceCardScannerConfiguration>
private val dataExtractorResultLauncher: ActivityResultLauncher<DocumentDataExtractorConfiguration>
private val checkScannerResultLauncher: ActivityResultLauncher<CheckScannerConfiguration>
private val dataExtractorResultLauncher: ActivityResultLauncher<DocumentDataExtractorScreenConfiguration>
private val checkScannerResultLauncher: ActivityResultLauncher<CheckScannerScreenConfiguration>

private lateinit var binding: ActivityMainBinding

Expand All @@ -79,32 +74,26 @@ class MainActivity : AppCompatActivity() {
// Create the default configuration object.
val textPatternScannerConfiguration = TextPatternScannerScreenConfiguration()
// Configure what string should be passed as successfully scanned text.
/* textPatternScannerConfiguration.scannerConfiguration.validator = CustomContentValidator().apply {
val pattern = Pattern.compile("^[0-9]{4}$") // e.g. 4 digits
this.callback = object : ContentValidationCallback {
override fun clean(rawText: String): String {
return rawText.replace(" ", "")
}

override fun validate(text: String): Boolean {
val matcher = pattern.matcher(text)
return matcher.find()
}
}
}*/
/* textPatternScannerConfiguration.scannerConfiguration.validator = CustomContentValidator().apply {
val pattern = Pattern.compile("^[0-9]{4}$") // e.g. 4 digits
this.callback = object : ContentValidationCallback {
override fun clean(rawText: String): String {
return rawText.replace(" ", "")
}

override fun validate(text: String): Boolean {
val matcher = pattern.matcher(text)
return matcher.find()
}
}
}*/
textPatternScannerConfiguration.topBar.backgroundColor = ScanbotColor(Color.BLACK)
textDataScannerResultLauncher.launch(textPatternScannerConfiguration)
}

findViewById<View>(R.id.vin_scanner_default_ui).setOnClickListener {
val vinScannerConfiguration = VinScannerConfiguration()
val vinScannerConfiguration = VinScannerScreenConfiguration()

vinScannerConfiguration.setTopBarBackgroundColor(
ContextCompat.getColor(this, R.color.colorPrimaryDark)
)
vinScannerConfiguration.setTopBarButtonsColor(
ContextCompat.getColor(this, R.color.greyColor)
)

vinScannerResultLauncher.launch(vinScannerConfiguration)
}
Expand All @@ -115,27 +104,13 @@ class MainActivity : AppCompatActivity() {
creditCardUiResultLauncher.launch(creditCardScannerConfiguration)
}

findViewById<View>(R.id.generic_document_default_ui).setOnClickListener {
val genericDocumentConfiguration = DocumentDataExtractorConfiguration()
genericDocumentConfiguration.setTopBarButtonsInactiveColor(
ContextCompat.getColor(this, android.R.color.white)
)
genericDocumentConfiguration.setTopBarBackgroundColor(
findViewById<View>(R.id.data_extractor_default_ui).setOnClickListener {
val configuration = DocumentDataExtractorScreenConfiguration()

configuration.topBar.backgroundColor = ScanbotColor(
ContextCompat.getColor(this, R.color.colorPrimaryDark)
)
genericDocumentConfiguration.setFieldsDisplayConfiguration(
hashMapOf(
DePassport.NormalizedFieldNames.PHOTO to FieldProperties(
"My passport photo",
FieldProperties.DisplayState.AlwaysVisible
),
MRZ.NormalizedFieldNames.CHECK_DIGIT_GENERAL to FieldProperties(
"Check digit general",
FieldProperties.DisplayState.AlwaysVisible
)
)
)
dataExtractorResultLauncher.launch(genericDocumentConfiguration)
dataExtractorResultLauncher.launch(configuration)
}

binding.ehicDefaultUi.setOnClickListener {
Expand All @@ -154,14 +129,8 @@ class MainActivity : AppCompatActivity() {
}

binding.checkRecognizerUi.setOnClickListener {
val config = CheckScannerConfiguration().apply {
setTopBarBackgroundColor(
ContextCompat.getColor(
this@MainActivity,
R.color.colorPrimaryDark
)
)
setTopBarButtonsColor(ContextCompat.getColor(this@MainActivity, R.color.greyColor))
val config = CheckScannerScreenConfiguration().apply {

}

checkScannerResultLauncher.launch(config)
Expand Down Expand Up @@ -191,7 +160,7 @@ class MainActivity : AppCompatActivity() {
if (scanbotSdk.licenseInfo.status != Status.StatusOkay) View.VISIBLE else View.GONE
}

private fun handleGenericDocScannerResult(result: List<DocumentDataExtractionResult>) {
private fun handleGenericDocScannerResult(result: List<DocumentDataExtractorUiResult>) {
result
Toast.makeText(
this,
Expand Down Expand Up @@ -230,11 +199,11 @@ class MainActivity : AppCompatActivity() {
dialogFragment.show(supportFragmentManager, MedicalCertificateResultDialogFragment.NAME)
}

private fun handleCheckScannerResult(result: CheckScanningResult) {
private fun handleCheckScannerResult(result: CheckScannerUiResult) {
showCheckScannerResult(result)
}

private fun showCheckScannerResult(recognitionResult: CheckScanningResult) {
private fun showCheckScannerResult(recognitionResult: CheckScannerUiResult) {
val document = recognitionResult.check?.let { Check(it) } // Convert to the document model
Toast.makeText(this, recognitionResult.toString(), Toast.LENGTH_SHORT).show()
}
Expand Down Expand Up @@ -292,7 +261,7 @@ class MainActivity : AppCompatActivity() {

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

medicalCertificateScannerActivityResultLauncher =
Expand Down
Loading