android-components / mozilla.components.feature.qr / QrFeature

QrFeature

class QrFeature : LifecycleAwareFeature, BackHandler, PermissionsFeature (source)

Feature implementation that provides QR scanning functionality via the QrFragment.

Constructors

Name Summary
<init> QrFeature(context: <ERROR CLASS>, fragmentManager: FragmentManager, onScanResult: OnScanResult = { }, onNeedToRequestPermissions: OnNeedToRequestPermissions = { })
Feature implementation that provides QR scanning functionality via the QrFragment.

Properties

Name Summary
onNeedToRequestPermissions val onNeedToRequestPermissions: OnNeedToRequestPermissions
a callback invoked when permissions need to be requested before a QR scan can be performed. Once the request is completed, onPermissionsResult needs to be invoked. This feature will request android.Manifest.permission.CAMERA.

Functions

Name Summary
onBackPressed fun onBackPressed(): Boolean
Called when this BackHandler gets the option to handle the user pressing the back key.
onPermissionsResult fun onPermissionsResult(permissions: Array<String>, grantResults: IntArray): Unit
Notifies the feature that the permission request was completed. If the requested permissions were granted it will open the QR scanner.
scan fun scan(containerViewId: Int = android.R.id.content): Boolean
Starts the QR scanner fragment and listens for scan results.
start fun start(): Unit
stop fun stop(): Unit