mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-24 18:20:12 +08:00
refactor(android): v3.0 provider destroy Instance jni
This commit is contained in:
@@ -47,11 +47,11 @@ import com.tencent.mtt.hippy.bridge.bundleloader.HippyBundleLoader;
|
||||
import com.tencent.mtt.hippy.bridge.libraryloader.LibraryLoader;
|
||||
import com.tencent.mtt.hippy.common.HippyJsException;
|
||||
import com.tencent.mtt.hippy.common.HippyMap;
|
||||
import com.tencent.mtt.hippy.modules.HippyModulePromise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.utils.ContextHolder;
|
||||
import com.tencent.mtt.hippy.utils.LogUtils;
|
||||
import com.tencent.mtt.hippy.utils.UIThreadUtils;
|
||||
import com.tencent.mtt.hippy.adapter.thirdparty.HippyThirdPartyAdapter;
|
||||
import com.tencent.mtt.hippy.modules.Promise.BridgeTransferType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
+4
-4
@@ -33,7 +33,6 @@ import com.tencent.link_supplier.proxy.renderer.ControllerProvider;
|
||||
import com.tencent.link_supplier.proxy.renderer.NativeRenderProxy;
|
||||
import com.tencent.mtt.hippy.adapter.device.HippyDeviceAdapter;
|
||||
import com.tencent.mtt.hippy.dom.DomManager;
|
||||
import com.tencent.mtt.hippy.modules.Promise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.adapter.monitor.HippyEngineMonitorAdapter;
|
||||
import com.tencent.mtt.hippy.adapter.thirdparty.HippyThirdPartyAdapter;
|
||||
import com.tencent.mtt.hippy.bridge.HippyBridgeManager;
|
||||
@@ -50,6 +49,7 @@ import com.tencent.mtt.hippy.devsupport.DevServerCallBack;
|
||||
import com.tencent.mtt.hippy.devsupport.DevSupportManager;
|
||||
import com.tencent.mtt.hippy.modules.HippyModuleManager;
|
||||
import com.tencent.mtt.hippy.modules.HippyModuleManagerImpl;
|
||||
import com.tencent.mtt.hippy.modules.HippyModulePromise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.modules.javascriptmodules.Dimensions;
|
||||
import com.tencent.mtt.hippy.modules.javascriptmodules.EventDispatcher;
|
||||
import com.tencent.mtt.hippy.modules.nativemodules.deviceevent.DeviceEventModule;
|
||||
@@ -891,15 +891,15 @@ public abstract class HippyEngineManagerImpl extends HippyEngineManager implemen
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if (mLinkHelper != null) {
|
||||
mLinkHelper.destroy();
|
||||
}
|
||||
if (mBridgeManager != null) {
|
||||
mBridgeManager.destroy();
|
||||
}
|
||||
if (mModuleManager != null) {
|
||||
mModuleManager.destroy();
|
||||
}
|
||||
if (mLinkHelper != null) {
|
||||
mLinkHelper.destroy();
|
||||
}
|
||||
if (mEngineLifecycleEventListeners != null) {
|
||||
mEngineLifecycleEventListeners.clear();
|
||||
}
|
||||
|
||||
+1
-3
@@ -15,15 +15,13 @@
|
||||
*/
|
||||
package com.tencent.mtt.hippy.bridge;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import com.tencent.mtt.hippy.HippyEngine;
|
||||
import com.tencent.mtt.hippy.modules.Promise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.HippyRootView;
|
||||
import com.tencent.mtt.hippy.adapter.thirdparty.HippyThirdPartyAdapter;
|
||||
import com.tencent.mtt.hippy.bridge.bundleloader.HippyBundleLoader;
|
||||
import com.tencent.mtt.hippy.common.Callback;
|
||||
import com.tencent.mtt.hippy.common.HippyJsException;
|
||||
import com.tencent.mtt.hippy.common.HippyMap;
|
||||
import com.tencent.mtt.hippy.modules.HippyModulePromise.BridgeTransferType;
|
||||
|
||||
@SuppressWarnings({"deprecation", "unused"})
|
||||
public interface HippyBridgeManager {
|
||||
|
||||
+1
-3
@@ -23,13 +23,10 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import com.tencent.mtt.hippy.HippyEngine;
|
||||
import com.tencent.mtt.hippy.modules.Promise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.HippyEngine.ModuleLoadStatus;
|
||||
import com.tencent.mtt.hippy.HippyEngine.V8InitParams;
|
||||
import com.tencent.mtt.hippy.HippyEngineContext;
|
||||
import com.tencent.mtt.hippy.adapter.monitor.HippyEngineMonitorEvent;
|
||||
import com.tencent.mtt.hippy.adapter.thirdparty.HippyThirdPartyAdapter;
|
||||
import com.tencent.mtt.hippy.bridge.bundleloader.HippyBundleLoader;
|
||||
import com.tencent.mtt.hippy.bridge.jsi.TurboModuleManager;
|
||||
@@ -38,6 +35,7 @@ import com.tencent.mtt.hippy.common.HippyArray;
|
||||
import com.tencent.mtt.hippy.common.HippyJsException;
|
||||
import com.tencent.mtt.hippy.common.HippyMap;
|
||||
import com.tencent.mtt.hippy.modules.HippyModuleManager;
|
||||
import com.tencent.mtt.hippy.modules.HippyModulePromise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.runtime.builtins.JSValue;
|
||||
import com.tencent.mtt.hippy.serialization.PrimitiveValueSerializer;
|
||||
import com.tencent.mtt.hippy.serialization.compatible.Serializer;
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/* Tencent is pleased to support the open source community by making Hippy available.
|
||||
* Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.tencent.mtt.hippy.modules;
|
||||
|
||||
@SuppressWarnings({"unused"})
|
||||
public interface HippyModulePromise extends Promise {
|
||||
|
||||
String CALL_ID_NO_CALLBACK = "-1";
|
||||
|
||||
enum BridgeTransferType {
|
||||
BRIDGE_TRANSFER_TYPE_NORMAL(0),
|
||||
BRIDGE_TRANSFER_TYPE_NIO(1);
|
||||
|
||||
private final int iValue;
|
||||
|
||||
BridgeTransferType(int value) {
|
||||
iValue = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return iValue;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isCallback();
|
||||
|
||||
String getCallId();
|
||||
|
||||
void setTransferType(BridgeTransferType type);
|
||||
}
|
||||
@@ -18,16 +18,13 @@ package com.tencent.mtt.hippy.modules;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.tencent.mtt.hippy.modules.Promise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.HippyEngineContext;
|
||||
import com.tencent.mtt.hippy.common.HippyMap;
|
||||
import com.tencent.mtt.hippy.runtime.builtins.JSMap;
|
||||
import com.tencent.mtt.hippy.runtime.builtins.JSObject;
|
||||
import com.tencent.mtt.hippy.runtime.builtins.JSValue;
|
||||
import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings({"deprecation", "unused"})
|
||||
public class PromiseImpl implements Promise {
|
||||
public class PromiseImpl implements HippyModulePromise {
|
||||
|
||||
public static final int PROMISE_CODE_SUCCESS = 0;
|
||||
public static final int PROMISE_CODE_NORMAN_ERROR = 1;
|
||||
|
||||
+1
-1
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.tencent.mtt.hippy.modules.javascriptmodules;
|
||||
|
||||
import com.tencent.mtt.hippy.modules.Promise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.common.HippyMap;
|
||||
import com.tencent.mtt.hippy.modules.HippyModulePromise.BridgeTransferType;
|
||||
|
||||
@SuppressWarnings({"unused", "deprecation"})
|
||||
public interface EventDispatcher extends HippyJavaScriptModule {
|
||||
|
||||
+2
-2
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.tencent.mtt.hippy.modules.javascriptmodules;
|
||||
|
||||
import static com.tencent.mtt.hippy.modules.Promise.BridgeTransferType.BRIDGE_TRANSFER_TYPE_NORMAL;
|
||||
import static com.tencent.mtt.hippy.modules.HippyModulePromise.BridgeTransferType.BRIDGE_TRANSFER_TYPE_NORMAL;
|
||||
|
||||
import com.tencent.mtt.hippy.modules.Promise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.HippyEngineContext;
|
||||
import com.tencent.mtt.hippy.common.HippyArray;
|
||||
import com.tencent.mtt.hippy.modules.HippyModulePromise.BridgeTransferType;
|
||||
import com.tencent.mtt.hippy.utils.ArgumentUtils;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
|
||||
@@ -35,6 +35,10 @@ jint OnCreateNativeRenderProvider(JNIEnv* j_env,
|
||||
jobject j_obj,
|
||||
jfloat j_density);
|
||||
|
||||
void OnDestroyNativeRenderProvider(JNIEnv* j_env,
|
||||
jobject j_object,
|
||||
jint j_instance_id);
|
||||
|
||||
void UpdateRootSize(JNIEnv* j_env, jobject j_obj, jint j_instance_id,
|
||||
jfloat width, jfloat height);
|
||||
|
||||
|
||||
@@ -41,6 +41,11 @@ REGISTER_JNI("com/tencent/renderer/NativeRenderProvider",
|
||||
"(F)I",
|
||||
OnCreateNativeRenderProvider)
|
||||
|
||||
REGISTER_JNI("com/tencent/renderer/NativeRenderProvider",
|
||||
"onDestroyNativeRenderProvider",
|
||||
"(I)V",
|
||||
OnDestroyNativeRenderProvider)
|
||||
|
||||
REGISTER_JNI("com/tencent/renderer/NativeRenderProvider",
|
||||
"onRootSizeChanged",
|
||||
"(IFF)V",
|
||||
@@ -70,6 +75,9 @@ jint OnCreateNativeRenderProvider(JNIEnv* j_env, jobject j_object, jfloat j_dens
|
||||
return hippy_render_manager->GetId();
|
||||
}
|
||||
|
||||
void OnDestroyNativeRenderProvider(JNIEnv* j_env, jobject j_object, jint j_instance_id) {
|
||||
}
|
||||
|
||||
void UpdateRootSize(JNIEnv *j_env, jobject j_object, jint j_instance_id,
|
||||
jfloat j_width, jfloat j_height) {
|
||||
std::shared_ptr<Runtime> runtime = Runtime::Find(j_instance_id);
|
||||
|
||||
@@ -15,33 +15,12 @@
|
||||
*/
|
||||
package com.tencent.mtt.hippy.modules;
|
||||
|
||||
@SuppressWarnings({"unused"})
|
||||
public interface Promise {
|
||||
|
||||
String CALL_ID_NO_CALLBACK = "-1";
|
||||
|
||||
enum BridgeTransferType {
|
||||
BRIDGE_TRANSFER_TYPE_NORMAL(0),
|
||||
BRIDGE_TRANSFER_TYPE_NIO(1);
|
||||
|
||||
private final int iValue;
|
||||
|
||||
BridgeTransferType(int value) {
|
||||
iValue = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return iValue;
|
||||
}
|
||||
}
|
||||
int PROMISE_CODE_RESOLVE = 0;
|
||||
int PROMISE_CODE_REJECT = 2;
|
||||
|
||||
void resolve(Object value);
|
||||
|
||||
void reject(Object error);
|
||||
|
||||
boolean isCallback();
|
||||
|
||||
String getCallId();
|
||||
|
||||
void setTransferType(BridgeTransferType type);
|
||||
}
|
||||
|
||||
+1
-5
@@ -288,11 +288,7 @@ public class ControllerManager {
|
||||
Promise promise) {
|
||||
HippyViewController hippyViewController = mControllerRegistry.getViewController(className);
|
||||
View view = mControllerRegistry.getView(id);
|
||||
if (!promise.isCallback()) {
|
||||
hippyViewController.dispatchFunction(view, functionName, var);
|
||||
} else {
|
||||
hippyViewController.dispatchFunction(view, functionName, var, promise);
|
||||
}
|
||||
hippyViewController.dispatchFunction(view, functionName, var, promise);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -779,7 +779,7 @@ public class HippyListView extends RecyclerView implements HippyViewBase {
|
||||
|
||||
private OnInitialListReadyEvent getOnInitialListReadyEvent() {
|
||||
if (mOnInitialListReadyEvent == null) {
|
||||
mOnInitialListReadyEvent = new OnInitialListReadyEvent("initialListReady");
|
||||
mOnInitialListReadyEvent = new OnInitialListReadyEvent("initiallistready");
|
||||
}
|
||||
return mOnInitialListReadyEvent;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ public final class NativeRenderContext extends ContextWrapper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set renderer instance id, use default access permission.
|
||||
* Set renderer instance id, use default access permission,
|
||||
* the instance id should not change by user.
|
||||
*
|
||||
* @param instanceId renderer instance id
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,5 @@ public interface NativeRenderDelegate extends NativeRenderExceptionHandler {
|
||||
|
||||
long measure(int id, float width, int widthMode, float height, int heightMode);
|
||||
|
||||
void startBatch();
|
||||
|
||||
void endBatch();
|
||||
}
|
||||
|
||||
+23
-22
@@ -61,6 +61,7 @@ public class NativeRenderProvider {
|
||||
|
||||
public void destroy() {
|
||||
mDeserializer.getStringTable().release();
|
||||
onDestroyNativeRenderProvider(mInstanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,8 +71,8 @@ public class NativeRenderProvider {
|
||||
* @param buffer the byte array from native (C++) DOM wrapped by {@link ByteBuffer}
|
||||
* @return the result {@link ArrayList} of deserialize
|
||||
*/
|
||||
private @NonNull
|
||||
ArrayList<Object> bytesToArgument(ByteBuffer buffer) {
|
||||
@NonNull
|
||||
private ArrayList<Object> bytesToArgument(ByteBuffer buffer) {
|
||||
final BinaryReader binaryReader;
|
||||
if (mSafeHeapReader == null) {
|
||||
mSafeHeapReader = new SafeHeapReader();
|
||||
@@ -92,8 +93,8 @@ public class NativeRenderProvider {
|
||||
* @param params the ui event params object
|
||||
* @return the result of serialization wrapped by {@link ByteBuffer}
|
||||
*/
|
||||
private @NonNull
|
||||
ByteBuffer argumentToBytes(@NonNull Object params) {
|
||||
@NonNull
|
||||
private ByteBuffer argumentToBytes(@NonNull Object params) {
|
||||
if (mSafeHeapWriter == null) {
|
||||
mSafeHeapWriter = new SafeHeapWriter();
|
||||
} else {
|
||||
@@ -123,7 +124,7 @@ public class NativeRenderProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call from native (C++) render manager to updateNode render node
|
||||
* Call from native (C++) render manager to update render node
|
||||
*
|
||||
* @param buffer the byte array serialize by native (C++)
|
||||
*/
|
||||
@@ -219,15 +220,6 @@ public class NativeRenderProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call from native (C++) render manager to mark batch start
|
||||
*/
|
||||
@CalledByNative
|
||||
@SuppressWarnings("unused")
|
||||
private void startBatch() {
|
||||
mRenderDelegate.startBatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call from native (C++) render manager to mark batch end
|
||||
*/
|
||||
@@ -241,8 +233,8 @@ public class NativeRenderProvider {
|
||||
onRootSizeChanged(mInstanceId, PixelUtil.px2dp(width), PixelUtil.px2dp(height));
|
||||
}
|
||||
|
||||
public void doPromiseCallBack(int result, String functionName, int nodeId,
|
||||
Object params) {
|
||||
public void doPromiseCallBack(int result, @NonNull String functionName, int nodeId,
|
||||
@Nullable Object params) {
|
||||
byte[] bytes = null;
|
||||
int offset = 0;
|
||||
int length = 0;
|
||||
@@ -255,12 +247,13 @@ public class NativeRenderProvider {
|
||||
bytes = buffer.array();
|
||||
} catch (Exception e) {
|
||||
mRenderDelegate.handleRenderException(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
doCallBack(mInstanceId, result, functionName, nodeId, bytes, offset, length);
|
||||
}
|
||||
|
||||
public void dispatchEvent(int nodeId, String eventName, @Nullable Object params,
|
||||
public void dispatchEvent(int nodeId, @NonNull String eventName, @Nullable Object params,
|
||||
boolean useCapture, boolean useBubble) {
|
||||
byte[] bytes = null;
|
||||
int offset = 0;
|
||||
@@ -274,6 +267,7 @@ public class NativeRenderProvider {
|
||||
bytes = buffer.array();
|
||||
} catch (Exception e) {
|
||||
mRenderDelegate.handleRenderException(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
onReceivedEvent(mInstanceId, nodeId, eventName, bytes, offset, length, useCapture,
|
||||
@@ -281,16 +275,23 @@ public class NativeRenderProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create provider when renderer init, and should notify native (C++) to build render manager
|
||||
* Notify native (C++) to build render manager when build provider instance.
|
||||
*
|
||||
* @param density screen displayMetrics density
|
||||
* @return the unique id of native (C++) render manager
|
||||
*/
|
||||
private native int onCreateNativeRenderProvider(float density);
|
||||
|
||||
/**
|
||||
* Notify native (C++) to destroy render manager when release provider instance.
|
||||
*
|
||||
* @param instanceId the unique id of native (C++) render manager
|
||||
*/
|
||||
private native void onDestroyNativeRenderProvider(int instanceId);
|
||||
|
||||
/**
|
||||
* Call back from Android system when size changed, just like horizontal and vertical screen
|
||||
* switching, call this jni interface to invoke dom tree relayout
|
||||
* switching, call this jni interface to invoke dom tree relayout.
|
||||
*
|
||||
* @param instanceId the unique id of native (C++) render manager
|
||||
* @param width root view new width use dp unit
|
||||
@@ -299,7 +300,7 @@ public class NativeRenderProvider {
|
||||
private native void onRootSizeChanged(int instanceId, float width, float height);
|
||||
|
||||
/**
|
||||
* Dispatch event generated by native renderer to (C++) dom manager,
|
||||
* Dispatch event generated by native renderer to (C++) dom manager.
|
||||
*
|
||||
* @param instanceId the unique id of native (C++) render manager
|
||||
* @param nodeId target node id
|
||||
@@ -317,8 +318,8 @@ public class NativeRenderProvider {
|
||||
* Do promise call back to js after handle call ui function by native renderer,
|
||||
*
|
||||
* @param instanceId the unique id of native (C++) render manager
|
||||
* @param result {@code PROMISE_CODE_RESOLVE} {@link NativeRenderPromise}
|
||||
* {@code PROMISE_CODE_REJECT} {@link NativeRenderPromise}
|
||||
* @param result {@code PROMISE_CODE_RESOLVE} {@link UIPromise}
|
||||
* {@code PROMISE_CODE_REJECT} {@link UIPromise}
|
||||
* @param functionName ui function name
|
||||
* @param nodeId the dom node id
|
||||
* @param params params buffer encoded by serializer
|
||||
|
||||
@@ -647,7 +647,7 @@ public class NativeRenderer implements NativeRender, NativeRenderProxy, NativeRe
|
||||
throw new NativeRenderException(INVALID_NODE_DATA_ERR,
|
||||
TAG + ": callUIFunction: invalid negative id=" + id);
|
||||
}
|
||||
final NativeRenderPromise promise = new NativeRenderPromise(functionName, id,
|
||||
final UIPromise promise = new UIPromise(functionName, id,
|
||||
mRenderProvider.getInstanceId());
|
||||
try {
|
||||
// It is generally preferable to use add here, just focus the exception
|
||||
@@ -675,11 +675,6 @@ public class NativeRenderer implements NativeRender, NativeRenderProxy, NativeRe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startBatch() {
|
||||
// TODO: Just keep this method even if it don't do anything.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endBatch() {
|
||||
try {
|
||||
|
||||
+4
-3
@@ -33,12 +33,13 @@ public class NativeRendererManager {
|
||||
sNativeRendererMap.remove(instanceId);
|
||||
}
|
||||
|
||||
public @Nullable static NativeRender getNativeRenderer(Integer instanceId) {
|
||||
@Nullable
|
||||
public static NativeRender getNativeRenderer(Integer instanceId) {
|
||||
return sNativeRendererMap.get(instanceId);
|
||||
}
|
||||
|
||||
public @Nullable
|
||||
static NativeRender getNativeRenderer(@Nullable Context context) {
|
||||
@Nullable
|
||||
public static NativeRender getNativeRenderer(@Nullable Context context) {
|
||||
if (context instanceof NativeRenderContext) {
|
||||
final int instanceId = ((NativeRenderContext) context).getInstanceId();
|
||||
return getNativeRenderer(instanceId);
|
||||
|
||||
+2
-18
@@ -17,34 +17,18 @@ package com.tencent.renderer;
|
||||
|
||||
import com.tencent.mtt.hippy.modules.Promise;
|
||||
|
||||
public class NativeRenderPromise implements Promise {
|
||||
public class UIPromise implements Promise {
|
||||
|
||||
private static final int PROMISE_CODE_RESOLVE = 0;
|
||||
private static final int PROMISE_CODE_REJECT = 2;
|
||||
private final int mNodeId;
|
||||
private final int mInstanceId;
|
||||
private final String mFunctionName;
|
||||
|
||||
public NativeRenderPromise(String functionName, int nodeId, int instanceId) {
|
||||
public UIPromise(String functionName, int nodeId, int instanceId) {
|
||||
mFunctionName = functionName;
|
||||
mNodeId = nodeId;
|
||||
mInstanceId = instanceId;
|
||||
}
|
||||
|
||||
public String getCallId() {
|
||||
return CALL_ID_NO_CALLBACK;
|
||||
}
|
||||
|
||||
public boolean isCallback() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransferType(BridgeTransferType type) {
|
||||
// Native Render only support normal transfer type, NIO is not applicable here,
|
||||
// so just override this method, no need to do anything.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve(Object params) {
|
||||
doCallback(PROMISE_CODE_RESOLVE, params);
|
||||
+8
-9
@@ -110,16 +110,15 @@ public class TextGestureSpan implements NativeGestureProcessor.Callback {
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_UP: {
|
||||
if (mGestureTypes.contains(ON_LONG_CLICK) || mGestureTypes.contains(ON_CLICK)) {
|
||||
if (Math.abs(x - mLastX) < mTouchSlop && Math.abs(y - mLastY) < mTouchSlop) {
|
||||
if (Math.abs(x - mLastX) < mTouchSlop && Math.abs(y - mLastY) < mTouchSlop) {
|
||||
if (mGestureTypes.contains(ON_LONG_CLICK) && mHandleLongPress) {
|
||||
handle = true;
|
||||
if (mGestureTypes.contains(ON_LONG_CLICK) && mHandleLongPress) {
|
||||
NativeGestureDispatcher
|
||||
.handleClickEvent(mNativeRenderer, mId, ON_LONG_CLICK);
|
||||
} else if (mGestureTypes.contains(ON_CLICK)) {
|
||||
NativeGestureDispatcher
|
||||
.handleClickEvent(mNativeRenderer, mId, ON_CLICK);
|
||||
}
|
||||
NativeGestureDispatcher
|
||||
.handleClickEvent(mNativeRenderer, mId, ON_LONG_CLICK);
|
||||
} else if (mGestureTypes.contains(ON_CLICK)) {
|
||||
handle = true;
|
||||
NativeGestureDispatcher
|
||||
.handleClickEvent(mNativeRenderer, mId, ON_CLICK);
|
||||
}
|
||||
}
|
||||
if (mHandler != null) {
|
||||
|
||||
Reference in New Issue
Block a user