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


class QrFeature : LifecycleAwareFeature, UserInteractionHandler, PermissionsFeature (source)

Feature implementation that provides QR scanning functionality via the QrFragment.


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


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.


Name Summary
onBackPressed fun onBackPressed(): Boolean
Called when this UserInteractionHandler 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 = Boolean
Starts the QR scanner fragment and listens for scan results.
start fun start(): Unit
stop fun stop(): Unit

Inherited Functions

Name Summary
onHomePressed open fun onHomePressed(): Boolean
In most cases, when the home button is pressed, we invoke this callback to inform the app that the user is going to leave the app.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.