Skip to content

Commit

Permalink
发布v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jenly1314 committed Jul 12, 2024
1 parent d327dfd commit e5be312
Show file tree
Hide file tree
Showing 30 changed files with 219 additions and 119 deletions.
45 changes: 18 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,23 @@ OpenCV二维码扫码:有了上面的OpenCV二维码识别功能,基本的
```gradle
// OpenCV基础库(*必须)
implementation 'com.github.jenly1314.WeChatQRCode:opencv:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-armv7a:2.1.0'
// OpenCV的其他ABI(可选),根据你的需要选择想要支持的SO库架构
implementation 'com.github.jenly1314.WeChatQRCode:opencv-armv64:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-x86:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-x86_64:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv:2.2.0'
// OpenCV的ABI(可选),根据你的需要选择想要支持的SO库架构(至少选一个)
implementation 'com.github.jenly1314.WeChatQRCode:opencv-armv7a:2.2.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-armv64:2.2.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-x86:2.2.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-x86_64:2.2.0'
// OpenCV二维码识别功能(可选)
implementation 'com.github.jenly1314.WeChatQRCode:opencv-qrcode:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-qrcode:2.2.0'
// OpenCV二维码扫码功能(可选)
implementation 'com.github.jenly1314.WeChatQRCode:opencv-qrcode-scanning:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:opencv-qrcode-scanning:2.2.0'
// 微信二维码识别功能(可选)
implementation 'com.github.jenly1314.WeChatQRCode:wechat-qrcode:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:wechat-qrcode:2.2.0'
// 微信二维码扫码功能(可选)
implementation 'com.github.jenly1314.WeChatQRCode:wechat-qrcode-scanning:2.1.0'
implementation 'com.github.jenly1314.WeChatQRCode:wechat-qrcode-scanning:2.2.0'
```
Expand Down Expand Up @@ -383,6 +383,12 @@ class WeChatQRCodeActivity : WeChatCameraScanActivity() {

## 版本记录

#### v2.2.0:2024-7-11
* 更新CameraScan至v1.2.0
* 更新ViewfinderView至v1.2.0
* 使用[LogX](https://github.com/jenly1314/LogX) 来统一管理日志
* 优化一些细节

#### v2.1.0:2024-1-13
* 更新OpenCV至v4.9.0
* 更新CameraScan至v1.1.0
Expand All @@ -404,22 +410,7 @@ class WeChatQRCodeActivity : WeChatCameraScanActivity() {
* 更新compileSdkVersion至33
* 更新Gradle至v7.5

#### v1.2.1:2023-2-27
* 优化细节

#### v1.2.0:2022-8-4
* 更新OpenCV至v4.6.0

#### v1.1.1:2021-11-2
* 优化细节
* 更新mlkit-camera-core至v1.0.3

#### v1.1.0:2021-8-6
* 编译多种ABI支持
* 更新mlkit-camera-core至v1.0.2

#### v1.0.0:2021-7-24
* WeChatQRCode初始版本
#### [查看更多版本记录](change_log.md)

## 赞赏
如果您喜欢WeChatQRCode,或感觉WeChatQRCode帮助到了您,可以点右上角“Star”支持一下,您的支持就是我的动力,谢谢 :smiley:
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ android {
}

compileOptions {
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()
}
packagingOptions {
resources {
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": 10,
"versionName": "2.1.0",
"versionCode": 11,
"versionName": "2.2.0",
"outputFile": "app-release.apk"
}
],
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/king/wechat/qrcode/app/Function.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import com.king.camera.scan.util.LogUtils
import com.king.logx.LogX

/**
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
fun Bitmap.drawRect(block: (canvas: Canvas,paint: Paint) -> Unit): Bitmap {
val result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
Expand All @@ -24,7 +26,7 @@ fun Bitmap.drawRect(block: (canvas: Canvas,paint: Paint) -> Unit): Bitmap {
canvas.save()
canvas.restore()
} catch (e: Exception) {
LogUtils.w(e.message)
LogX.w(e.message)
}
return result
}
Expand Down
14 changes: 8 additions & 6 deletions app/src/main/java/com/king/wechat/qrcode/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityOptionsCompat
import androidx.lifecycle.lifecycleScope
import com.king.camera.scan.CameraScan
import com.king.camera.scan.util.LogUtils
import com.king.logx.LogX
import com.king.opencv.qrcode.OpenCVQRCodeDetector
import com.king.wechat.qrcode.WeChatQRCodeDetector
import kotlinx.coroutines.Dispatchers
Expand All @@ -21,6 +21,8 @@ import org.opencv.OpenCV
/**
* 示例
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
class MainActivity : AppCompatActivity() {

Expand Down Expand Up @@ -74,13 +76,13 @@ class MainActivity : AppCompatActivity() {
if (result.isNotEmpty()) {// 不为空,则表示识别成功
// 打印所有结果
for ((index, text) in result.withIndex()) {
LogUtils.d("result$index:$text")
LogX.d("result$index:$text")
}
// 一般需求都是识别一个码,所以这里取第0个就可以;有识别多个码的需求,可以取全部
Toast.makeText(getContext(), result[0], Toast.LENGTH_SHORT).show()
} else {
// 为空表示识别失败
LogUtils.d("result = null")
LogX.d("result = null")
}
} else {
val result = withContext(Dispatchers.IO) {
Expand All @@ -89,18 +91,18 @@ class MainActivity : AppCompatActivity() {
}

if (!result.isNullOrEmpty()) {// 不为空,则表示识别成功
LogUtils.d("result$result")
LogX.d("result: $result")
Toast.makeText(getContext(), result, Toast.LENGTH_SHORT).show()
} else {
// 为空表示识别失败
LogUtils.d("result = null")
LogX.d("result = null")
}
}

}

} catch (e: Exception) {
LogUtils.w(e)
LogX.w(e)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import com.king.opencv.qrcode.scanning.analyze.OpenCVScanningAnalyzer
* OpenCV二维码扫描实现示例
*
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
class OpenCVQRCodeActivity : OpenCVCameraScanActivity() {
override fun onScanResultCallback(result: AnalyzeResult<MutableList<String>>) {
Expand All @@ -31,7 +33,6 @@ class OpenCVQRCodeActivity : OpenCVCameraScanActivity() {
result.result.forEachIndexed{ index, data ->
buffer.append("[$index] ").append(data).append("\n")
}
Log.w(TAG, "123456cols: ${result.points.cols()}, rows: ${result.points.rows()}")

for (i in 0 until result.points.rows()) {
result.points.row(i).let { mat ->
Expand Down Expand Up @@ -79,7 +80,7 @@ class OpenCVQRCodeActivity : OpenCVCameraScanActivity() {
}

override fun createAnalyzer(): Analyzer<MutableList<String>> {
// 如果需要返回结果二维码位置信息,则初始化分析器时,参数传 true 即可
// 如果需要返回结果二维码位置信息,则初始化分析器时,isOutputVertices参数传 true 即可
return OpenCVScanningAnalyzer(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import com.king.wechat.qrcode.scanning.analyze.WeChatScanningAnalyzer
* 微信多二维码扫描实现示例
*
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
class WeChatMultiQRCodeActivity : WeChatCameraScanActivity() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import com.king.wechat.qrcode.scanning.analyze.WeChatScanningAnalyzer
* 微信二维码扫描实现示例
*
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
class WeChatQRCodeActivity : WeChatCameraScanActivity() {

Expand All @@ -29,8 +31,8 @@ class WeChatQRCodeActivity : WeChatCameraScanActivity() {
// 停止分析
cameraScan.setAnalyzeImage(false)
Log.d(TAG, result.result.toString())
val width = result.bitmapWidth
val height = result.bitmapHeight
val width = result.imageWidth
val height = result.imageHeight

// 当初始化 WeChatScanningAnalyzer 时,如果是需要二维码的位置信息,则可通过 WeChatScanningAnalyzer.QRCodeAnalyzeResult 获取
if (result is WeChatScanningAnalyzer.QRCodeAnalyzeResult) { // 如果需要处理结果二维码的位置信息
Expand Down Expand Up @@ -92,7 +94,7 @@ class WeChatQRCodeActivity : WeChatCameraScanActivity() {
override fun createAnalyzer(): Analyzer<MutableList<String>> {
// 分析器默认不会返回结果二维码的位置信息
// return WeChatScanningAnalyzer()
// 如果需要返回结果二维码位置信息,则初始化分析器时,参数传 true 即可
// 如果需要返回结果二维码位置信息,则初始化分析器时,isOutputVertices参数传 true 即可
return WeChatScanningAnalyzer(true)
}

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

#### v2.2.0:2024-7-11
* 更新CameraScan至v1.2.0
* 更新ViewfinderView至v1.2.0
* 使用[LogX](https://github.com/jenly1314/LogX) 来统一管理日志
* 优化一些细节

#### v2.1.0:2024-1-13
* 更新OpenCV至v4.9.0
* 更新CameraScan至v1.1.0
* 更新compileSdkVersion至34
* 更新Gradle至v8.0

#### v2.0.1:2023-9-13
* 更新CameraScan至v1.0.1
* 更新ViewfinderView至v1.1.0

#### v2.0.0:2023-8-14
* **wechat-qrcode-scanning****opencv-qrcode-scanning** 中移除原依赖(**mlkit-camera-core**),现改为依赖[CameraScan](https://github.com/jenly1314/CameraScan)
* **wechat-qrcode-scanning****opencv-qrcode-scanning** 添加默认依赖[ViewfinderView](https://github.com/jenly1314/ViewfinderView)
* 优化扫描分析过程的性能体验(优化帧数据分析过程)

#### v1.3.0:2023-4-16
* 新增OpenCV二维码扫码识别库(opencv-qrcode和opencv-qrcode-scanning)
* 更新mlkit-camera-core至v1.4.0
* 更新compileSdkVersion至33
* 更新Gradle至v7.5

#### v1.2.1:2023-2-27
* 优化细节

#### v1.2.0:2022-8-4
* 更新OpenCV至v4.6.0

#### v1.1.1:2021-11-2
* 优化细节
* 更新mlkit-camera-core至v1.0.3

#### v1.1.0:2021-8-6
* 编译多种ABI支持
* 更新mlkit-camera-core至v1.0.2

#### v1.0.0:2021-7-24
* WeChatQRCode初始版本
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

VERSION_NAME=2.1.0
VERSION_CODE=10
VERSION_NAME=2.2.0
VERSION_CODE=11
GROUP=com.github.jenly1314.WeChatQRCode

POM_DESCRIPTION=Wechat QRCode
Expand Down
4 changes: 2 additions & 2 deletions opencv-armv64/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lint {
abortOnError false
Expand Down
4 changes: 2 additions & 2 deletions opencv-armv7a/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lint {
abortOnError false
Expand Down
4 changes: 2 additions & 2 deletions opencv-qrcode-scanning/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lint {
abortOnError false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* 通过继承 {@link OpenCVCameraScanActivity}或{@link OpenCVCameraScanFragment}可快速实现二维码扫描
*
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
public abstract class OpenCVCameraScanActivity extends BaseCameraScanActivity<List<String>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* 通过继承 {@link OpenCVCameraScanActivity}或{@link OpenCVCameraScanFragment}可快速实现二维码扫描
*
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
* <p>
* <a href="https://github.com/jenly1314">Follow me</a>
*/
public abstract class OpenCVCameraScanFragment extends BaseCameraScanFragment<List<String>> {

Expand Down
Loading

0 comments on commit e5be312

Please sign in to comment.