public void startWidget(String[] parm) { if (parm.length < 4) { return; } EBrowserWindow curWind = mBrwView.getBrowserWindow(); if (null == curWind) { return; } String inAppId = parm[0]; String inAnimiId = parm[1]; String inForResult = parm[2]; String inInfo = parm[3]; String animDuration = null; String appKey = null; if (parm.length == 5) { animDuration = parm[4]; } if (parm.length == 6) { appKey = parm[5]; } int animId = EBrowserAnimation.ANIM_ID_NONE; long duration = EBrowserAnimation.defaultDuration; try { if (null != inAnimiId && inAnimiId.length() != 0) { animId = Integer.parseInt(inAnimiId); } if (null != animDuration && animDuration.length() != 0) { duration = Long.parseLong(animDuration); } } catch (Exception e) {; } try { WDataManager widgetData = new WDataManager(mContext); // WWidgetData data = widgetData.getWidgetDataByAppId(inAppId, // mBrwView.getCurrentWidget()); // 修改可以子widget可以打开子widget WWidgetData data = widgetData.getWidgetDataByAppId(inAppId, mBrwView.getRootWidget()); if (data == null) { showErrorAlert("AppId为 " + inAppId + " 的Widget不存在"); jsCallback(function_startWidget, 0, EUExCallback.F_C_INT, EUExCallback.F_C_FAILED); return; } data.m_appkey = appKey; EWgtResultInfo info = new EWgtResultInfo(inForResult, inInfo); info.setAnimiId(animId); info.setDuration(duration); if (startWidget(data, info)) { jsCallback(function_startWidget, 0, EUExCallback.F_C_INT, EUExCallback.F_C_SUCCESS); } else { jsCallback(function_startWidget, 0, EUExCallback.F_C_INT, EUExCallback.F_C_FAILED); } } catch (Exception e) { e.printStackTrace(); showErrorAlert("搜索Widget发生异常!请确认Widget是否损坏!"); jsCallback(function_startWidget, 0, EUExCallback.F_C_INT, EUExCallback.F_C_FAILED); } }
public void setLogServerIp(String[] params) { if (params.length < 2) { return; } int debug = 0; WWidgetData widgetData = mBrwView.getCurrentWidget(); widgetData.m_logServerIp = params[0]; try { debug = Integer.parseInt(params[1]); } catch (NumberFormatException e) { e.printStackTrace(); } widgetData.m_appdebug = debug; }
private void printError( int errorCode, String description, String failingUrl, WWidgetData errorWgt) { try { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); String time = formatter.format(new Date()); String fileName = time + ".log"; if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { String ePath = Environment.getExternalStorageDirectory().getAbsolutePath(); String path = ePath + "/widgetone/log/pageloaderror/"; File dir = new File(path); if (!dir.exists()) { dir.mkdirs(); } StringBuffer sb = new StringBuffer(); sb.append("failingDes: " + description); sb.append("\n"); sb.append("failingUrl: " + failingUrl); sb.append("\n"); sb.append("errorCode: " + errorCode); sb.append("\n"); if (null != errorWgt) { sb.append(errorWgt.toString()); } FileOutputStream fos = new FileOutputStream(path + fileName); fos.write(sb.toString().getBytes()); fos.flush(); fos.close(); } } catch (Exception e) { e.printStackTrace(); } }
private final void initEngine(Message resultMsg) { if (resultMsg.arg1 == 0) { loadResError(); return; } ACEDes.getObfuscationList(); WWidgetData rootWidget = (WWidgetData) resultMsg.obj; // String[] plugins = {"uexXmlHttpMgr", "uexCamera"}; // rootWidget.disablePlugins = plugins; changeConfiguration(rootWidget.m_orientation); EBrowserWidgetPool eBrwWidPo = new EBrowserWidgetPool(mBrowser, mEBrwMainFrame, mBrowserAround); mBrowser.init(eBrwWidPo); // rootWidget.m_indexUrl = "http://xhsnbjlxt.cloud7.com.cn"; // rootWidget.m_indexUrl = "http://192.168.1.38:8080/ldx/index.html"; eBrwWidPo.init(rootWidget); mBrowserAround.init(eBrwWidPo); mEBrwMainFrame.init(mBrowser); mBrowserAround.setSpaceFlag(rootWidget.getSpaceStatus()); mEHandler.sendMessageDelayed(mEHandler.obtainMessage(EHandler.F_MSG_LOAD_DELAY), 100); WidgetOneApplication app = (WidgetOneApplication) getApplication(); app.widgetRegist(rootWidget, this); }