From ba4766ca7508b7603983f416d3b4d0154092a836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Fri, 29 Nov 2019 18:40:18 +0800 Subject: [PATCH] update deps; zxing -> zbar --- Android/app/build.gradle | 2 +- Android/devkit/build.gradle | 4 ++-- .../doric/devkit/ui/ScanQRCodeActivity.java | 22 +++++++++---------- .../main/res/layout/layout_scan_qrcode.xml | 8 ++++--- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Android/app/build.gradle b/Android/app/build.gradle index 30ec9d1a..3f2fb663 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -29,5 +29,5 @@ dependencies { implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-4' + debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-5' } diff --git a/Android/devkit/build.gradle b/Android/devkit/build.gradle index e24a2d60..76882f07 100644 --- a/Android/devkit/build.gradle +++ b/Android/devkit/build.gradle @@ -38,9 +38,9 @@ dependencies { implementation "com.google.android.material:material:1.0.0" implementation 'com.squareup.okhttp3:okhttp:4.2.2' implementation 'com.google.code.gson:gson:2.8.6' - implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7' + implementation 'cn.bingoogolapple:bga-qrcode-zbar:1.3.7' implementation 'com.github.tbruyelle:rxpermissions:0.10.2' - implementation "io.reactivex.rxjava2:rxjava:2.2.14" + implementation "io.reactivex.rxjava2:rxjava:2.2.15" api 'org.greenrobot:eventbus:3.1.1' implementation 'com.lahm.library:easy-protector-release:1.1.0' api 'org.nanohttpd:nanohttpd:2.3.1' diff --git a/Android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java b/Android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java index 0079b418..21547411 100644 --- a/Android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java +++ b/Android/devkit/src/main/java/pub/doric/devkit/ui/ScanQRCodeActivity.java @@ -7,43 +7,43 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import cn.bingoogolapple.qrcode.core.QRCodeView; -import cn.bingoogolapple.qrcode.zxing.ZXingView; +import cn.bingoogolapple.qrcode.zbar.ZBarView; import pub.doric.devkit.DevKit; import pub.doric.devkit.DoricDev; import pub.doric.devkit.R; public class ScanQRCodeActivity extends AppCompatActivity implements QRCodeView.Delegate { - private ZXingView mZXingView; + private ZBarView mZbarView; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_scan_qrcode); - mZXingView = findViewById(R.id.zxingview); - mZXingView.setDelegate(this); + mZbarView = findViewById(R.id.zbar_view); + mZbarView.setDelegate(this); } @Override protected void onStart() { super.onStart(); - mZXingView.startCamera(); - mZXingView.startSpotAndShowRect(); + mZbarView.startCamera(); + mZbarView.startSpotAndShowRect(); } @Override protected void onStop() { super.onStop(); - mZXingView.stopCamera(); + mZbarView.stopCamera(); super.onStop(); } @Override protected void onDestroy() { - mZXingView.onDestroy(); + mZbarView.onDestroy(); super.onDestroy(); } @@ -58,16 +58,16 @@ public class ScanQRCodeActivity extends AppCompatActivity implements QRCodeView. @Override public void onCameraAmbientBrightnessChanged(boolean isDark) { - String tipText = mZXingView.getScanBoxView().getTipText(); + String tipText = mZbarView.getScanBoxView().getTipText(); String ambientBrightnessTip = "\n环境过暗,请打开闪光灯"; if (isDark) { if (!tipText.contains(ambientBrightnessTip)) { - mZXingView.getScanBoxView().setTipText(tipText + ambientBrightnessTip); + mZbarView.getScanBoxView().setTipText(tipText + ambientBrightnessTip); } } else { if (tipText.contains(ambientBrightnessTip)) { tipText = tipText.substring(0, tipText.indexOf(ambientBrightnessTip)); - mZXingView.getScanBoxView().setTipText(tipText); + mZbarView.getScanBoxView().setTipText(tipText); } } } diff --git a/Android/devkit/src/main/res/layout/layout_scan_qrcode.xml b/Android/devkit/src/main/res/layout/layout_scan_qrcode.xml index 7511b4f9..8bf17883 100644 --- a/Android/devkit/src/main/res/layout/layout_scan_qrcode.xml +++ b/Android/devkit/src/main/res/layout/layout_scan_qrcode.xml @@ -4,17 +4,19 @@ android:layout_width="match_parent" android:layout_height="match_parent"> -