Skip to content

Commit

Permalink
发布v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jenly1314 committed Jul 16, 2024
1 parent 78b59b2 commit 5774a41
Show file tree
Hide file tree
Showing 23 changed files with 232 additions and 153 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ ZXingLite for Android 是ZXing的精简极速版,基于ZXing库优化扫码和
2. 在Module的 **build.gradle** 里面添加引入依赖项
```gradle
// AndroidX 版本
implementation 'com.github.jenly1314:zxing-lite:3.1.1'
implementation 'com.github.jenly1314:zxing-lite:3.2.0'
```
Expand Down Expand Up @@ -202,6 +201,11 @@ dependencies {

## 版本记录

#### v3.2.0:2024-07-16
* 更新CameraScan至v1.2.0
* 更新ViewfinderView至v1.2.0
* 优化细节

#### v3.1.1:2024-04-29
* 更新CameraScan至v1.1.1
* 更新zxing至v3.5.3
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ android {
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
lintOptions {
abortOnError false
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 41,
"versionName": "3.1.1",
"versionCode": 42,
"versionName": "3.2.0",
"outputFile": "app-release.apk"
}
],
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/king/zxing/app/CodeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@

/**
* 生成条形码/二维码示例
* @author Jenly <a href="mailto:[email protected]">Jenly</a>
*
* @author <a href="mailto:[email protected]">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
public class CodeActivity extends AppCompatActivity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import com.king.zxing.analyze.QRCodeAnalyzer

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

Expand Down
11 changes: 9 additions & 2 deletions app/src/main/java/com/king/zxing/app/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
Expand All @@ -28,17 +29,21 @@
import androidx.core.app.ActivityOptionsCompat;

import com.king.camera.scan.CameraScan;
import com.king.camera.scan.util.LogUtils;
import com.king.zxing.util.CodeUtils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
* 扫码示例
*
* @author <a href="mailto:[email protected]">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
public class MainActivity extends AppCompatActivity {

private static final String TAG = "MainActivity";
public static final String KEY_TITLE = "key_title";
public static final String KEY_IS_QR_CODE = "key_code";

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import com.king.zxing.analyze.MultiFormatAnalyzer

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

Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/com/king/zxing/app/QRCodeScanActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
import com.king.zxing.DecodeConfig;
import com.king.zxing.DecodeFormatManager;
import com.king.zxing.BarcodeCameraScanActivity;
import com.king.zxing.analyze.MultiFormatAnalyzer;
import com.king.zxing.analyze.QRCodeAnalyzer;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
* 扫二维码识别示例
*
* @author <a href="mailto:[email protected]">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
public class QRCodeScanActivity extends BarcodeCameraScanActivity {

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

/**
Expand Down
5 changes: 5 additions & 0 deletions change_log.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## 版本记录

#### v3.2.0:2024-07-16
* 更新CameraScan至v1.2.0
* 更新ViewfinderView至v1.2.0
* 优化细节

#### v3.1.1:2024-04-29
* 更新CameraScan至v1.1.1
* 更新zxing至v3.5.3
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

VERSION_NAME=3.1.1
VERSION_CODE=41
VERSION_NAME=3.2.0
VERSION_CODE=42
GROUP=com.github.jenly1314

POM_DESCRIPTION=ZXingLite for Android
Expand Down
8 changes: 4 additions & 4 deletions versions.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// App
def app_version = [:]
app_version.versionCode = 41
app_version.versionName = "3.1.1"
app_version.versionCode = 42
app_version.versionName = "3.2.0"
ext.app_version = app_version

// build version
Expand Down Expand Up @@ -50,9 +50,9 @@ deps.test = test
deps.zxing = "com.google.zxing:core:3.5.3"

// CameraScan
deps.camera_scan = "com.github.jenly1314:camera-scan:1.1.1"
deps.camera_scan = "com.github.jenly1314:camera-scan:1.2.0"
// ViewfinderView
deps.viewfinderview = "com.github.jenly1314:viewfinderview:1.1.0"
deps.viewfinderview = "com.github.jenly1314:viewfinderview:1.2.0"

// desugar_jdk
deps.desugar_jdk = "com.android.tools:desugar_jdk_libs:1.2.3"
Expand Down
4 changes: 2 additions & 2 deletions zxing-lite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* 通过继承 {@link BarcodeCameraScanActivity}或{@link BarcodeCameraScanFragment}可快速实现扫码识别
*
* @author <a href="mailto:[email protected]">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
public abstract class BarcodeCameraScanActivity extends BaseCameraScanActivity<Result> {

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

Expand Down
17 changes: 11 additions & 6 deletions zxing-lite/src/main/java/com/king/zxing/DecodeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

import android.graphics.Rect;

import androidx.annotation.FloatRange;
import androidx.annotation.NonNull;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.common.GlobalHistogramBinarizer;
import com.google.zxing.common.HybridBinarizer;

import java.util.Map;

import androidx.annotation.FloatRange;

/**
* 解码配置:主要用于在扫码识别时,提供一些配置,便于扩展。通过配置可决定内置分析器的能力,从而间接的控制并简化扫码识别的流程
* <p></>
Expand All @@ -25,7 +26,6 @@
* {@link DecodeFormatManager#DEFAULT_HINTS}
* <p>
*
* @author <a href="mailto:[email protected]">Jenly</a>
* <p>
* 如果不满足您也可以通过{@link DecodeFormatManager#createDecodeHints(BarcodeFormat...)}自己配置支持的格式
*
Expand All @@ -38,7 +38,11 @@
* 因为{@link androidx.camera.view.PreviewView}的预览区域是经过裁剪的,所以这里的区域并不是用户所能预览到的区域,而是指Camera预览的真实区域,
* <p>
* 即判定区域分析的优先级顺序为:{@link #setFullAreaScan(boolean)} -> {@link #setAnalyzeAreaRect(Rect)} -> {@link #setAreaRectRatio(float)}
* <p></>
* <p>
*
* @author <a href="mailto:[email protected]">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
@SuppressWarnings("unused")
public class DecodeConfig {
Expand Down Expand Up @@ -325,7 +329,7 @@ public int getAreaRectVerticalOffset() {
/**
* 设置识别区域垂直方向偏移量,支持负数,大于0时,居中心向下偏移,小于0时,居中心向上偏移
*
* @param areaRectVerticalOffset
* @param areaRectVerticalOffset 识别区域垂直方向偏移量
* @return {@link DecodeConfig}
*/
public DecodeConfig setAreaRectVerticalOffset(int areaRectVerticalOffset) {
Expand All @@ -345,14 +349,15 @@ public int getAreaRectHorizontalOffset() {
/**
* 设置识别区域水平方向偏移量,支持负数,大于0时,居中心向右偏移,小于0时,居中心向左偏移
*
* @param areaRectHorizontalOffset
* @param areaRectHorizontalOffset 识别区域水平方向偏移量
* @return {@link DecodeConfig}
*/
public DecodeConfig setAreaRectHorizontalOffset(int areaRectHorizontalOffset) {
this.areaRectHorizontalOffset = areaRectHorizontalOffset;
return this;
}

@NonNull
@Override
public String toString() {
return "DecodeConfig{" +
Expand Down
Loading

0 comments on commit 5774a41

Please sign in to comment.