File tree Expand file tree Collapse file tree
java/me/devilsen/czxing/camera Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ C++ port of ZXing for Android
99### 使用
1010在gradle中:
1111``` groovy
12- implementation 'me.devilsen:CZXing:0.9.6 '
12+ implementation 'me.devilsen:CZXing:0.9.7 '
1313```
1414建议加入abiFilters
1515``` gradle
@@ -37,6 +37,10 @@ Scanner.with(this)
3737 .setScanMode(ScanView . SCAN_MODE_TINY ) // 扫描区域
3838 .setTitle(" My Scan View" ) // 扫码界面标题
3939 .showAlbum(true ) // 显示相册(默认为true)
40+ .setBarcodeFormat(BarcodeFormat . EAN_13 ) // 设置扫码格式
41+ .setScanNoticeText(" 扫描二维码" ) // 设置扫码文字提示
42+ .setFlashLightOnText(" 打开闪光灯" ) // 打开闪光灯提示
43+ .setFlashLightOffText(" 关闭闪光灯" ) // 关闭闪光灯提示
4044 .continuousScan() // 连续扫码,不关闭扫码界面
4145 .setOnClickAlbumDelegate(new ScanActivityDelegate .OnClickAlbumDelegate () {
4246 @Override
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ android {
66 defaultConfig {
77 minSdkVersion rootProject. ext. minSdkVersion
88 targetSdkVersion rootProject. ext. targetSdkVersion
9- versionCode 19
10- versionName " 0.9.6 "
9+ versionCode 20
10+ versionName " 0.9.7 "
1111
1212 externalNativeBuild {
1313 cmake {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ include_directories(zxing)
1414include_directories (include )
1515#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI}")
1616
17- # add_compile_options(czxing "-O1" "-fPIC")
17+ add_compile_options (czxing "-O1" "-fPIC" )
1818
1919# 静态方式导入库
2020add_library (opencv_core STATIC IMPORTED )
@@ -36,10 +36,10 @@ set_target_properties(tegra_hal PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}
3636#set_target_properties(opencv_java4 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libopencv_java4.so)
3737
3838# 导入zbar
39- # add_library(iconv SHARED IMPORTED)
40- add_library (zbar_croe SHARED IMPORTED )
41- # set_target_properties(iconv PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../../../libs/${ANDROID_ABI}/libiconv.so)
42- set_target_properties (zbar_croe PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR } /../../../libs/${ANDROID_ABI} /libzbarjni.so)
39+ add_library (iconv SHARED IMPORTED )
40+ add_library (zbar_core SHARED IMPORTED )
41+ set_target_properties (iconv PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR } /../../../libs/${ANDROID_ABI} /libiconv.so)
42+ set_target_properties (zbar_core PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR } /../../../libs/${ANDROID_ABI} /libzbarjni.so)
4343
4444find_library (
4545 log -lib
@@ -49,8 +49,8 @@ target_link_libraries(
4949 czxing
5050 ZXingCore
5151
52- # iconv
53- zbar_croe
52+ iconv
53+ zbar_core
5454
5555 opencv_imgproc
5656 opencv_core
Original file line number Diff line number Diff line change 2323public class CameraSurface extends SurfaceView implements SensorController .CameraFocusListener ,
2424 SurfaceHolder .Callback {
2525
26+ private static final long ONE_SECOND = 1000 ;
2627 private Camera mCamera ;
2728
2829 private float mOldDist = 1f ;
@@ -33,6 +34,7 @@ public class CameraSurface extends SurfaceView implements SensorController.Camer
3334 private boolean mZoomOutFlag ;
3435
3536 private Point focusCenter ;
37+ private long mLastFrozenTime ;
3638 private long mLastTouchTime ;
3739 private SensorController mSensorController ;
3840 private CameraConfigurationManager mCameraConfigurationManager ;
@@ -214,7 +216,13 @@ private void doubleTap() {
214216 */
215217 @ Override
216218 public void onFrozen () {
217- BarCodeUtil .d ("mCamera is frozen, start focus x = " + focusCenter .x + " y = " + focusCenter .y );
219+ long now = System .currentTimeMillis ();
220+ if (now - mLastFrozenTime < ONE_SECOND ) {
221+ return ;
222+ }
223+ mLastFrozenTime = now ;
224+
225+ BarCodeUtil .d ("mCamera is frozen, start focus x = " + focusCenter .x + " y = " + focusCenter .y );
218226 handleFocus (focusCenter .x , focusCenter .y );
219227 }
220228
Original file line number Diff line number Diff line change @@ -48,8 +48,8 @@ android {
4848dependencies {
4949
5050 debugImplementation ' com.squareup.leakcanary:leakcanary-android:2.0-beta-3'
51- implementation project(' :czxing' )
52- // implementation 'me.devilsen:CZXing:0.9.6 '
51+ // implementation project(':czxing')
52+ implementation ' me.devilsen:CZXing:0.9.7 '
5353
5454 implementation rootProject. ext. appcompat
5555 testImplementation rootProject. ext. junit
You can’t perform that action at this time.
0 commit comments