com.taobao.weex.common.WXErrorCode Java Examples
The following examples show how to use
com.taobao.weex.common.WXErrorCode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXSoInstallMgrSdk.java From weex-uikit with MIT License | 6 votes |
/** * Load .so library */ static boolean _loadUnzipSo(String libName, int version, IWXUserTrackAdapter utAdapter) { boolean initSuc = false; try { if (isExist(libName, version)) { System.load(_targetSoFile(libName, version)); commit(utAdapter, "2000", "Load file extract from apk successfully."); } initSuc = true; } catch (Throwable e) { commit(utAdapter, WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorCode(), WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorMsg() + ":" + e.getMessage()); initSuc = false; WXLogUtils.e("", e); } return initSuc; }
Example #2
Source File: WXBridgeManager.java From ucar-weex-core with Apache License 2.0 | 6 votes |
public void commitJSFrameworkAlarmMonitor(final String type, final WXErrorCode errorCode, String errMsg) { if (TextUtils.isEmpty(type) || errorCode == null) { return; } if (WXSDKManager.getInstance().getWXStatisticsListener() != null) { WXSDKManager.getInstance().getWXStatisticsListener().onException("0", errorCode.getErrorCode(), TextUtils.isEmpty(errMsg) ? errorCode.getErrorMsg() : errMsg); } final IWXUserTrackAdapter userTrackAdapter = WXSDKManager.getInstance().getIWXUserTrackAdapter(); if (userTrackAdapter == null) { return; } WXPerformance performance = new WXPerformance(); performance.errCode = errorCode.getErrorCode(); if (errorCode != WXErrorCode.WX_SUCCESS) { performance.appendErrMsg(TextUtils.isEmpty(errMsg)?errorCode.getErrorMsg():errMsg); WXLogUtils.e("wx_monitor",performance.toString()); } userTrackAdapter.commit(WXEnvironment.getApplication(), null, type, performance, null); }
Example #3
Source File: WXBridgeManager.java From ucar-weex-core with Apache License 2.0 | 6 votes |
public void commitJSBridgeAlarmMonitor(String instanceId, WXErrorCode errCode, String errMsg) { WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId); if (instance == null || errCode == null) { return; } // TODO: We should move WXPerformance and IWXUserTrackAdapter // into a adapter level. // comment out the line below to prevent commiting twice. //instance.commitUTStab(WXConst.JS_BRIDGE, errCode, errMsg); IWXUserTrackAdapter adapter = WXSDKManager.getInstance().getIWXUserTrackAdapter(); if (adapter == null) { return; } WXPerformance performance = new WXPerformance(); performance.args=instance.getBundleUrl(); performance.errCode=errCode.getErrorCode(); if (errCode != WXErrorCode.WX_SUCCESS) { performance.appendErrMsg(TextUtils.isEmpty(errMsg)?errCode.getErrorMsg():errMsg); WXLogUtils.e("wx_monitor",performance.toString()); } adapter.commit(WXEnvironment.getApplication(), null, IWXUserTrackAdapter.JS_BRIDGE, performance, instance.getUserTrackParams()); }
Example #4
Source File: WXBridgeManager.java From ucar-weex-core with Apache License 2.0 | 6 votes |
/** * Report JavaScript Exception */ public void reportJSException(String instanceId, String function, String exception) { if (WXEnvironment.isApkDebugable()) { WXLogUtils.e("reportJSException >>>> instanceId:" + instanceId + ", exception function:" + function + ", exception:" + exception); } WXSDKInstance instance; if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId)) != null) { instance.onJSException(WXErrorCode.WX_ERR_JS_EXECUTE.getErrorCode(), function, exception); String err = "function:" + function + "#exception:" + exception; commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_JS_EXECUTE, err); IWXJSExceptionAdapter adapter = WXSDKManager.getInstance().getIWXJSExceptionAdapter(); if (adapter != null) { WXJSExceptionInfo jsException = new WXJSExceptionInfo(instanceId, instance.getBundleUrl(), WXErrorCode.WX_ERR_JS_EXECUTE.getErrorCode(), function, exception, null); adapter.onJSException(jsException); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d(jsException.toString()); } } } }
Example #5
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * Create a command object for scroll the given view to the specified position. * @param ref {@link WXDomObject#ref} of the dom. * @param options the specified position */ void scrollToDom(final String ref, final JSONObject options) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.scrollToComponent(mInstanceId, ref, options); } }); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #6
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * Create a command object for notifying {@link WXRenderManager} that the process of creating * given view is finished, and put the command object in the queue. */ void createFinish() { if (mDestroy) { return; } final WXDomObject root = mRegistry.get(WXDomObject.ROOT); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.createFinish(mInstanceId, (int) root.getLayoutWidth(), (int) root.getLayoutHeight()); } }); mDirty = true; WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #7
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * Create a command object for notifying {@link WXRenderManager} that the process of refreshing * given view is finished, and put the command object in the queue. */ void refreshFinish() { if (mDestroy) { return; } final WXDomObject root = mRegistry.get(WXDomObject.ROOT); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { int realWidth = (int) root.getLayoutWidth(); int realHeight = (int) root.getLayoutHeight(); mWXRenderManager.refreshFinish(mInstanceId, realWidth, realHeight); } }); mDirty = true; WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #8
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * Create a command object for notifying {@link WXRenderManager} that the process of update * given view is finished, and put the command object in the queue. */ void updateFinish() { if (mDestroy) { return; } mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.updateFinish(mInstanceId); } }); mDirty = true; WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #9
Source File: WXBridgeManager.java From ucar-weex-core with Apache License 2.0 | 6 votes |
public Object callNativeComponent(String instanceId, String componentRef, String method, JSONArray arguments, Object options) { if (WXEnvironment.isApkDebugable()) { mLodBuilder.append("[WXBridgeManager] callNativeComponent >>>> instanceId:").append(instanceId) .append(", componentRef:").append(componentRef).append(", method:").append(method).append(", arguments:").append(arguments); WXLogUtils.d(mLodBuilder.substring(0)); mLodBuilder.setLength(0); } try { WXDomModule dom = getDomModule(instanceId); dom.invokeMethod(componentRef, method, arguments); } catch (Exception e) { WXLogUtils.e("[WXBridgeManager] callNative exception: ", e); commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_INVOKE_NATIVE, "[WXBridgeManager] callNativeModule exception " + e.getCause()); } return null; }
Example #10
Source File: WXBridgeManager.java From ucar-weex-core with Apache License 2.0 | 6 votes |
public Object callNativeModule(String instanceId, String module, String method, JSONArray arguments, Object options) { if (WXEnvironment.isApkDebugable()) { mLodBuilder.append("[WXBridgeManager] callNativeModule >>>> instanceId:").append(instanceId) .append(", module:").append(module).append(", method:").append(method).append(", arguments:").append(arguments); WXLogUtils.d(mLodBuilder.substring(0)); mLodBuilder.setLength(0); } try { if(WXDomModule.WXDOM.equals(module)){ WXDomModule dom = getDomModule(instanceId); return dom.callDomMethod(method,arguments); }else { return callModuleMethod(instanceId, module, method, arguments); } } catch (Exception e) { WXLogUtils.e("[WXBridgeManager] callNative exception: ", e); commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_INVOKE_NATIVE, "[WXBridgeManager] callNativeModule exception " + e.getCause()); } return null; }
Example #11
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * Update the {@link WXDomObject#style} according to the given style. Then creating a * command object for updating corresponding view and put the command object in the queue. * @param ref {@link WXDomObject#ref} of the dom. * @param style the new style. This style is only a part of the full style, and will be merged * into {@link WXDomObject#style} * @see #updateAttrs(String, JSONObject) */ void updateStyle(String ref, JSONObject style) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATESTYLE); } return; } domObject.updateStyle(style); transformStyle(domObject, false); updateStyle(domObject, style); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #12
Source File: WXSoInstallMgrSdk.java From ucar-weex-core with Apache License 2.0 | 6 votes |
/** * Load .so library */ static boolean _loadUnzipSo(String libName, int version, IWXUserTrackAdapter utAdapter) { boolean initSuc = false; try { if (isExist(libName, version)) { // If a library loader adapter exists, use this adapter to load library // instead of System.load. if (mSoLoader != null) { mSoLoader.doLoad(_targetSoFile(libName, version)); } else { System.load(_targetSoFile(libName, version)); } commit(utAdapter, "2000", "Load file extract from apk successfully."); } initSuc = true; } catch (Throwable e) { commit(utAdapter, WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorCode(), WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorMsg() + ":" + e.getMessage()); initSuc = false; WXLogUtils.e("", e); } return initSuc; }
Example #13
Source File: WXBridgeManager.java From weex with Apache License 2.0 | 6 votes |
/** * Report JavaScript Exception */ public void reportJSException(String instanceId, String function, String exception) { if (WXEnvironment.isApkDebugable()) { WXLogUtils.e("reportJSException >>>> instanceId:" + instanceId + ", exception function:" + function + ", exception:" + exception); } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance( instanceId); if (instance != null) { // TODO add errCode instance.onJSException(null, function, exception); } WXErrorCode.WX_ERR_JS_EXECUTE.appendErrMsg(exception); commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_JS_EXECUTE); }
Example #14
Source File: WXBridgeManager.java From weex with Apache License 2.0 | 6 votes |
private void invokeDestroyInstance(String instanceId) { try { if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("destroyInstance >>>> instanceId:" + instanceId); } WXJSObject instanceIdObj = new WXJSObject(WXJSObject.String, instanceId); WXJSObject[] args = {instanceIdObj}; mWXBridge.execJS(instanceId, null, METHOD_DESTROY_INSTANCE, args); commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_SUCCESS); } catch (Throwable e) { String err = "[WXBridgeManager] invokeDestroyInstance " + e.getCause(); WXErrorCode.WX_ERR_INVOKE_NATIVE.appendErrMsg(err); commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_INVOKE_NATIVE); WXLogUtils.e(err); } }
Example #15
Source File: UpdateAttributeAction.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); final WXDomObject domObject = context.getDomByRef(mRef); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATEATTRS); } return; } domObject.updateAttr(mData); context.postRenderTask(this); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #16
Source File: WXSDKInstance.java From weex-uikit with MIT License | 6 votes |
/** * UserTrack Log */ public void commitUTStab(final String type, final WXErrorCode errorCode) { if (mUserTrackAdapter == null || TextUtils.isEmpty(type) || errorCode==null) { return; } runOnUiThread(new Runnable() { @Override public void run() { WXPerformance performance = new WXPerformance(); performance.errCode = errorCode.getErrorCode(); performance.args = errorCode.getArgs(); if (errorCode != WXErrorCode.WX_SUCCESS) { performance.errMsg = errorCode.getErrorMsg(); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d(performance.toString()); } } if( mUserTrackAdapter!= null) { mUserTrackAdapter.commit(mContext, null, type, performance, getUserTrackParams()); } } }); }
Example #17
Source File: WXDomStatement.java From weex-uikit with MIT License | 6 votes |
/** * Create a command object for notifying {@link WXRenderManager} that the process of update * given view is finished, and put the command object in the queue. */ void updateFinish() { if (mDestroy) { return; } mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.updateFinish(mInstanceId); } @Override public String toString() { return "updateFinish"; } }); WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #18
Source File: RemoveEventAction.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); WXDomObject domObject = context.getDomByRef(mRef); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT); } return; } domObject.removeEvent(mEvent); mUpdatedDomObject = domObject; context.postRenderTask(this); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #19
Source File: WXDomStatement.java From weex-uikit with MIT License | 6 votes |
/** * Create a command object for scroll the given view to the specified position. * @param ref Reference of the dom. * @param options the specified position */ void scrollToDom(final String ref, final JSONObject options) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.scrollToComponent(mInstanceId, ref, options); } @Override public String toString() { return "scrollToPosition"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #20
Source File: WXBridgeManager.java From weex-uikit with MIT License | 6 votes |
public Object callNativeModule(String instanceId, String module, String method, JSONArray arguments, Object options) { if (WXEnvironment.isApkDebugable()) { mLodBuilder.append("[WXBridgeManager] callNativeModule >>>> instanceId:").append(instanceId) .append(", module:").append(module).append(", method:").append(method).append(", arguments:").append(arguments); WXLogUtils.d(mLodBuilder.substring(0)); mLodBuilder.setLength(0); } try { if(WXDomModule.WXDOM.equals(module)){ WXDomModule dom = getDomModule(instanceId); return dom.callDomMethod(method,arguments); }else { return WXModuleManager.callModuleMethod(instanceId, module, method, arguments); } } catch (Exception e) { WXLogUtils.e("[WXBridgeManager] callNative exception: ", e); commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_INVOKE_NATIVE, "[WXBridgeManager] callNativeModule exception " + e.getCause()); } return null; }
Example #21
Source File: AddEventAction.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); WXDomObject domObject = context.getDomByRef(mRef); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_ADDEVENT); } return; } domObject.addEvent(mEvent); mUpdatedDom = domObject; context.postRenderTask(this); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #22
Source File: WXBridgeManager.java From weex-uikit with MIT License | 6 votes |
public Object callNativeComponent(String instanceId, String componentRef, String method, JSONArray arguments, Object options) { if (WXEnvironment.isApkDebugable()) { mLodBuilder.append("[WXBridgeManager] callNativeComponent >>>> instanceId:").append(instanceId) .append(", componentRef:").append(componentRef).append(", method:").append(method).append(", arguments:").append(arguments); WXLogUtils.d(mLodBuilder.substring(0)); mLodBuilder.setLength(0); } try { WXDomModule dom = getDomModule(instanceId); dom.invokeMethod(componentRef, method, arguments); } catch (Exception e) { WXLogUtils.e("[WXBridgeManager] callNative exception: ", e); commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_INVOKE_NATIVE, "[WXBridgeManager] callNativeModule exception " + e.getCause()); } return null; }
Example #23
Source File: WXBridgeManager.java From weex-uikit with MIT License | 6 votes |
/** * Report JavaScript Exception */ public void reportJSException(String instanceId, String function, String exception) { if (WXEnvironment.isApkDebugable()) { WXLogUtils.e("reportJSException >>>> instanceId:" + instanceId + ", exception function:" + function + ", exception:" + exception); } WXSDKInstance instance; if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId)) != null) { // TODO add errCode instance.onJSException(null, function, exception); String err="function:"+function+"#exception:"+exception; commitJSBridgeAlarmMonitor(instanceId,WXErrorCode.WX_ERR_JS_EXECUTE,err); } }
Example #24
Source File: WXSoInstallMgrSdk.java From weex with Apache License 2.0 | 6 votes |
/** * Load .so library */ static boolean _loadUnzipSo(String libName, int version, IWXUserTrackAdapter utAdapter) { boolean initSuc = false; try { if (isExist(libName, version)) { System.load(_targetSoFile(libName, version)); commit(utAdapter, "2000", "Load file extract from apk successfully."); } initSuc = true; } catch (Exception e) { commit(utAdapter, WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorCode(), WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorMsg() + ":" + e.getMessage()); initSuc = false; e.printStackTrace(); } catch (java.lang.UnsatisfiedLinkError e2) { commit(utAdapter, WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorCode(), WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorMsg() + ":" + e2.getMessage()); initSuc = false; e2.printStackTrace(); } catch (java.lang.Error e3) { commit(utAdapter, WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorCode(), WXErrorCode.WX_ERR_COPY_FROM_APK.getErrorMsg() + ":" + e3.getMessage()); initSuc = false; e3.printStackTrace(); } return initSuc; }
Example #25
Source File: WXDomStatement.java From weex-uikit with MIT License | 5 votes |
/** * Create a command object for adding a default event listener to the corresponding {@link * WXDomObject} and put the command object in the queue. * When the event is triggered, the eventListener will call {@link WXSDKManager#fireEvent(String, String, String)} * , and the JS will handle all the operations from there. * * @param ref Reference of the dom. * @param type the type of the event, this may be a plain event defined in * {@link com.taobao.weex.common.Constants.Event} or a gesture defined in {@link com.taobao * .weex.ui.view.gesture.WXGestureType} */ void addEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_ADDEVENT); } return; } domObject.addEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId,ref); if(comp != null){ //sync dom change to component comp.updateDom(domObject); mWXRenderManager.addEvent(mInstanceId, ref, type); } } @Override public String toString() { return "Add event"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #26
Source File: WXDomStatement.java From weex with Apache License 2.0 | 5 votes |
/** * Update the {@link WXDomObject#attr} according to the given attribute. Then creating a * command object for updating corresponding view and put the command object in the queue. * @param ref {@link WXDomObject#ref} of the dom. * @param attrs the new style. This style is only a part of the full attribute set, and will be * merged into {@link WXDomObject#attr} * @see #updateStyle(String, JSONObject) */ void updateAttrs(String ref, final JSONObject attrs) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATEATTRS); } return; } domObject.updateAttr(attrs); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.updateAttrs(mInstanceId, domObject.ref, attrs); } }); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #27
Source File: WXDomStatement.java From weex-uikit with MIT License | 5 votes |
/** * Update the attributes according to the given attribute. Then creating a * command object for updating corresponding view and put the command object in the queue. * @param ref Reference of the dom. * @param attrs the new style. This style is only a part of the full attribute set, and will be * merged into attributes * @see #updateStyle(String, JSONObject) */ void updateAttrs(String ref, final JSONObject attrs) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); final WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATEATTRS); } return; } domObject.updateAttr(attrs); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.updateAttrs(mInstanceId, domObject.getRef(), attrs); } @Override public String toString() { return "updateAttr"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #28
Source File: IndexActivity.java From incubator-weex-playground with Apache License 2.0 | 5 votes |
@Override public void onException(WXSDKInstance wxsdkInstance, String s, String s1) { super.onException(wxsdkInstance,s,s1); mProgressBar.setVisibility(View.GONE); mTipView.setVisibility(View.VISIBLE); if (TextUtils.equals(s, WXErrorCode.WX_DEGRAD_ERR_NETWORK_BUNDLE_DOWNLOAD_FAILED.getErrorCode())) { mTipView.setText(R.string.index_tip); } else { mTipView.setText("network render error:" + s1); } }
Example #29
Source File: WXDomStatement.java From weex with Apache License 2.0 | 5 votes |
/** * Create a command object for moving the specific {@link WXDomObject} to a new parent. * If any of the following situation is met, * <ul> * <li> dom to be moved is null </li> * <li> dom's parent is null </li> * <li> new parent is null </li> * <li> parent is under {@link CSSNode#hasNewLayout()} </li> * </ul> * this method will return. Otherwise, put the command object in the queue. * @param ref {@link WXDomObject#ref} of the dom to be moved. * @param parentRef {@link WXDomObject#ref} of the new parent DOM node * @param index the index of the dom to be inserted in the new parent. */ void moveDom(final String ref, final String parentRef, final int index) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); WXDomObject parentObject = mRegistry.get(parentRef); if (domObject == null || domObject.parent == null || parentObject == null || parentObject.hasNewLayout()) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_MOVEELEMENT); } return; } domObject.parent.remove(domObject); parentObject.add(domObject, index); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.moveComponent(mInstanceId, ref, parentRef, index); } }); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example #30
Source File: WXDomStatement.java From weex with Apache License 2.0 | 5 votes |
/** * Create a command object for removing the specified {@link WXDomObject}. * If the domObject is null or its parent is null, this method returns directly. * Otherwise, put the command object in the queue. * @param ref {@link WXDomObject#ref} of the dom. */ void removeDom(final String ref) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } WXDomObject parent = domObject.parent; if (parent == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } clearRegistryForDom(domObject); parent.remove(domObject); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.removeComponent(mInstanceId, ref); } }); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }