Skip to content

Commit fe79be0

Browse files
committed
发布v2.1.0
1 parent 1f411a1 commit fe79be0

File tree

25 files changed

+244
-359
lines changed

25 files changed

+244
-359
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ orbs:
55

66
jobs:
77
build:
8-
executor: android/android
9-
8+
docker:
9+
- image: cimg/android:2023.08
1010
steps:
1111
- checkout
1212
- run:

.github/workflows/gradle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v2
15-
- name: Set up JDK 11
15+
- name: Set up JDK 17
1616
uses: actions/setup-java@v1
1717
with:
18-
java-version: 11
18+
java-version: 17
1919
- name: Build with Gradle
2020
run: ./gradlew build

README.md

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ Camera:为各个子库提供相机预览分析的核心库
100100
repositories {
101101
//...
102102
mavenCentral()
103-
maven { url 'https://jitpack.io' }
104103
}
105104
```
106105
@@ -109,44 +108,46 @@ Camera:为各个子库提供相机预览分析的核心库
109108
```gradle
110109
111110
//公共库 (*必须) (1.3.0新增:当使用到MLKit下面的子库时,需依赖公共库)
112-
implementation 'com.github.jenly1314.MLKit:mlkit-common:2.0.1'
111+
implementation 'com.github.jenly1314.MLKit:mlkit-common:2.1.0'
113112
114113
//--------------------------
115114
116115
//条码识别 (可选)
117-
implementation 'com.github.jenly1314.MLKit:mlkit-barcode-scanning:2.0.1'
116+
implementation 'com.github.jenly1314.MLKit:mlkit-barcode-scanning:2.1.0'
118117
119118
//人脸检测 (可选)
120-
implementation 'com.github.jenly1314.MLKit:mlkit-face-detection:2.0.1'
119+
implementation 'com.github.jenly1314.MLKit:mlkit-face-detection:2.1.0'
121120
122121
//人脸网格检测 (可选)
123-
implementation 'com.github.jenly1314.MLKit:mlkit-face-mesh-detection:2.0.1'
122+
implementation 'com.github.jenly1314.MLKit:mlkit-face-mesh-detection:2.1.0'
124123
125124
//图像标签 (可选)
126-
implementation 'com.github.jenly1314.MLKit:mlkit-image-labeling:2.0.1'
125+
implementation 'com.github.jenly1314.MLKit:mlkit-image-labeling:2.1.0'
127126
128127
//对象检测 (可选)
129-
implementation 'com.github.jenly1314.MLKit:mlkit-object-detection:2.0.1'
128+
implementation 'com.github.jenly1314.MLKit:mlkit-object-detection:2.1.0'
130129
131130
//姿势检测 (可选)
132-
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection:2.0.1'
131+
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection:2.1.0'
133132
134133
//姿势检测精确版 (可选)
135-
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection-accurate:2.0.1'
134+
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection-accurate:2.1.0'
136135
137136
//自拍分割 (可选)
138-
implementation 'com.github.jenly1314.MLKit:mlkit-segmentation-selfie:2.0.1'
137+
implementation 'com.github.jenly1314.MLKit:mlkit-segmentation-selfie:2.1.0'
139138
140139
//文字识别 (可选)
141-
implementation 'com.github.jenly1314.MLKit:mlkit-text-recognition:2.0.1'
140+
implementation 'com.github.jenly1314.MLKit:mlkit-text-recognition:2.1.0'
142141
143142
```
144143
145144
### 温馨提示
146145
147146
#### 关于MLKit版本与编译的SDK版本要求
148147
149-
> 使用 **v2.x** 以上版本时,要求 **compileSdkVersion >= 33**
148+
> 使用 **v2.1.x** 以上版本时,要求 **compileSdkVersion >= 34**
149+
150+
> 使用 **v2.0.x** 以上版本时,要求 **compileSdkVersion >= 33**
150151
151152
> 如果 **compileSdkVersion < 33** 请使用 [**v1.x版本**](https://github.com/jenly1314/MLKit/tree/1.x/)
152153
@@ -196,15 +197,15 @@ Camera:为各个子库提供相机预览分析的核心库
196197
* 2D格式:Aztec, Data Matrix, PDF417, QR Code
197198
198199
```kotlin
199-
BarcodeDecoder.process(bitmap, object : OnAnalyzeListener<List<Barcode>?> {
200-
override fun onSuccess(result: List<Barcode>) {
201-
// 分析成功
202-
}
203-
204-
override fun onFailure(e: Exception?) {
205-
// 分析失败
206-
}
207-
})
200+
BarcodeDecoder.process(bitmap).addOnSuccessListener(this) {
201+
if (it.isNotEmpty()) {
202+
// TODO 成功;此处可获取识别的结果
203+
} else {
204+
// TODO 没有结果
205+
}
206+
}.addOnFailureListener(this) {
207+
// TODO 失败;出现异常
208+
}
208209
```
209210

210211
### 各个module的使用示例
@@ -328,6 +329,11 @@ compileOptions {
328329

329330
## 版本记录
330331

332+
#### v2.1.0:2023-12-31
333+
* 更新CameraScan至v1.1.0
334+
* 更新compileSdkVersion至34
335+
* 更新Gradle至v8.0
336+
331337
#### v2.0.1:2023-9-13
332338
* 更新CameraScan至v1.0.1
333339
* 更新ViewfinderView至v1.1.0
@@ -344,40 +350,7 @@ compileOptions {
344350
* 更新MLKit相关依赖库版本
345351
* 更新CameraX至v1.2.2
346352

347-
#### v1.3.0:2023-2-23
348-
* 新增公共库(mlkit-common)
349-
* 优化注释
350-
* 更新CameraX至v1.2.1
351-
* 更新Gradle至v7.5
352-
353-
#### v1.2.0:2022-12-11
354-
* 新增人脸网格检测(mlkit-face-mesh-detection)
355-
* 更新MLKit相关依赖库版本
356-
* 更新CameraX至v1.2.0
357-
* 更新compileSdkVersion至33
358-
359-
#### v1.1.0:2022-6-1
360-
* 更新MLKit相关依赖库版本
361-
* 更新CameraX至v1.2.0-rc01
362-
* 更新compileSdkVersion至31
363-
* 更新Gradle至v7.2
364-
365-
#### v1.0.3:2021-10-18
366-
* 更新CameraX至v1.0.2
367-
* ViewfinderView新增支持显示结果点相关
368-
* 新增扫二维码有多个结果时可选实现示例(类似于新版微信效果)
369-
* 文字识别(text recognition)改为静态(即:使用v2)
370-
371-
#### v1.0.2:2021-8-4
372-
* 更新CameraX至v1.0.1
373-
* 优化CameraConfig的一些默认配置
374-
375-
#### v1.0.1:2021-7-2
376-
* 更新MLKit相关依赖库版本
377-
* 优化细节
378-
379-
#### v1.0.0:2021-4-7
380-
* MLKit初始版本
353+
#### [查看更多版本记录](change_log.md)
381354

382355
## 赞赏
383356

app/release/app-release.apk

1.29 MB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"attributes": [],
14-
"versionCode": 10,
15-
"versionName": "2.0.1",
14+
"versionCode": 11,
15+
"versionName": "2.1.0",
1616
"outputFile": "app-release.apk"
1717
}
1818
],

app/src/main/AndroidManifest.xml

Lines changed: 65 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
android:name="android.hardware.camera"
66
android:required="false" />
77

8-
<uses-permission android:name="android.permission.CAMERA"/>
9-
<uses-permission android:name="android.permission.INTERNET"/>
10-
<uses-permission android:name="android.permission.VIBRATE"/>
11-
<uses-permission android:name="android.permission.FLASHLIGHT"/>
8+
<uses-permission android:name="android.permission.CAMERA" />
9+
<uses-permission android:name="android.permission.INTERNET" />
10+
<uses-permission android:name="android.permission.VIBRATE" />
11+
<uses-permission android:name="android.permission.FLASHLIGHT" />
1212

13-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
14-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
13+
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
14+
<uses-permission
15+
android:name="android.permission.READ_EXTERNAL_STORAGE"
16+
android:maxSdkVersion="32" />
1517

1618
<application
1719
android:allowBackup="true"
@@ -21,84 +23,98 @@
2123
android:roundIcon="@mipmap/ic_launcher_round"
2224
android:supportsRtl="true"
2325
android:theme="@style/Theme.MLKit">
24-
<activity android:name=".MainActivity"
25-
android:screenOrientation="portrait"
26-
android:exported="true">
26+
<activity
27+
android:name=".MainActivity"
28+
android:exported="true"
29+
android:screenOrientation="portrait">
2730
<intent-filter>
2831
<action android:name="android.intent.action.MAIN" />
2932

3033
<category android:name="android.intent.category.LAUNCHER" />
3134
</intent-filter>
3235
</activity>
3336

34-
<activity android:name=".barcode.MultipleQRCodeScanningActivity"
35-
android:screenOrientation="portrait"
37+
<activity
38+
android:name=".barcode.MultipleQRCodeScanningActivity"
3639
android:exported="false"
37-
android:theme="@style/CameraScanTheme"/>
38-
39-
<activity android:name=".barcode.QRCodeScanningActivity"
4040
android:screenOrientation="portrait"
41-
android:exported="false"
42-
android:theme="@style/CameraScanTheme"/>
41+
android:theme="@style/CameraScanTheme" />
4342

44-
<activity android:name=".barcode.BarcodeScanningActivity"
45-
android:screenOrientation="portrait"
43+
<activity
44+
android:name=".barcode.QRCodeScanningActivity"
4645
android:exported="false"
47-
android:theme="@style/CameraScanTheme"/>
48-
49-
<activity android:name=".face.FaceDetectionActivity"
5046
android:screenOrientation="portrait"
51-
android:exported="false"
52-
android:theme="@style/CameraScanTheme"/>
47+
android:theme="@style/CameraScanTheme" />
5348

54-
<activity android:name=".face.MultipleFaceDetectionActivity"
55-
android:screenOrientation="portrait"
49+
<activity
50+
android:name=".barcode.BarcodeScanningActivity"
5651
android:exported="false"
57-
android:theme="@style/CameraScanTheme"/>
58-
59-
<activity android:name=".face.FaceMeshDetectionActivity"
6052
android:screenOrientation="portrait"
61-
android:exported="false"
62-
android:theme="@style/CameraScanTheme"/>
53+
android:theme="@style/CameraScanTheme" />
6354

64-
<activity android:name=".image.ImageLabelingActivity"
65-
android:screenOrientation="portrait"
55+
<activity
56+
android:name=".face.FaceDetectionActivity"
6657
android:exported="false"
67-
android:theme="@style/CameraScanTheme"/>
68-
69-
<activity android:name=".object.ObjectDetectionActivity"
7058
android:screenOrientation="portrait"
71-
android:exported="false"
72-
android:theme="@style/CameraScanTheme"/>
59+
android:theme="@style/CameraScanTheme" />
7360

74-
<activity android:name=".object.MultipleObjectDetectionActivity"
75-
android:screenOrientation="portrait"
61+
<activity
62+
android:name=".face.MultipleFaceDetectionActivity"
7663
android:exported="false"
77-
android:theme="@style/CameraScanTheme"/>
64+
android:screenOrientation="portrait"
65+
android:theme="@style/CameraScanTheme" />
7866

79-
<activity android:name=".pose.PoseDetectionActivity"
67+
<activity
68+
android:name=".face.FaceMeshDetectionActivity"
69+
android:exported="false"
8070
android:screenOrientation="portrait"
71+
android:theme="@style/CameraScanTheme" />
72+
73+
<activity
74+
android:name=".image.ImageLabelingActivity"
8175
android:exported="false"
82-
android:theme="@style/CameraScanTheme"/>
76+
android:screenOrientation="portrait"
77+
android:theme="@style/CameraScanTheme" />
8378

84-
<activity android:name=".pose.AccuratePoseDetectionActivity"
79+
<activity
80+
android:name=".object.ObjectDetectionActivity"
81+
android:exported="false"
8582
android:screenOrientation="portrait"
83+
android:theme="@style/CameraScanTheme" />
84+
85+
<activity
86+
android:name=".object.MultipleObjectDetectionActivity"
8687
android:exported="false"
87-
android:theme="@style/CameraScanTheme"/>
88+
android:screenOrientation="portrait"
89+
android:theme="@style/CameraScanTheme" />
8890

89-
<activity android:name=".segmentation.SelfieSegmentationActivity"
91+
<activity
92+
android:name=".pose.PoseDetectionActivity"
93+
android:exported="false"
9094
android:screenOrientation="portrait"
95+
android:theme="@style/CameraScanTheme" />
96+
97+
<activity
98+
android:name=".pose.AccuratePoseDetectionActivity"
9199
android:exported="false"
92-
android:theme="@style/CameraScanTheme"/>
100+
android:screenOrientation="portrait"
101+
android:theme="@style/CameraScanTheme" />
93102

94-
<activity android:name=".text.TextRecognitionActivity"
103+
<activity
104+
android:name=".segmentation.SelfieSegmentationActivity"
105+
android:exported="false"
95106
android:screenOrientation="portrait"
107+
android:theme="@style/CameraScanTheme" />
108+
109+
<activity
110+
android:name=".text.TextRecognitionActivity"
96111
android:exported="false"
97-
android:theme="@style/CameraScanTheme"/>
112+
android:screenOrientation="portrait"
113+
android:theme="@style/CameraScanTheme" />
98114

99115
<meta-data
100116
android:name="com.google.android.gms.version"
101-
android:value="@integer/google_play_services_version"/>
117+
android:value="@integer/google_play_services_version" />
102118

103119
<meta-data
104120
android:name="com.google.firebase.ml.vision.DEPENDENCIES"

app/src/main/java/com/king/mlkit/vision/app/Function.kt

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,7 @@ import com.king.camera.scan.util.LogUtils
2424
/**
2525
* @author <a href="mailto:[email protected]">Jenly</a>
2626
*/
27-
fun Bitmap.drawBitmap(block: (canvas: Canvas,paint: Paint) -> Unit): Bitmap {
28-
var result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
29-
try {
30-
val canvas = Canvas(result)
31-
canvas.drawBitmap(this, 0f, 0f, null)
32-
val paint = Paint()
33-
paint.strokeWidth = 4f
34-
paint.style = Paint.Style.FILL_AND_STROKE
35-
paint.color = Color.RED
36-
37-
block(canvas,paint)
38-
39-
canvas.save()
40-
canvas.restore()
41-
} catch (e: Exception) {
42-
LogUtils.w(e.message)
43-
}
44-
return result
45-
}
46-
47-
fun Bitmap.drawRect(block: (canvas: Canvas,paint: Paint) -> Unit): Bitmap {
27+
fun Bitmap.drawRect(block: (canvas: Canvas, paint: Paint) -> Unit): Bitmap {
4828
var result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
4929
try {
5030
val canvas = Canvas(result)

0 commit comments

Comments
 (0)