ReadHandler Interface
interface ReadHandler
What a recognition screen needs from its host: the page to recognise, the progress to show, and where the resulting text is kept.
Implement it on your view model and hand it to the recognition surface.
Types
ConfirmRestore
interface ConfirmRestore
Asks the user to confirm discarding their edits and going back to the recognised text.
Properties
lookupProgress
abstract val lookupProgress: Flow<Int>
How far recognition has got: -1 while the image is being analysed, then 0 to 100 as words are recognised.
lookupRect
abstract val lookupRect: Flow<ImageRect?>
The region currently being recognised, for highlighting it, or null once recognition has finished.
modifiedText
abstract val modifiedText: Flow<ScanText>
The text as the user has edited it.
originalText
abstract val originalText: Flow<ScanText>
The text as recognised, before the user edits it.
picture
abstract val picture: Flow<ScanPicture?>
The page to show and recognise.
Functions
onCancel
abstract fun onCancel()
Called when the user cancels recognition.
onConfirmRestore
abstract fun onConfirmRestore(confirmRestore: ReadHandler.ConfirmRestore)
Called when the user asks to discard their edits.
onModifiedTextChanged
abstract fun onModifiedTextChanged(modifiedText: ScanText)
Called when the user edits the text, so the host can save it.
onPictureReady
abstract fun onPictureReady(pictureReady: Boolean)
Called once the page is on screen.