Bladeren bron

Optimised QRView.kt

flutter-beta
Julian Steenbakker 5 jaren geleden
bovenliggende
commit
56eef31917
Geen bekende sleutel gevonden voor deze handtekening in de database GPG sleutel-ID: 16E437C7A3D94250
1 gewijzigde bestanden met toevoegingen van 4 en 5 verwijderingen
  1. +4
    -5
      android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRView.kt

+ 4
- 5
android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRView.kt Bestand weergeven

@@ -16,7 +16,6 @@ import com.journeyapps.barcodescanner.BarcodeView
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
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.platform.PlatformView import io.flutter.plugin.platform.PlatformView
class QRView(messenger: BinaryMessenger, id: Int, private val context: Context) : class QRView(messenger: BinaryMessenger, id: Int, private val context: Context) :
PlatformView, MethodChannel.MethodCallHandler { PlatformView, MethodChannel.MethodCallHandler {
@@ -82,12 +81,12 @@ class QRView(messenger: BinaryMessenger, id: Int, private val context: Context)
} }
} }


fun flipCamera() {
private fun flipCamera() {
barcodeView?.pause() barcodeView?.pause()
var settings = barcodeView?.cameraSettings
val settings = barcodeView?.cameraSettings


if(settings?.requestedCameraId == CameraInfo.CAMERA_FACING_FRONT) if(settings?.requestedCameraId == CameraInfo.CAMERA_FACING_FRONT)
settings?.requestedCameraId = CameraInfo.CAMERA_FACING_BACK
settings.requestedCameraId = CameraInfo.CAMERA_FACING_BACK
else else
settings?.requestedCameraId = CameraInfo.CAMERA_FACING_FRONT settings?.requestedCameraId = CameraInfo.CAMERA_FACING_FRONT


@@ -133,7 +132,7 @@ class QRView(messenger: BinaryMessenger, id: Int, private val context: Context)
return barcodeView return barcodeView
} }


private fun createBarCodeView(): BarcodeView? {
private fun createBarCodeView(): BarcodeView {
val barcode = BarcodeView(Shared.activity) val barcode = BarcodeView(Shared.activity)
barcode.decodeContinuous( barcode.decodeContinuous(
object : BarcodeCallback { object : BarcodeCallback {


Laden…
Annuleren
Opslaan