修复 image wrapper多余release导致崩溃的问题
This commit is contained in:
@@ -122,6 +122,20 @@ module.exports = function (__runtime__, scope) {
|
|||||||
return matToImage(mat);
|
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) {
|
images.detectsColor = function (img, color, x, y, threshold, algorithm) {
|
||||||
color = parseColor(color);
|
color = parseColor(color);
|
||||||
algorithm = algorithm || "diff";
|
algorithm = algorithm || "diff";
|
||||||
|
|||||||
@@ -156,12 +156,6 @@ public class ImageWrapper {
|
|||||||
throw new IllegalStateException("image has been recycled");
|
throw new IllegalStateException("image has been recycled");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void finalize() throws Throwable {
|
|
||||||
super.finalize();
|
|
||||||
recycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImageWrapper clone() {
|
public ImageWrapper clone() {
|
||||||
ensureNotRecycled();
|
ensureNotRecycled();
|
||||||
if (mBitmap == null) {
|
if (mBitmap == null) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.afollestad.materialdialogs.MaterialDialog;
|
|||||||
import org.opencv.android.InstallCallbackInterface;
|
import org.opencv.android.InstallCallbackInterface;
|
||||||
import org.opencv.android.LoaderCallbackInterface;
|
import org.opencv.android.LoaderCallbackInterface;
|
||||||
import org.opencv.android.OpenCVLoader;
|
import org.opencv.android.OpenCVLoader;
|
||||||
|
import org.opencv.core.Core;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ public class TextViewInflater<V extends TextView> extends BaseViewInflater<V> {
|
|||||||
case "textColor":
|
case "textColor":
|
||||||
view.setTextColor(Colors.parse(view.getContext(), value));
|
view.setTextColor(Colors.parse(view.getContext(), value));
|
||||||
break;
|
break;
|
||||||
|
case "size":
|
||||||
case "textSize":
|
case "textSize":
|
||||||
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, Dimensions.parseToPixel(value, view));
|
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, Dimensions.parseToPixel(value, view));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -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":{}}]
|
[{"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":{}}]
|
||||||
@@ -13,9 +13,9 @@ public final class ResourceMonitor {
|
|||||||
|
|
||||||
private static final String LOG_TAG = "ResourceMonitor";
|
private static final String LOG_TAG = "ResourceMonitor";
|
||||||
|
|
||||||
private static final ConcurrentHashMap<Class<?>, SparseArray<UnclosedResourceException>> mResources;
|
private static final ConcurrentHashMap<Class<?>, SparseArray<UnclosedResourceException>> mResources = new ConcurrentHashMap<>();
|
||||||
private static Handler mHandler;
|
private static Handler mHandler;
|
||||||
private static boolean mEnabled;
|
private static boolean mEnabled = false;
|
||||||
|
|
||||||
public static void onOpen(ResourceMonitor.Resource resource) {
|
public static void onOpen(ResourceMonitor.Resource resource) {
|
||||||
if (!mEnabled) {
|
if (!mEnabled) {
|
||||||
@@ -64,11 +64,6 @@ public final class ResourceMonitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
mResources = new ConcurrentHashMap<>();
|
|
||||||
mEnabled = BuildConfig.DEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public static boolean isEnabled() {
|
||||||
return mEnabled;
|
return mEnabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,9 @@
|
|||||||
android:label="inrt"
|
android:label="inrt"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
tools:replace="android:label, android:allowBackup"
|
android:usesCleartextTraffic="true"
|
||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="GoogleAppIndexingWarning"
|
||||||
|
tools:replace="android:label, android:allowBackup">
|
||||||
<activity android:name=".LogActivity">
|
<activity android:name=".LogActivity">
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"appVersionCode": 434,
|
"appVersionCode": 435,
|
||||||
"appVersionName": "4.0.4 Alpha5",
|
"appVersionName": "4.0.4 Alpha6",
|
||||||
"target": 28,
|
"target": 28,
|
||||||
"mini": 17,
|
"mini": 17,
|
||||||
"compile": 28,
|
"compile": 28,
|
||||||
|
|||||||
Reference in New Issue
Block a user