-
Notifications
You must be signed in to change notification settings - Fork 5
Camera Helper
farimarwat edited this page Sep 9, 2023
·
7 revisions
CameraHelper by Document Scanner provides functionality of taking pictures either full or any card size. It shows a rectangle on previewview in case of ID Card capture. Below are the full documentation of CameraHelper by Document Scanner.
implementation 'io.github.farimarwat.camerahelper:1.0'
val intent = Intent(mContext,CameraActivity::class.java)
startActivity(intent)
Set a Camera listener and get resulted bitmaps
CameraActivity.setCameraListener(object :CameraListener{
override fun onCaptured(image: Bitmap?) {
//This method is called on each capture.
//Any one can also play a sound e.g. camera sound here
}
override fun onCaptureCompleted(list: List<Bitmap>) {
// This method is called after successfully capture completed.
//For example, it is called after taking both sides of ID Card,
//in case of taking both sides (front, back)
}
override fun onError(error: String) {
Timber.e("Error: ${error}")
} })
- This method is used to set Card size. There are three different sizes already available but any one can pass a custom size e.g., ("1:1") Default Sizes:
CameraActivity.ID_CARD_SQUARE
CameraActivity.ID_CARD_DEFAULT
CameraActivity.ID_CARD_LARGE`
Example:
CameraActivity.setCardSize(CameraActivity.ID_CARD_DEFAULT)
Custom Example:
CameraActivity.setCardSize("9:16")
- This method is used to determine if task is to take front and backside or single side.
CameraActivity.setIsDoubleSide(true) //Default is true
- To determine if task is to take cropped picture and show frame or not.
CameraActivity.setIsCropped(false) // Default is true
- To set Frame borders.
CameraActivity.setRectBorder(drawable)
- To change camera capture icon.
CameraActivity.setCaptureIcon(drawable)
- To set camera switch icon.
CameraActivity.setSwitchIcon(drawable)