发布v3.1.0
This commit is contained in:
17
README.md
17
README.md
@ -31,7 +31,6 @@ ZXingLite for Android 是ZXing的精简极速版,基于ZXing库优化扫码和
|
||||
repositories {
|
||||
//...
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
```
|
||||
|
||||
@ -39,7 +38,7 @@ ZXingLite for Android 是ZXing的精简极速版,基于ZXing库优化扫码和
|
||||
|
||||
```gradle
|
||||
// AndroidX 版本
|
||||
implementation 'com.github.jenly1314:zxing-lite:3.0.1'
|
||||
implementation 'com.github.jenly1314:zxing-lite:3.1.0'
|
||||
|
||||
```
|
||||
|
||||
@ -47,7 +46,9 @@ ZXingLite for Android 是ZXing的精简极速版,基于ZXing库优化扫码和
|
||||
|
||||
#### 关于ZXingLite版本与编译的SDK版本要求
|
||||
|
||||
> 使用 **v3.x** 以上版本时,要求 **compileSdkVersion >= 33**
|
||||
> 使用 **v3.1.x** 以上版本时,要求 **compileSdkVersion >= 34**
|
||||
|
||||
> 使用 **v3.0.x** 以上版本时,要求 **compileSdkVersion >= 33**
|
||||
|
||||
> 如果 **compileSdkVersion < 33** 请使用 [**v2.x版本**](https://github.com/jenly1314/ZXingLite/tree/2.x/)
|
||||
|
||||
@ -167,7 +168,7 @@ public class QRCodeScanActivity extends BarcodeCameraScanActivity {
|
||||
|
||||
> **BarcodeCameraScanFragment** 的使用方式与之类似。
|
||||
|
||||
更多使用详情,请查看[app](app)中的源码使用示例或直接查看[API帮助文档](https://jenly1314.github.io/projects/ZXingLite/doc/)
|
||||
更多使用详情,请查看[app](app)中的源码使用示例或直接查看[API帮助文档](https://jitpack.io/com/github/jenly1314/ZXingLite/latest/javadoc/)
|
||||
|
||||
### 其他
|
||||
|
||||
@ -188,7 +189,7 @@ compileOptions {
|
||||
|
||||
```gradle
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.3'
|
||||
}
|
||||
```
|
||||
|
||||
@ -201,6 +202,12 @@ dependencies {
|
||||
|
||||
## 版本记录
|
||||
|
||||
#### v3.1.0:2023-12-31
|
||||
* 更新CameraScan至v1.1.0
|
||||
* 更新zxing至v3.5.2
|
||||
* 更新compileSdkVersion至34
|
||||
* 更新Gradle至v8.0
|
||||
|
||||
#### v3.0.1:2023-9-13
|
||||
* 更新CameraScan至v1.0.1
|
||||
* 更新ViewfinderView至v1.1.0
|
||||
|
||||
@ -23,16 +23,17 @@ android {
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled true
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
Binary file not shown.
@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 39,
|
||||
"versionName": "3.0.1",
|
||||
"versionCode": 40,
|
||||
"versionName": "3.1.0",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
||||
@ -1,12 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.king.zxing.app">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
||||
@ -18,6 +18,9 @@ package com.king.zxing.app;
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
@ -29,6 +32,7 @@ import com.king.camera.scan.util.LogUtils;
|
||||
import com.king.camera.scan.util.PermissionUtils;
|
||||
import com.king.zxing.util.CodeUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@ -78,11 +82,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void showToast(String text) {
|
||||
if (toast == null) {
|
||||
toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
|
||||
}else {
|
||||
toast.setText(text);
|
||||
if(toast != null) {
|
||||
toast.cancel();
|
||||
}
|
||||
toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ import com.king.zxing.analyze.MultiFormatAnalyzer
|
||||
*/
|
||||
class MultiFormatScanActivity : BarcodeCameraScanActivity() {
|
||||
|
||||
var toast: Toast? = null
|
||||
private var toast: Toast? = null
|
||||
|
||||
override fun initCameraScan(cameraScan: CameraScan<Result>) {
|
||||
super.initCameraScan(cameraScan)
|
||||
@ -54,11 +54,8 @@ class MultiFormatScanActivity : BarcodeCameraScanActivity() {
|
||||
}
|
||||
|
||||
private fun showToast(text: String) {
|
||||
if(toast == null) {
|
||||
toast = Toast.makeText(this, text, Toast.LENGTH_SHORT)
|
||||
} else {
|
||||
toast?.setText(text)
|
||||
}
|
||||
toast?.cancel()
|
||||
toast = Toast.makeText(this, text, Toast.LENGTH_SHORT)
|
||||
toast?.show()
|
||||
}
|
||||
}
|
||||
12
build.gradle
12
build.gradle
@ -1,10 +1,10 @@
|
||||
buildscript {
|
||||
apply from: 'versions.gradle'
|
||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
}
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.4.2' apply false
|
||||
id 'com.android.library' version '7.4.2' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
|
||||
// id 'org.jetbrains.dokka' version '1.7.0' apply false
|
||||
id 'com.vanniktech.maven.publish' version '0.22.0' apply false
|
||||
id 'com.android.application' version '8.1.2' apply false
|
||||
id 'com.android.library' version '8.1.2' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
|
||||
id 'com.vanniktech.maven.publish' version '0.25.3' apply false
|
||||
}
|
||||
@ -1,5 +1,11 @@
|
||||
## 版本记录
|
||||
|
||||
#### v3.1.0:2023-12-31
|
||||
* 更新CameraScan至v1.1.0
|
||||
* 更新zxing至v3.5.2
|
||||
* 更新compileSdkVersion至34
|
||||
* 更新Gradle至v8.0
|
||||
|
||||
#### v3.0.1:2023-9-13
|
||||
* 更新CameraScan至v1.0.1
|
||||
* 更新ViewfinderView至v1.1.0
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
jdk:
|
||||
- openjdk11
|
||||
@ -14,8 +14,12 @@ org.gradle.jvmargs = -Xmx1536m
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
VERSION_NAME=3.0.1
|
||||
VERSION_CODE=39
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
||||
|
||||
VERSION_NAME=3.1.0
|
||||
VERSION_CODE=40
|
||||
GROUP=com.github.jenly1314
|
||||
|
||||
POM_DESCRIPTION=ZXingLite for Android
|
||||
@ -47,3 +51,4 @@ RELEASE_SIGNING_ENABLED=false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
|
||||
2
jitpack.yml
Normal file
2
jitpack.yml
Normal file
@ -0,0 +1,2 @@
|
||||
jdk:
|
||||
- openjdk17
|
||||
@ -1,52 +1,43 @@
|
||||
//App
|
||||
// App
|
||||
def app_version = [:]
|
||||
app_version.versionCode = 39
|
||||
app_version.versionName = "3.0.1"
|
||||
app_version.versionCode = 40
|
||||
app_version.versionName = "3.1.0"
|
||||
ext.app_version = app_version
|
||||
|
||||
//build version
|
||||
// build version
|
||||
def build_versions = [:]
|
||||
build_versions.minSdk = 21
|
||||
build_versions.targetSdk = 33
|
||||
build_versions.compileSdk = 33
|
||||
build_versions.buildTools = "33.0.0"
|
||||
build_versions.targetSdk = 34
|
||||
build_versions.compileSdk = 34
|
||||
build_versions.buildTools = "34.0.0"
|
||||
ext.build_versions = build_versions
|
||||
|
||||
ext.deps = [:]
|
||||
|
||||
// App dependencies
|
||||
def versions = [:]
|
||||
//AndroidX
|
||||
// AndroidX
|
||||
versions.material = "1.2.0"
|
||||
versions.appcompat = "1.1.0"
|
||||
versions.constraintLayout = "2.0.4"
|
||||
|
||||
//test
|
||||
// test
|
||||
versions.junit = "4.13.2"
|
||||
versions.androidExtJunit = "1.1.3"
|
||||
versions.test = "1.2.0"
|
||||
versions.runner = "1.2.0"
|
||||
versions.espresso = "3.4.0"
|
||||
|
||||
versions.bintray_release = "0.9.2"
|
||||
versions.mavenPublish = '0.22.0'
|
||||
versions.gralde = "7.4.2"
|
||||
|
||||
//zxing
|
||||
versions.zxing = "3.5.1"
|
||||
versions.desugar_jdk_libs = "1.2.2"
|
||||
|
||||
|
||||
ext.versions = versions
|
||||
|
||||
//androidx
|
||||
// androidx
|
||||
def androidx = [:]
|
||||
androidx.design = "com.google.android.material:material:$versions.material"
|
||||
androidx.appcompat = "androidx.appcompat:appcompat:$versions.appcompat"
|
||||
androidx.constraintlayout = "androidx.constraintlayout:constraintlayout:$versions.constraintLayout"
|
||||
deps.androidx = androidx
|
||||
|
||||
//test
|
||||
// test
|
||||
def test = [:]
|
||||
test.junit = "junit:junit:$versions.junit"
|
||||
test.android_ext_junit = "androidx.test.ext:junit:$versions.androidExtJunit"
|
||||
@ -55,14 +46,16 @@ test.runner = "androidx.test:runner:$versions.runner"
|
||||
test.espresso = "androidx.test.espresso:espresso-core:$versions.espresso"
|
||||
deps.test = test
|
||||
|
||||
//zxing
|
||||
deps.zxing = "com.google.zxing:core:$versions.zxing"
|
||||
// zxing
|
||||
deps.zxing = "com.google.zxing:core:3.5.2"
|
||||
|
||||
deps.camera_scan = "com.github.jenly1314:camera-scan:1.0.1"
|
||||
// CameraScan
|
||||
deps.camera_scan = "com.github.jenly1314:camera-scan:1.1.0"
|
||||
// ViewfinderView
|
||||
deps.viewfinderview = "com.github.jenly1314:viewfinderview:1.1.0"
|
||||
|
||||
//desugar_jdk
|
||||
deps.desugar_jdk = "com.android.tools:desugar_jdk_libs:$versions.desugar_jdk_libs"
|
||||
// desugar_jdk
|
||||
deps.desugar_jdk = "com.android.tools:desugar_jdk_libs:1.2.3"
|
||||
|
||||
ext.deps = deps
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.king.zxing">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</manifest>
|
||||
|
||||
@ -6,8 +6,8 @@ import com.google.zxing.Result;
|
||||
import com.king.camera.scan.AnalyzeResult;
|
||||
import com.king.camera.scan.FrameMetadata;
|
||||
import com.king.camera.scan.analyze.Analyzer;
|
||||
import com.king.camera.scan.util.ImageUtils;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -38,7 +38,7 @@ public abstract class ImageAnalyzer implements Analyzer<Result> {
|
||||
public abstract Result analyze(byte[] data, int width, int height);
|
||||
|
||||
@Override
|
||||
public void analyze(@NonNull ImageProxy imageProxy, @NonNull OnAnalyzeListener<AnalyzeResult<Result>> listener) {
|
||||
public void analyze(@NonNull ImageProxy imageProxy, @NonNull OnAnalyzeListener<Result> listener) {
|
||||
|
||||
if (!joinQueue.get()) {
|
||||
int imageSize = imageProxy.getWidth() * imageProxy.getHeight();
|
||||
@ -56,7 +56,7 @@ public abstract class ImageAnalyzer implements Analyzer<Result> {
|
||||
int width = imageProxy.getWidth();
|
||||
int height = imageProxy.getHeight();
|
||||
|
||||
yuv_420_888toNv21(imageProxy, nv21Data);
|
||||
ImageUtils.yuv_420_888toNv21(imageProxy, nv21Data);
|
||||
|
||||
Result result;
|
||||
if (rotation == 90 || rotation == 270) {
|
||||
@ -88,59 +88,4 @@ public abstract class ImageAnalyzer implements Analyzer<Result> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* YUV420_888转NV21
|
||||
*
|
||||
* @param image
|
||||
* @param nv21
|
||||
*/
|
||||
private void yuv_420_888toNv21(@NonNull ImageProxy image, byte[] nv21) {
|
||||
ImageProxy.PlaneProxy yPlane = image.getPlanes()[0];
|
||||
ImageProxy.PlaneProxy uPlane = image.getPlanes()[1];
|
||||
ImageProxy.PlaneProxy vPlane = image.getPlanes()[2];
|
||||
|
||||
ByteBuffer yBuffer = yPlane.getBuffer();
|
||||
ByteBuffer uBuffer = uPlane.getBuffer();
|
||||
ByteBuffer vBuffer = vPlane.getBuffer();
|
||||
yBuffer.rewind();
|
||||
uBuffer.rewind();
|
||||
vBuffer.rewind();
|
||||
|
||||
int ySize = yBuffer.remaining();
|
||||
|
||||
int position = 0;
|
||||
|
||||
// Add the full y buffer to the array. If rowStride > 1, some padding may be skipped.
|
||||
for (int row = 0; row < image.getHeight(); row++) {
|
||||
yBuffer.get(nv21, position, image.getWidth());
|
||||
position += image.getWidth();
|
||||
yBuffer.position(Math.min(ySize, yBuffer.position() - image.getWidth() + yPlane.getRowStride()));
|
||||
}
|
||||
|
||||
int chromaHeight = image.getHeight() / 2;
|
||||
int chromaWidth = image.getWidth() / 2;
|
||||
int vRowStride = vPlane.getRowStride();
|
||||
int uRowStride = uPlane.getRowStride();
|
||||
int vPixelStride = vPlane.getPixelStride();
|
||||
int uPixelStride = uPlane.getPixelStride();
|
||||
|
||||
// Interleave the u and v frames, filling up the rest of the buffer. Use two line buffers to
|
||||
// perform faster bulk gets from the byte buffers.
|
||||
byte[] vLineBuffer = new byte[vRowStride];
|
||||
byte[] uLineBuffer = new byte[uRowStride];
|
||||
for (int row = 0; row < chromaHeight; row++) {
|
||||
vBuffer.get(vLineBuffer, 0, Math.min(vRowStride, vBuffer.remaining()));
|
||||
uBuffer.get(uLineBuffer, 0, Math.min(uRowStride, uBuffer.remaining()));
|
||||
int vLineBufferPosition = 0;
|
||||
int uLineBufferPosition = 0;
|
||||
for (int col = 0; col < chromaWidth; col++) {
|
||||
nv21[position++] = vLineBuffer[vLineBufferPosition];
|
||||
nv21[position++] = uLineBuffer[uLineBufferPosition];
|
||||
vLineBufferPosition += vPixelStride;
|
||||
uLineBufferPosition += uPixelStride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user