From 9957b29426dc53acfd0901dc71e8281228663ba0 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 11 Jun 2019 19:17:54 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/qrcode/QrCodeActivity.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt b/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt index d3dc1e9c8..ad9019228 100644 --- a/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt +++ b/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt @@ -58,19 +58,19 @@ class QrCodeActivity : BaseActivity(), QRCodeView.Delegate { override fun onStart() { super.onStart() + startCamera() + } + + private fun startCamera() { PermissionsCompat.Builder(this) .addPermissions(*Permissions.Group.CAMERA) .rationale(R.string.qr_per) .onGranted { - startCamera() + zxingview.startCamera() // 打开后置摄像头开始预览,但是并未开始识别 + zxingview.startSpotAndShowRect() // 显示扫描框,并开始识别 }.request() } - private fun startCamera() { - zxingview.startCamera() // 打开后置摄像头开始预览,但是并未开始识别 - zxingview.startSpotAndShowRect() // 显示扫描框,并开始识别 - } - override fun onStop() { zxingview.stopCamera() // 关闭摄像头预览,并且隐藏扫描框 super.onStop()