| @@ -13,6 +13,7 @@ import com.google.zxing.ResultPoint | |||||
| import com.journeyapps.barcodescanner.BarcodeCallback | import com.journeyapps.barcodescanner.BarcodeCallback | ||||
| import com.journeyapps.barcodescanner.BarcodeResult | import com.journeyapps.barcodescanner.BarcodeResult | ||||
| import com.journeyapps.barcodescanner.BarcodeView | import com.journeyapps.barcodescanner.BarcodeView | ||||
| import com.journeyapps.barcodescanner.DecoratedBarcodeView | |||||
| import io.flutter.plugin.common.BinaryMessenger | import io.flutter.plugin.common.BinaryMessenger | ||||
| import io.flutter.plugin.common.MethodCall | import io.flutter.plugin.common.MethodCall | ||||
| import io.flutter.plugin.common.MethodChannel | import io.flutter.plugin.common.MethodChannel | ||||
| @@ -25,7 +26,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: BarcodeView? = null | |||||
| private var barcodeView: DecoratedBarcodeView? = 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 | ||||
| @@ -132,7 +133,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| } | } | ||||
| if (hasFlash()) { | if (hasFlash()) { | ||||
| barcodeView!!.setTorch(!isTorchOn) | |||||
| barcodeView!!.barcodeView.setTorch(!isTorchOn) | |||||
| isTorchOn = !isTorchOn | isTorchOn = !isTorchOn | ||||
| result.success(isTorchOn) | result.success(isTorchOn) | ||||
| } else { | } else { | ||||
| @@ -145,7 +146,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!!.isPreviewActive) { | |||||
| if (barcodeView!!.barcodeView.isPreviewActive) { | |||||
| isPaused = true | isPaused = true | ||||
| barcodeView!!.pause() | barcodeView!!.pause() | ||||
| } | } | ||||
| @@ -157,7 +158,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!!.isPreviewActive) { | |||||
| if (!barcodeView!!.barcodeView.isPreviewActive) { | |||||
| isPaused = false | isPaused = false | ||||
| barcodeView!!.resume() | barcodeView!!.resume() | ||||
| } | } | ||||
| @@ -190,9 +191,9 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| return initBarCodeView().apply {}!! | return initBarCodeView().apply {}!! | ||||
| } | } | ||||
| private fun initBarCodeView(): BarcodeView? { | |||||
| private fun initBarCodeView(): DecoratedBarcodeView? { | |||||
| if (barcodeView == null) { | if (barcodeView == null) { | ||||
| barcodeView = BarcodeView(Shared.activity) | |||||
| barcodeView = DecoratedBarcodeView(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 | ||||
| } | } | ||||
| @@ -233,7 +234,7 @@ class QRView(messenger: BinaryMessenger,private val id: Int, private val params: | |||||
| } | } | ||||
| private fun stopScan() { | private fun stopScan() { | ||||
| barcodeView?.stopDecoding() | |||||
| barcodeView?.barcodeView?.stopDecoding() | |||||
| } | } | ||||
| private fun getSystemFeatures(result: MethodChannel.Result) { | private fun getSystemFeatures(result: MethodChannel.Result) { | ||||