Skip to content

Commit 5774a41

Browse files
committed
发布v3.2.0
1 parent 78b59b2 commit 5774a41

23 files changed

+232
-153
lines changed

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ ZXingLite for Android 是ZXing的精简极速版,基于ZXing库优化扫码和
3535
2. 在Module的 **build.gradle** 里面添加引入依赖项
3636
3737
```gradle
38-
// AndroidX 版本
39-
implementation 'com.github.jenly1314:zxing-lite:3.1.1'
38+
implementation 'com.github.jenly1314:zxing-lite:3.2.0'
4039
4140
```
4241
@@ -202,6 +201,11 @@ dependencies {
202201

203202
## 版本记录
204203

204+
#### v3.2.0:2024-07-16
205+
* 更新CameraScan至v1.2.0
206+
* 更新ViewfinderView至v1.2.0
207+
* 优化细节
208+
205209
#### v3.1.1:2024-04-29
206210
* 更新CameraScan至v1.1.1
207211
* 更新zxing至v3.5.3

app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ android {
2525
}
2626
compileOptions {
2727
coreLibraryDesugaringEnabled true
28-
sourceCompatibility JavaVersion.VERSION_11
29-
targetCompatibility JavaVersion.VERSION_11
28+
sourceCompatibility JavaVersion.VERSION_1_8
29+
targetCompatibility JavaVersion.VERSION_1_8
3030
}
3131
kotlinOptions {
32-
jvmTarget = JavaVersion.VERSION_11.toString()
32+
jvmTarget = JavaVersion.VERSION_1_8.toString()
3333
}
3434
lintOptions {
3535
abortOnError false

app/release/app-release.apk

11.4 KB
Binary file not shown.

app/release/output-metadata.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"attributes": [],
14-
"versionCode": 41,
15-
"versionName": "3.1.1",
14+
"versionCode": 42,
15+
"versionName": "3.2.0",
1616
"outputFile": "app-release.apk"
1717
}
1818
],

app/src/main/java/com/king/zxing/app/CodeActivity.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333

