feat:add pureCallEntityMethod,avoid hook affects
This commit is contained in:
@@ -567,6 +567,36 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
||||
return getDoricContext().callEntity(DoricConstant.DORIC_ENTITY_RESPONSE, nArgs);
|
||||
}
|
||||
|
||||
public AsyncResult<JSDecoder> pureCallJSResponse(String funcId, Object... args) {
|
||||
final Object[] nArgs = new Object[args.length + 4];
|
||||
nArgs[0] = getDoricContext().getContextId();
|
||||
nArgs[1] = DoricConstant.DORIC_ENTITY_RESPONSE;
|
||||
nArgs[2] = getIdList();
|
||||
nArgs[3] = funcId;
|
||||
if (args.length > 0) {
|
||||
System.arraycopy(args, 0, nArgs, 4, args.length);
|
||||
}
|
||||
final AsyncResult<JSDecoder> asyncResult = new AsyncResult<>();
|
||||
getDoricContext().getDriver().invokeDoricMethod(DoricConstant.DORIC_CONTEXT_INVOKE_PURE, nArgs).setCallback(new AsyncResult.Callback<JSDecoder>() {
|
||||
@Override
|
||||
public void onResult(JSDecoder result) {
|
||||
asyncResult.setResult(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
getDoricContext().getDriver().getRegistry().onException(getDoricContext(), t instanceof Exception ? (Exception) t : new RuntimeException(t));
|
||||
asyncResult.setError(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
|
||||
}
|
||||
});
|
||||
return asyncResult;
|
||||
}
|
||||
|
||||
public static ViewNode create(DoricContext doricContext, String type) {
|
||||
DoricRegistry registry = doricContext.getDriver().getRegistry();
|
||||
DoricMetaInfo<ViewNode> clz = registry.acquireViewNodeInfo(type);
|
||||
|
@@ -103,7 +103,7 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
||||
}
|
||||
String id = itemValues.get(position);
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
AsyncResult<JSDecoder> asyncResult = flowLayoutNode.callJSResponse(
|
||||
AsyncResult<JSDecoder> asyncResult = flowLayoutNode.pureCallJSResponse(
|
||||
"renderBunchedItems",
|
||||
position,
|
||||
batchCount);
|
||||
|
@@ -103,7 +103,7 @@ class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> {
|
||||
start--;
|
||||
batchCount++;
|
||||
}
|
||||
AsyncResult<JSDecoder> asyncResult = listNode.callJSResponse(
|
||||
AsyncResult<JSDecoder> asyncResult = listNode.pureCallJSResponse(
|
||||
"renderBunchedItems",
|
||||
start,
|
||||
batchCount);
|
||||
|
@@ -105,7 +105,7 @@ class SlideAdapter extends RecyclerView.Adapter<SlideAdapter.DoricViewHolder> {
|
||||
|
||||
String id = itemValues.get(index);
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
AsyncResult<JSDecoder> asyncResult = sliderNode.callJSResponse(
|
||||
AsyncResult<JSDecoder> asyncResult = sliderNode.pureCallJSResponse(
|
||||
"renderBunchedItems",
|
||||
index,
|
||||
batchCount);
|
||||
|
@@ -59,6 +59,8 @@ public class DoricConstant {
|
||||
public static final String GLOBAL_DORIC = "doric";
|
||||
public static final String DORIC_CONTEXT_RELEASE = "jsReleaseContext";
|
||||
public static final String DORIC_CONTEXT_INVOKE = "jsCallEntityMethod";
|
||||
public static final String DORIC_CONTEXT_INVOKE_PURE = "pureCallEntityMethod";
|
||||
|
||||
public static final String DORIC_TIMER_CALLBACK = "jsCallbackTimer";
|
||||
public static final String DORIC_BRIDGE_RESOLVE = "jsCallResolve";
|
||||
public static final String DORIC_BRIDGE_REJECT = "jsCallReject";
|
||||
|
Reference in New Issue
Block a user