| @@ -27,7 +27,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| private var isTorchOn: Boolean = false | private var isTorchOn: Boolean = false | ||||
| private var isPaused: Boolean = false | private var isPaused: Boolean = false | ||||
| private var barcodeView: DecoratedBarcodeView? = null | |||||
| private var barcodeView: BarcodeView? = null | |||||
| private val channel: MethodChannel = MethodChannel(messenger, "net.touchcapture.qr.flutterqr/qrview_$id") | private val channel: MethodChannel = MethodChannel(messenger, "net.touchcapture.qr.flutterqr/qrview_$id") | ||||
| private var permissionGranted: Boolean = false | private var permissionGranted: Boolean = false | ||||
| @@ -135,7 +135,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| } | } | ||||
| if (hasFlash()) { | if (hasFlash()) { | ||||
| barcodeView!!.barcodeView.setTorch(!isTorchOn) | |||||
| barcodeView!!.setTorch(!isTorchOn) | |||||
| isTorchOn = !isTorchOn | isTorchOn = !isTorchOn | ||||
| result.success(isTorchOn) | result.success(isTorchOn) | ||||
| } else { | } else { | ||||
| @@ -148,7 +148,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| if (barcodeView == null) { | if (barcodeView == null) { | ||||
| return barCodeViewNotSet(result) | return barCodeViewNotSet(result) | ||||
| } else { | } else { | ||||
| if (barcodeView!!.barcodeView.isPreviewActive) { | |||||
| if (barcodeView!!.isPreviewActive) { | |||||
| isPaused = true | isPaused = true | ||||
| barcodeView!!.pause() | barcodeView!!.pause() | ||||
| } | } | ||||
| @@ -160,7 +160,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| if (barcodeView == null) { | if (barcodeView == null) { | ||||
| return barCodeViewNotSet(result) | return barCodeViewNotSet(result) | ||||
| } else { | } else { | ||||
| if (!barcodeView!!.barcodeView.isPreviewActive) { | |||||
| if (!barcodeView!!.isPreviewActive) { | |||||
| isPaused = false | isPaused = false | ||||
| barcodeView!!.resume() | barcodeView!!.resume() | ||||
| } | } | ||||
| @@ -193,9 +193,9 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| return initBarCodeView().apply {}!! | return initBarCodeView().apply {}!! | ||||
| } | } | ||||
| private fun initBarCodeView(): DecoratedBarcodeView? { | |||||
| private fun initBarCodeView(): BarcodeView? { | |||||
| if (barcodeView == null) { | if (barcodeView == null) { | ||||
| barcodeView = DecoratedBarcodeView(Shared.activity) | |||||
| barcodeView = BarcodeView(Shared.activity) | |||||
| if (params["cameraFacing"] as Int == 1) { | if (params["cameraFacing"] as Int == 1) { | ||||
| barcodeView?.cameraSettings?.requestedCameraId = CameraInfo.CAMERA_FACING_FRONT | barcodeView?.cameraSettings?.requestedCameraId = CameraInfo.CAMERA_FACING_FRONT | ||||
| } | } | ||||
| @@ -236,7 +236,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| } | } | ||||
| private fun stopScan() { | private fun stopScan() { | ||||
| barcodeView?.barcodeView?.stopDecoding() | |||||
| barcodeView?.stopDecoding() | |||||
| } | } | ||||
| private fun getSystemFeatures(result: MethodChannel.Result) { | private fun getSystemFeatures(result: MethodChannel.Result) { | ||||
| @@ -255,7 +255,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| } | } | ||||
| private fun setScanAreaSize(dpScanAreaWidth: Double, dpScanAreaHeight: Double) { | private fun setScanAreaSize(dpScanAreaWidth: Double, dpScanAreaHeight: Double) { | ||||
| barcodeView?.barcodeView?.framingRectSize = Size(convertDpToPixels(dpScanAreaWidth), convertDpToPixels(dpScanAreaHeight)) | |||||
| barcodeView?.framingRectSize = Size(convertDpToPixels(dpScanAreaWidth), convertDpToPixels(dpScanAreaHeight)) | |||||
| } | } | ||||
| private fun convertDpToPixels(dp: Double) = (dp * barcodeView!!.context.resources.displayMetrics.density).toInt() | private fun convertDpToPixels(dp: Double) = (dp * barcodeView!!.context.resources.displayMetrics.density).toInt() | ||||