From 0c5d837ec6d8a939528ec056dc29fa0c8e00efa9 Mon Sep 17 00:00:00 2001 From: SuperMonster003 Date: Sat, 26 Jul 2025 15:04:27 +0800 Subject: [PATCH] =?UTF-8?q?6.7.0=20-=20Alpha4=20-=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=20MLKit=20Google=20OCR=20=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(=E8=AF=95=E4=BF=AE)=20(issue=20#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changelog/lang_zh-Hans.json | 8 +++++--- app/build.gradle.kts | 3 ++- app/src/main/AndroidManifest.xml | 12 ++++++++++-- app/src/main/java/org/autojs/autojs/App.kt | 9 +++++++++ version.properties | 8 ++++---- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.changelog/lang_zh-Hans.json b/.changelog/lang_zh-Hans.json index caa14cd8..ff7d3e24 100644 --- a/.changelog/lang_zh-Hans.json +++ b/.changelog/lang_zh-Hans.json @@ -16,6 +16,7 @@ "Android 10 UiObject#child 方法可能出现 ArrayIndexOutOfBoundsException 异常的问题 _[`issue #416`](http://issues.autojs6.com/416)_", "打包应用无法正常使用 Paddle OCR 与 Rapid OCR 功能的问题", "版本历史页面部分系统因字体差别导致统计数据显示不完整的问题", + "部分设备无法正常初始化 MLKit Google OCR 的问题 (试修) _[`issue #8`](http://issues.autojs6.com/8#issuecomment-3117061768)_", "ErrorDialogActivity 可能无法正常启动的问题 _[`issue #414`](http://issues.autojs6.com/414)_ _[`issue #340`](http://issues.autojs6.com/340#issuecomment-2973485826)_", "崩溃报告页面复制详细信息功能失效的问题" ], @@ -42,7 +43,8 @@ "升级 Junit Jupiter 版本 5.10.3 -> 5.13.0", "升级 Androidx AppCompat 版本 1.7.0 -> 1.7.1", "升级 Material Progressbar 版本 1.4.2 -> 1.6.1", - "升级 Androidx Room 版本 2.7.1 -> 2.7.2" + "升级 Androidx Room 版本 2.7.1 -> 2.7.2", + "升级 OpenCC 版本 1.2.0 -> 1.2.2" ] }, "v6.6.4": { @@ -376,7 +378,7 @@ "打包应用无法显示并打印部分异常消息的问题", "打包应用页面选择应用图标后可能显示空图标的问题", "打包应用包含 MLKit Google OCR 库时可能出现的上下文未初始化异常", - "ocr.mlkit/ocr.recognizeText/detect 方法无效的问题", + "ocr.recognizeText/detect 方法无效的问题", "部分文本 (如日志页面) 显示语言与应用设置语言可能不相符的问题", "部分语言在主页抽屉开关项可能出现文本溢出的问题", "部分设备无障碍服务开启后立即自动关闭且无任何提示消息的问题 _[`issue #181`](http://issues.autojs6.com/181)_", @@ -386,7 +388,7 @@ "app.startActivity 无法使用简称参数的问题 _[`issue #182`](http://issues.autojs6.com/182)_ _[`issue #188`](http://issues.autojs6.com/188)_", "importClass 导入的类名与全局变量冲突时代码抛出异常的问题 _[`issue #185`](http://issues.autojs6.com/185)_", "Android 7.x 无法使用无障碍服务的问题", - "Android 14 可能无法正常使用 runtime.loadJar/loadDex 方法的问题 (试修)", + "Android 14 可能无法正常使用 runtime.loadJar/loadDex 方法的问题 (试修)", "安卓系统快速设置面板中 \"布局范围分析\" 和 \"布局层次分析\" 不可用的问题 _[`issue #193`](http://issues.autojs6.com/193)_", "自动检查更新功能可能导致应用 [ANR](https://developer.android.com/topic/performance/vitals/anr) 的问题 (试修) _[`issue #186`](http://issues.autojs6.com/186)_", "文件管理器示例代码文件夹点击 \"向上\" 按钮后无法回到工作路径页面的问题 _[`issue #129`](http://issues.autojs6.com/129)_", diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8d479545..5084c572 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -374,7 +374,8 @@ dependencies /* MLKit */ { dependencies /* OpenCC */ { // OpenCC - implementation("com.github.qichuan:android-opencc:1.2.0") + // implementation("com.github.qichuan:android-opencc:1.2.0") + implementation("com.github.brooklet:android-opencc:1.2.2") } dependencies /* Auto.js Extensions */ { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 45252b37..e04fda7b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -209,8 +209,7 @@ + android:theme="@style/AppTheme.Splash"> @@ -748,6 +747,15 @@ android:name="moe.shizuku.client.V3_SUPPORT" android:value="true" /> + + + + + + \ No newline at end of file diff --git a/app/src/main/java/org/autojs/autojs/App.kt b/app/src/main/java/org/autojs/autojs/App.kt index 4f3f4642..a2a58858 100644 --- a/app/src/main/java/org/autojs/autojs/App.kt +++ b/app/src/main/java/org/autojs/autojs/App.kt @@ -17,9 +17,11 @@ import com.bumptech.glide.Glide import com.bumptech.glide.request.target.CustomViewTarget import com.bumptech.glide.request.transition.Transition import com.flurry.android.FlurryAgent +import com.google.mlkit.common.sdkinternal.MlKitContext import com.hjq.toast.Toaster import com.tencent.bugly.Bugly import com.tencent.bugly.crashreport.CrashReport +import org.autojs.autojs.apkbuilder.ApkBuilder import org.autojs.autojs.app.GlobalAppContext import org.autojs.autojs.core.pref.Pref import org.autojs.autojs.core.ui.inflater.ImageLoader @@ -28,6 +30,7 @@ import org.autojs.autojs.event.GlobalKeyObserver import org.autojs.autojs.external.receiver.DynamicBroadcastReceivers import org.autojs.autojs.leakcanary.LeakCanarySetup import org.autojs.autojs.pluginclient.DevPluginService +import org.autojs.autojs.runtime.api.augment.ocr.Ocr import org.autojs.autojs.timing.TimedTaskManager import org.autojs.autojs.timing.TimedTaskScheduler import org.autojs.autojs.tool.CrashHandler @@ -68,6 +71,7 @@ class App : MultiDexApplication() { setupDrawableImageLoader() TimedTaskScheduler.init(this) initDynamicBroadcastReceivers() + initMlKitContext() Toaster.init(this) setUpDefaultNightMode() @@ -150,6 +154,11 @@ class App : MultiDexApplication() { } + private fun initMlKitContext() { + ApkBuilder.Libs.MLKIT_OCR.ensureLibFiles(Ocr.Companion.OcrMode.MLKIT.value) + MlKitContext.initializeIfNeeded(this) + } + private fun setupDrawableImageLoader() { Drawables.defaultImageLoader = object : ImageLoader { override fun loadInto(imageView: ImageView, uri: Uri) { diff --git a/version.properties b/version.properties index 97998922..faea811d 100644 --- a/version.properties +++ b/version.properties @@ -1,5 +1,5 @@ -#Wed Jul 23 14:44:12 CST 2025 -BUILD_TIME=1753253052464 +#Fri Jul 25 20:09:20 CST 2025 +BUILD_TIME=1753445360412 COMPILE_SDK_VERSION=35 IMAGE_QUANT_CMAKE_VERSION=3.22.1 IMAGE_QUANT_NDK_VERSION=26.1.10909125 @@ -19,6 +19,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3 TARGET_SDK_VERSION=35 TARGET_SDK_VERSION_INRT=29 -VERSION_BUILD=3337 -VERSION_NAME=6.7.0 Alpha3 +VERSION_BUILD=3339 +VERSION_NAME=6.7.0 Alpha4 VSCODE_EXT_REQUIRED_VERSION=1.0.8