update deps; zxing -> zbar

This commit is contained in:
王劲鹏 2019-11-29 18:40:18 +08:00
parent 1b1b9a537f
commit ba4766ca75
4 changed files with 19 additions and 17 deletions

View File

@ -29,5 +29,5 @@ dependencies {
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.1' implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' 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'
} }

View File

@ -38,9 +38,9 @@ dependencies {
implementation "com.google.android.material:material:1.0.0" implementation "com.google.android.material:material:1.0.0"
implementation 'com.squareup.okhttp3:okhttp:4.2.2' implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.google.code.gson:gson:2.8.6' 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 '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' api 'org.greenrobot:eventbus:3.1.1'
implementation 'com.lahm.library:easy-protector-release:1.1.0' implementation 'com.lahm.library:easy-protector-release:1.1.0'
api 'org.nanohttpd:nanohttpd:2.3.1' api 'org.nanohttpd:nanohttpd:2.3.1'

View File

@ -7,43 +7,43 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import cn.bingoogolapple.qrcode.core.QRCodeView; 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.DevKit;
import pub.doric.devkit.DoricDev; import pub.doric.devkit.DoricDev;
import pub.doric.devkit.R; import pub.doric.devkit.R;
public class ScanQRCodeActivity extends AppCompatActivity implements QRCodeView.Delegate { public class ScanQRCodeActivity extends AppCompatActivity implements QRCodeView.Delegate {
private ZXingView mZXingView; private ZBarView mZbarView;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.layout_scan_qrcode); setContentView(R.layout.layout_scan_qrcode);
mZXingView = findViewById(R.id.zxingview); mZbarView = findViewById(R.id.zbar_view);
mZXingView.setDelegate(this); mZbarView.setDelegate(this);
} }
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
mZXingView.startCamera(); mZbarView.startCamera();
mZXingView.startSpotAndShowRect(); mZbarView.startSpotAndShowRect();
} }
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
mZXingView.stopCamera(); mZbarView.stopCamera();
super.onStop(); super.onStop();
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
mZXingView.onDestroy(); mZbarView.onDestroy();
super.onDestroy(); super.onDestroy();
} }
@ -58,16 +58,16 @@ public class ScanQRCodeActivity extends AppCompatActivity implements QRCodeView.
@Override @Override
public void onCameraAmbientBrightnessChanged(boolean isDark) { public void onCameraAmbientBrightnessChanged(boolean isDark) {
String tipText = mZXingView.getScanBoxView().getTipText(); String tipText = mZbarView.getScanBoxView().getTipText();
String ambientBrightnessTip = "\n环境过暗请打开闪光灯"; String ambientBrightnessTip = "\n环境过暗请打开闪光灯";
if (isDark) { if (isDark) {
if (!tipText.contains(ambientBrightnessTip)) { if (!tipText.contains(ambientBrightnessTip)) {
mZXingView.getScanBoxView().setTipText(tipText + ambientBrightnessTip); mZbarView.getScanBoxView().setTipText(tipText + ambientBrightnessTip);
} }
} else { } else {
if (tipText.contains(ambientBrightnessTip)) { if (tipText.contains(ambientBrightnessTip)) {
tipText = tipText.substring(0, tipText.indexOf(ambientBrightnessTip)); tipText = tipText.substring(0, tipText.indexOf(ambientBrightnessTip));
mZXingView.getScanBoxView().setTipText(tipText); mZbarView.getScanBoxView().setTipText(tipText);
} }
} }
} }

View File

@ -4,17 +4,19 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<cn.bingoogolapple.qrcode.zxing.ZXingView <cn.bingoogolapple.qrcode.zbar.ZBarView
android:id="@+id/zxingview" android:id="@+id/zbar_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:qrcv_animTime="1000" app:qrcv_animTime="1000"
app:qrcv_borderColor="@android:color/white" app:qrcv_borderColor="@android:color/white"
app:qrcv_borderSize="1dp" app:qrcv_borderSize="1dp"
app:qrcv_cornerColor="@android:color/white"
app:qrcv_cornerLength="20dp" app:qrcv_cornerLength="20dp"
app:qrcv_cornerSize="3dp" app:qrcv_cornerSize="3dp"
app:qrcv_isShowDefaultScanLineDrawable="true"
app:qrcv_maskColor="#33FFFFFF" app:qrcv_maskColor="#33FFFFFF"
app:qrcv_rectWidth="200dp" app:qrcv_rectWidth="200dp"
app:qrcv_scanLineSize="1dp" app:qrcv_scanLineColor="@android:color/white"
app:qrcv_topOffset="90dp" /> app:qrcv_topOffset="90dp" />
</LinearLayout> </LinearLayout>