ScanFragment

open class ScanFragment : Fragment

Fragment managing the access to the camera and holding a preview.

The parent activity or fragment must implement the CameraCallbackProvider interface. The parent component also needs to initialize the camera by calling initializeCamera, usually in the onResume() method, after making sure the permission to use the camera has been granted.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
interface Callback
Link copied to clipboard
Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val availableFlashModes: <Error class: unknown class>

Supported FlashMode.

Functions

Link copied to clipboard
open fun initializeCamera()

Setup the camera and start the preview. This needs to be called by the parent activity in Activity#onResume().

Link copied to clipboard
open override fun onAttach(context: Context)
Link copied to clipboard
open override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View
Link copied to clipboard
open override fun onDestroy()
Link copied to clipboard
open override fun onPause()
Link copied to clipboard
open override fun onViewCreated(view: View, savedInstanceState: Bundle?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Set a callback to receive barcode detection events.

Link copied to clipboard

Sets the listener receiving real-time border detection updates on the main thread.

Link copied to clipboard
Link copied to clipboard
open fun setFlashMode(flashMode: FlashMode)

Set the camera flash mode. It's best to call .a to make sure that the camera supports this flash mode.

Link copied to clipboard
open fun setFocusIndicator(focusIndicator: FocusIndicator?)
Link copied to clipboard
open fun setJpegQuality(@IntRange(from = 0,to = 100) jpegQuality: Int)

Sets the JPEG quality of camera output pictures. This method can only be called when the camera is ready.

Link copied to clipboard
open fun setOverlayColor(colorResId: Int)
Link copied to clipboard
open fun setOverlayColorResource(@ColorRes colorResId: Int)
Link copied to clipboard
open fun setPreviewAspectFill(isAspectFill: Boolean)
Link copied to clipboard
open fun setPreviewEnabled(enabled: Boolean)
Link copied to clipboard
Link copied to clipboard

Stop the real-time border detection and capture the image The provided callback is invoked on the main thread.

Link copied to clipboard

Toggles the flash mode to the next available flash mode. It's best to call availableFlashModes to make sure that the camera supports this flash mode.