3434
/**
3535
* 生成条形码/二维码示例
36-
* @author Jenly <a href="mailto:[email protected]">Jenly</a>
36+
*
37+
* @author <a href="mailto:[email protected]">Jenly</a>
38+
* <p>
39+
* <a href="https://github.com/jenly1314">Follow me</a>
3740
*/
3841
public class CodeActivity extends AppCompatActivity {
3942

app/src/main/java/com/king/zxing/app/FullScreenQRCodeScanActivity.kt

+3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import com.king.zxing.analyze.QRCodeAnalyzer
1616

1717
/**
1818
* 扫二维码全屏识别示例
19+
*
1920
* @author <a href="mailto:[email protected]">Jenly</a>
21+
* <p>
22+
* <a href="https://github.com/jenly1314">Follow me</a>
2023
*/
2124
class FullScreenQRCodeScanActivity : BarcodeCameraScanActivity() {
2225

app/src/main/java/com/king/zxing/app/MainActivity.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import android.graphics.Bitmap;
2020
import android.os.Bundle;
2121
import android.provider.MediaStore;
22+
import android.util.Log;
2223
import android.view.View;
2324
import android.widget.Button;
2425
import android.widget.Toast;
@@ -28,17 +29,21 @@
2829
import androidx.core.app.ActivityOptionsCompat;
2930

3031
import com.king.camera.scan.CameraScan;
31-
import com.king.camera.scan.util.LogUtils;
3232
import com.king.zxing.util.CodeUtils;
3333

3434
import java.util.concurrent.ExecutorService;
3535
import java.util.concurrent.Executors;
3636

3737
/**
3838
* 扫码示例
39+
*
40+
* @author <a href="mailto:[email protected]">Jenly</a>
41+
* <p>
42+
* <a href="https://github.com/jenly1314">Follow me</a>
3943
*/
4044
public class MainActivity extends AppCompatActivity {
4145

46+
private static final String TAG = "MainActivity";
4247
public static final String KEY_TITLE = "key_title";
4348
public static final String KEY_IS_QR_CODE = "key_code";
4449

@@ -88,8 +93,10 @@ private void parsePhoto(Intent data) {
8893
//异步解析
8994
asyncThread(() -> {
9095
final String result = CodeUtils.parseCode(bitmap);
96+
// 如果只需识别二维码,建议使用:parseQRCode;(因为识别的格式越明确,误识别率越低。)
97+
// final String result = CodeUtils.parseQRCode(bitmap);
9198
runOnUiThread(() -> {
92-
LogUtils.d("result:" + result);
99+
Log.d(TAG, "result:" + result);
93100
showToast(result);
94101
});
95102

app/src/main/java/com/king/zxing/app/MultiFormatScanActivity.kt

+3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import com.king.zxing.analyze.MultiFormatAnalyzer
1111

1212
/**
1313
* 连续扫码(识别多种格式)示例
14+
*
1415
* @author <a href="mailto:[email protected]">Jenly</a>
16+
* <p>
17+
* <a href="https://github.com/jenly1314">Follow me</a>
1518
*/
1619
class MultiFormatScanActivity : BarcodeCameraScanActivity() {
1720

app/src/main/java/com/king/zxing/app/QRCodeScanActivity.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
import com.king.zxing.DecodeConfig;
1111
import com.king.zxing.DecodeFormatManager;
1212
import com.king.zxing.BarcodeCameraScanActivity;
13+
import com.king.zxing.analyze.MultiFormatAnalyzer;
1314
import com.king.zxing.analyze.QRCodeAnalyzer;
1415

1516
import androidx.annotation.NonNull;
1617
import androidx.annotation.Nullable;
1718

1819
/**
1920
* 扫二维码识别示例
21+
*
2022
* @author <a href="mailto:[email protected]">Jenly</a>
23+
* <p>
24+
* <a href="https://github.com/jenly1314">Follow me</a>
2125
*/
2226
public class QRCodeScanActivity extends BarcodeCameraScanActivity {
2327

@@ -38,8 +42,8 @@ public Analyzer<Result> createAnalyzer() {
3842
.setAreaRectRatio(0.8f)//设置识别区域比例,默认0.8,设置的比例最终会在预览区域裁剪基于此比例的一个矩形进行扫码识别
3943
.setAreaRectVerticalOffset(0)//设置识别区域垂直方向偏移量,默认为0,为0表示居中,可以为负数
4044
.setAreaRectHorizontalOffset(0);//设置识别区域水平方向偏移量,默认为0,为0表示居中,可以为负数
41-
// BarcodeCameraScanActivity默认使用的MultiFormatAnalyzer,这里可以改为使用QRCodeAnalyzer
42-
return new QRCodeAnalyzer(decodeConfig);
45+
// BarcodeCameraScanActivity默认使用的MultiFormatAnalyzer,这里也可以改为使用QRCodeAnalyzer
46+
return new MultiFormatAnalyzer(decodeConfig);
4347
}
4448

4549
/**

change_log.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## 版本记录
22

3+
#### v3.2.0:2024-07-16
4+
* 更新CameraScan至v1.2.0
5+
* 更新ViewfinderView至v1.2.0
6+
* 优化细节
7+
38
#### v3.1.1:2024-04-29
49
* 更新CameraScan至v1.1.1
510
* 更新zxing至v3.5.3

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ android.defaults.buildfeatures.buildconfig=true
1818
android.nonTransitiveRClass=false
1919
android.nonFinalResIds=false
2020

21-
VERSION_NAME=3.1.1
22-
VERSION_CODE=41
21+
VERSION_NAME=3.2.0
22+
VERSION_CODE=42
2323
GROUP=com.github.jenly1314
2424

2525
POM_DESCRIPTION=ZXingLite for Android

versions.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// App
22
def app_version = [:]
3-
app_version.versionCode = 41
4-
app_version.versionName = "3.1.1"
3+
app_version.versionCode = 42
4+
app_version.versionName = "3.2.0"
55
ext.app_version = app_version
66

77
// build version
@@ -50,9 +50,9 @@ deps.test = test
5050
deps.zxing = "com.google.zxing:core:3.5.3"
5151

5252
// CameraScan
53-
deps.camera_scan = "com.github.jenly1314:camera-scan:1.1.1"
53+
deps.camera_scan = "com.github.jenly1314:camera-scan:1.2.0"
5454
// ViewfinderView
55-
deps.viewfinderview = "com.github.jenly1314:viewfinderview:1.1.0"
55+
deps.viewfinderview = "com.github.jenly1314:viewfinderview:1.2.0"
5656

5757
// desugar_jdk
5858
deps.desugar_jdk = "com.android.tools:desugar_jdk_libs:1.2.3"

zxing-lite/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ android {
2424

2525
compileOptions {
2626
coreLibraryDesugaringEnabled true
27-
sourceCompatibility JavaVersion.VERSION_11
28-
targetCompatibility JavaVersion.VERSION_11
27+
sourceCompatibility JavaVersion.VERSION_1_8
28+
targetCompatibility JavaVersion.VERSION_1_8
2929
}
3030

3131
lintOptions {

zxing-lite/src/main/java/com/king/zxing/BarcodeCameraScanActivity.java

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* 通过继承 {@link BarcodeCameraScanActivity}或{@link BarcodeCameraScanFragment}可快速实现扫码识别
1717
*
1818
* @author <a href="mailto:[email protected]">Jenly</a>
19+
* <p>
20+
* <a href="https://github.com/jenly1314">Follow me</a>
1921
*/
2022
public abstract class BarcodeCameraScanActivity extends BaseCameraScanActivity<Result> {
2123

zxing-lite/src/main/java/com/king/zxing/BarcodeCameraScanFragment.java

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* 通过继承 {@link BarcodeCameraScanActivity}或{@link BarcodeCameraScanFragment}可快速实现扫码识别
1717
*
1818
* @author <a href="mailto:[email protected]">Jenly</a>
19+
* <p>
20+
* <a href="https://github.com/jenly1314">Follow me</a>
1921
*/
2022
public abstract class BarcodeCameraScanFragment extends BaseCameraScanFragment<Result> {
2123

zxing-lite/src/main/java/com/king/zxing/DecodeConfig.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
import android.graphics.Rect;
44

5+
import androidx.annotation.FloatRange;
6+
import androidx.annotation.NonNull;
7+
58
import com.google.zxing.BarcodeFormat;
69
import com.google.zxing.DecodeHintType;
710
import com.google.zxing.common.GlobalHistogramBinarizer;
811
import com.google.zxing.common.HybridBinarizer;
912

1013
import java.util.Map;
1114

12-
import androidx.annotation.FloatRange;
13-
1415
/**
1516
* 解码配置:主要用于在扫码识别时,提供一些配置,便于扩展。通过配置可决定内置分析器的能力,从而间接的控制并简化扫码识别的流程
1617
* <p></>
@@ -25,7 +26,6 @@
2526
* {@link DecodeFormatManager#DEFAULT_HINTS}
2627
* <p>
2728
*
28-
* @author <a href="mailto:[email protected]">Jenly</a>
2929
* <p>
3030
* 如果不满足您也可以通过{@link DecodeFormatManager#createDecodeHints(BarcodeFormat...)}自己配置支持的格式
3131
*
@@ -38,7 +38,11 @@
3838
* 因为{@link androidx.camera.view.PreviewView}的预览区域是经过裁剪的,所以这里的区域并不是用户所能预览到的区域,而是指Camera预览的真实区域,
3939
* <p>
4040
* 即判定区域分析的优先级顺序为:{@link #setFullAreaScan(boolean)} -> {@link #setAnalyzeAreaRect(Rect)} -> {@link #setAreaRectRatio(float)}
41-
* <p></>
41+
* <p>
42+
*
43+
* @author <a href="mailto:[email protected]">Jenly</a>
44+
* <p>
45+
* <a href="https://github.com/jenly1314">Follow me</a>
4246
*/
4347
@SuppressWarnings("unused")
4448
public class DecodeConfig {
@@ -325,7 +329,7 @@ public int getAreaRectVerticalOffset() {
325329
/**
326330
* 设置识别区域垂直方向偏移量,支持负数,大于0时,居中心向下偏移,小于0时,居中心向上偏移
327331
*
328-
* @param areaRectVerticalOffset
332+
* @param areaRectVerticalOffset 识别区域垂直方向偏移量
329333
* @return {@link DecodeConfig}
330334
*/
331335
public DecodeConfig setAreaRectVerticalOffset(int areaRectVerticalOffset) {
@@ -345,14 +349,15 @@ public int getAreaRectHorizontalOffset() {
345349
/**
346350
* 设置识别区域水平方向偏移量,支持负数,大于0时,居中心向右偏移,小于0时,居中心向左偏移
347351
*
348-
* @param areaRectHorizontalOffset
352+
* @param areaRectHorizontalOffset 识别区域水平方向偏移量
349353
* @return {@link DecodeConfig}
350354
*/
351355
public DecodeConfig setAreaRectHorizontalOffset(int areaRectHorizontalOffset) {
352356
this.areaRectHorizontalOffset = areaRectHorizontalOffset;
353357
return this;
354358
}
355359

360+
@NonNull
356361
@Override
357362
public String toString() {
358363
return "DecodeConfig{" +

0 commit comments

Comments
 (0)