From e4a92531c3233183c2500f3f766281d22dd71a6d Mon Sep 17 00:00:00 2001 From: hyb1996 <946994919@qq.com> Date: Sun, 28 Oct 2018 09:02:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20image=20wrapper=E5=A4=9A?= =?UTF-8?q?=E4=BD=99release=E5=AF=BC=E8=87=B4=E5=B4=A9=E6=BA=83=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autojs/src/main/assets/modules/__images__.js | 14 ++++++++++++++ .../stardust/autojs/core/image/ImageWrapper.java | 6 ------ .../stardust/autojs/core/opencv/OpenCVHelper.java | 1 + .../ui/inflater/inflaters/TextViewInflater.java | 1 + common/release/output.json | 2 +- .../java/com/stardust/util/ResourceMonitor.java | 9 ++------- inrt/src/main/AndroidManifest.xml | 5 +++-- project-versions.json | 4 ++-- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/autojs/src/main/assets/modules/__images__.js b/autojs/src/main/assets/modules/__images__.js index 7db02f06..2347666f 100644 --- a/autojs/src/main/assets/modules/__images__.js +++ b/autojs/src/main/assets/modules/__images__.js @@ -122,6 +122,20 @@ module.exports = function (__runtime__, scope) { return matToImage(mat); } + images.resize = function(img, size, interpolation) { + var mat = newMat(); + interpolation = Imgproc["INTER_" + (interpolation || "LINEAR")]; + Imgproc.resize(img.mat, mat, newSize(size), 0, 0, interpolation); + return matToImage(mat); + } + + images.scale = function(img, fx, fy, interpolation) { + var mat = newMat(); + interpolation = Imgproc["INTER_" + (interpolation || "LINEAR")]; + Imgproc.resize(img.mat, mat, newSize([0, 0]), fx, fy, interpolation); + return matToImage(mat); + } + images.detectsColor = function (img, color, x, y, threshold, algorithm) { color = parseColor(color); algorithm = algorithm || "diff"; diff --git a/autojs/src/main/java/com/stardust/autojs/core/image/ImageWrapper.java b/autojs/src/main/java/com/stardust/autojs/core/image/ImageWrapper.java index 1f86003b..f807723c 100644 --- a/autojs/src/main/java/com/stardust/autojs/core/image/ImageWrapper.java +++ b/autojs/src/main/java/com/stardust/autojs/core/image/ImageWrapper.java @@ -156,12 +156,6 @@ public class ImageWrapper { throw new IllegalStateException("image has been recycled"); } - @Override - protected void finalize() throws Throwable { - super.finalize(); - recycle(); - } - public ImageWrapper clone() { ensureNotRecycled(); if (mBitmap == null) { diff --git a/autojs/src/main/java/com/stardust/autojs/core/opencv/OpenCVHelper.java b/autojs/src/main/java/com/stardust/autojs/core/opencv/OpenCVHelper.java index e32cada9..3d24105f 100644 --- a/autojs/src/main/java/com/stardust/autojs/core/opencv/OpenCVHelper.java +++ b/autojs/src/main/java/com/stardust/autojs/core/opencv/OpenCVHelper.java @@ -9,6 +9,7 @@ import com.afollestad.materialdialogs.MaterialDialog; import org.opencv.android.InstallCallbackInterface; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; +import org.opencv.core.Core; import org.opencv.imgproc.Imgproc; diff --git a/autojs/src/main/java/com/stardust/autojs/core/ui/inflater/inflaters/TextViewInflater.java b/autojs/src/main/java/com/stardust/autojs/core/ui/inflater/inflaters/TextViewInflater.java index 42991d06..fc3128fb 100644 --- a/autojs/src/main/java/com/stardust/autojs/core/ui/inflater/inflaters/TextViewInflater.java +++ b/autojs/src/main/java/com/stardust/autojs/core/ui/inflater/inflaters/TextViewInflater.java @@ -350,6 +350,7 @@ public class TextViewInflater extends BaseViewInflater { case "textColor": view.setTextColor(Colors.parse(view.getContext(), value)); break; + case "size": case "textSize": view.setTextSize(TypedValue.COMPLEX_UNIT_PX, Dimensions.parseToPixel(value, view)); break; diff --git a/common/release/output.json b/common/release/output.json index 7a758354..2b5a5624 100644 --- a/common/release/output.json +++ b/common/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":434,"versionName":"4.0.4 Alpha5","enabled":true,"outputFile":"commonRelease-4.0.4 Alpha5.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.4 Alpha5.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":435,"versionName":"4.0.4 Alpha6","enabled":true,"outputFile":"commonRelease-4.0.4 Alpha6.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.4 Alpha6.apk","properties":{}}] \ No newline at end of file diff --git a/common/src/main/java/com/stardust/util/ResourceMonitor.java b/common/src/main/java/com/stardust/util/ResourceMonitor.java index d3b5c5aa..55eb133d 100644 --- a/common/src/main/java/com/stardust/util/ResourceMonitor.java +++ b/common/src/main/java/com/stardust/util/ResourceMonitor.java @@ -13,9 +13,9 @@ public final class ResourceMonitor { private static final String LOG_TAG = "ResourceMonitor"; - private static final ConcurrentHashMap, SparseArray> mResources; + private static final ConcurrentHashMap, SparseArray> mResources = new ConcurrentHashMap<>(); private static Handler mHandler; - private static boolean mEnabled; + private static boolean mEnabled = false; public static void onOpen(ResourceMonitor.Resource resource) { if (!mEnabled) { @@ -64,11 +64,6 @@ public final class ResourceMonitor { } } - static { - mResources = new ConcurrentHashMap<>(); - mEnabled = BuildConfig.DEBUG; - } - public static boolean isEnabled() { return mEnabled; } diff --git a/inrt/src/main/AndroidManifest.xml b/inrt/src/main/AndroidManifest.xml index 76116e60..8c3db3bc 100644 --- a/inrt/src/main/AndroidManifest.xml +++ b/inrt/src/main/AndroidManifest.xml @@ -26,8 +26,9 @@ android:label="inrt" android:supportsRtl="true" android:theme="@style/AppTheme" - tools:replace="android:label, android:allowBackup" - tools:ignore="GoogleAppIndexingWarning"> + android:usesCleartextTraffic="true" + tools:ignore="GoogleAppIndexingWarning" + tools:replace="android:label, android:allowBackup"> diff --git a/project-versions.json b/project-versions.json index 05034643..b99f2042 100644 --- a/project-versions.json +++ b/project-versions.json @@ -1,6 +1,6 @@ { - "appVersionCode": 434, - "appVersionName": "4.0.4 Alpha5", + "appVersionCode": 435, + "appVersionName": "4.0.4 Alpha6", "target": 28, "mini": 17, "compile": 28,