Skip to content

Commit

Permalink
Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-budiyev committed Apr 28, 2018
1 parent cc883bb commit 9c2070e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ class MainActivity : AppCompatActivity() {
val scannerView = findViewById<CodeScannerView>(R.id.scanner_view)

codeScanner = CodeScanner(this, scannerView)

// Parameters (default values)
codeScanner.camera = CodeScanner.CAMERA_BACK // or CAMERA_FRONT or specific camera id
codeScanner.formats = CodeScanner.ALL_FORMATS // list of type BarcodeFormat
codeScanner.formats = CodeScanner.ALL_FORMATS // list of type BarcodeFormat,
// ex. listOf(BarcodeFormat.QR_CODE)
codeScanner.autoFocusMode = AutoFocusMode.SAFE // or CONTINUOUS
codeScanner.scanMode = ScanMode.SINGLE // or CONTINUOUS or PREVIEW
codeScanner.isAutoFocusEnabled = true // Whether to enable auto focus or not
codeScanner.isFlashEnabled = false // Whether to enable flash or not

// Callbacks
codeScanner.decodeCallback = DecodeCallback {
runOnUiThread {
Expand All @@ -89,7 +92,8 @@ class MainActivity : AppCompatActivity() {
}
codeScanner.errorCallback = ErrorCallback {
runOnUiThread {
Toast.makeText(this, "Camera initialization error: " + it.message, Toast.LENGTH_LONG).show()
Toast.makeText(this, "Camera initialization error: " + it.message,
Toast.LENGTH_LONG).show()
}
}

Expand Down

0 comments on commit 9c2070e

Please sign in to comment.