Scan Tips
The SDK provides an optional toolbar item within the scanning screen, that when clicked, will open some tips on how to get the best scan result. By default it is activated for photo payment and disabled for document scan and shows some default items. You can customize it according to your needs or disable it completely.
Disable
To disable the scan tips, set the scanTips
property to null.
For Document Scan, the scan tips are disabled by default.
- Photo Payment
import de.docutain.sdk.ui.PhotoPaymentResult
val photoPaymentResult = registerForActivityResult(PhotoPaymentResult()) { result -> }
...
myButton.setOnClickListener {
val scanConfig = PhotoPaymentConfiguration()
scanConfig.scanTips = null
photoPaymentResult.launch(scanConfig)
}
Customize
If you want to provide your own items instead of the default items, you can do that by providing your own list of DocutainListItem
.
Each item consists of an image
, a title
and a message
.
- Document Scan
- Photo Payment
import de.docutain.sdk.ui.ScanResult
val documentScanResult = registerForActivityResult(ScanResult()) { result -> }
...
myButton.setOnClickListener {
val scanConfig = DocumentScannerConfiguration()
scanConfig.scanTips = ScanTips().apply {
items = listOf(
ScanTips.defaultItems[1],
ScanTips.defaultItems[3],
DocutainListItem(R.drawable.image, R.string.title, R.string.message)
)
}
documentScanResult.launch(scanConfig)
}
import de.docutain.sdk.ui.PhotoPaymentResult
val photoPaymentResult = registerForActivityResult(PhotoPaymentResult()) { result -> }
...
myButton.setOnClickListener {
val scanConfig = PhotoPaymentConfiguration()
scanConfig.scanTips = ScanTips().apply {
items = listOf(
ScanTips.defaultItems[1],
ScanTips.defaultItems[3],
DocutainListItem(R.drawable.image, R.string.title, R.string.message)
)
}
photoPaymentResult.launch(scanConfig)
}
The following provides an overview of the currently available options to alter the scanTips
:
Property | Type | Description |
---|---|---|
items | List<DocutainListItem>? | The items you want to show within the scan tips. If you don't provide any items, some default items will be displayed. |
toolbarItem | DocutainButton | The toolbar item that will be shown allowing the user to open the scan tips. |
You can get the default items used by the SDK to use them for your own list.
val scanTipsDefaultItems = ScanTips.defaultItems
The following sample alters the toolbarItem
icon.
- Document Scan
- Photo Payment
import de.docutain.sdk.ui.ScanResult
val documentScanResult = registerForActivityResult(ScanResult()) { result -> }
...
myButton.setOnClickListener {
val scanConfig = DocumentScannerConfiguration()
scanConfig.scanTips = ScanTips().apply {
toolbarItem.icon = R.drawable.icon
}
documentScanResult.launch(scanConfig)
}
import de.docutain.sdk.ui.PhotoPaymentResult
val photoPaymentResult = registerForActivityResult(PhotoPaymentResult()) { result -> }
...
myButton.setOnClickListener {
val scanConfig = PhotoPaymentConfiguration()
scanConfig.scanTips?.toolbarItem?.icon = R.drawable.icon
photoPaymentResult.launch(scanConfig)
}