当前位置: 首页>>代码示例>>Java>>正文


Java WXSDKManager类代码示例

本文整理汇总了Java中com.taobao.weex.WXSDKManager的典型用法代码示例。如果您正苦于以下问题:Java WXSDKManager类的具体用法?Java WXSDKManager怎么用?Java WXSDKManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WXSDKManager类属于com.taobao.weex包,在下文中一共展示了WXSDKManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateFinish

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
/**
 * 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);
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:27,代码来源:WXDomStatement.java

示例2: onOpen

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
@Override
public void onOpen(WebSocket webSocket, Request arg1, Response arg2)
    throws IOException {
  mWebSocket = webSocket;
  setEnvironment(WXEnvironment.getConfig());
  WXSDKManager.getInstance().postOnUiThread(new Runnable() {
    @Override
    public void run() {
      Toast.makeText(WXEnvironment.sApplication, "Has switched to DEBUG mode, you can see the DEBUG information on the browser!", Toast.LENGTH_SHORT).show();
    }
  },0);
  for (JSDebuggerCallback callback : mCallbacks.values()) {
    callback.onSuccess(arg2);
  }
  WXLogUtils.e("into--[onOpen]");
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:WXWebSocketManager.java

示例3: addElement

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
/**
 * Add a {@link WXDomObject} to the specified parent as its given n-th child.
 * @param parentRef reference of the parent.
 * @param element the node to be added
 * @param index the expected index that the new dom in its new parent
 */
public void addElement(String parentRef, JSONObject element, Integer index) {
  if (element == null
      || TextUtils.isEmpty(parentRef)) {
    return;
  }
  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(parentRef);
  task.args.add(element);
  task.args.add(index);
  msg.what = WXDomHandler.MsgType.WX_DOM_ADD_DOM;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:23,代码来源:WXDomModule.java

示例4: reportJSException

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
/**
 * 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);
  }
  StringBuilder errorMsg=new StringBuilder();
  WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId);
  if (instance != null) {
    // TODO add errCode
    instance.onJSException(null, function, exception);
    errorMsg.append("bundleUrl:"+instance.getBundleUrl());
  }else{
    errorMsg.append(" bundleUrl:instance is null!");
  }
  errorMsg.append(" exception function:"+function);
  errorMsg.append(" exception:"+exception);
  WXErrorCode.WX_ERR_JS_EXECUTE.appendErrMsg(errorMsg.toString());
  commitJSBridgeAlarmMonitor(instanceId,WXErrorCode.WX_ERR_JS_EXECUTE);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:25,代码来源:WXBridgeManager.java

示例5: moveElement

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
/**
 * Move the DomElement to the specified parent as its given n-th child.
 * @param ref reference of the node to be moved.
 * @param parentRef reference of the parent.
 * @param index the expected index that the dom in its new parent
 */
public void moveElement(String ref, String parentRef, Integer index) {
  if (TextUtils.isEmpty(ref)
      || TextUtils.isEmpty(parentRef)) {
    return;
  }
  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(ref);
  task.args.add(parentRef);
  task.args.add(index);
  msg.what = WXDomHandler.MsgType.WX_DOM_MOVE_DOM;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:23,代码来源:WXDomModule.java

示例6: notifyNativeSizeChanged

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
/**
 * Trigger a updateStyle invoke to relayout current page
 */
public void notifyNativeSizeChanged(int w, int h) {
  if (!mNeedLayoutOnAnimation) {
    return;
  }

  Message message = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = getInstanceId();
  if (task.args == null) {
    task.args = new ArrayList<>();
  }

  JSONObject style = new JSONObject(2);
  float webW = WXViewUtils.getWebPxByWidth(w);
  float webH = WXViewUtils.getWebPxByWidth(h);

  style.put("width", webW);
  style.put("height", webH);

  task.args.add(getRef());
  task.args.add(style);
  message.obj = task;
  message.what = WXDomHandler.MsgType.WX_DOM_UPDATE_STYLE;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(message);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:29,代码来源:WXComponent.java

示例7: setup

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
@Before
public void setup() {
  WXEnvironment.sApplication = RuntimeEnvironment.application;
  WXSDKManager wxsdkManager = WXSDKManager.getInstance();
  if (!new MockUtil().isSpy(wxsdkManager)) {
    WXSDKManager spy = Mockito.spy(wxsdkManager);
    WXSDKManagerTest.setInstance(spy);
    Mockito.when(spy.getIWXHttpAdapter()).thenReturn(new IWXHttpAdapter() {
      @Override
      public void sendRequest(WXRequest request, OnHttpListener listener) {
        //do nothing.
      }
    });
  }

  adapter = new DefaultUriAdapter();
  instance = WXSDKInstanceTest.createInstance();
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:19,代码来源:DefaultUriAdapterTest.java

示例8: scrollToElement

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
/**
 * Scroll the specified {@link WXDomObject} to given offset in given duration
 * @param ref reference of specified dom object
 * @param options scroll option, like {offset:0, duration:300}
 */
public void scrollToElement(String ref, JSONObject options) {
  if (TextUtils.isEmpty(ref) || options == null) {
    return;
  }

  Message msg = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = mWXSDKInstance.getInstanceId();
  task.args = new ArrayList<>();
  task.args.add(ref);
  task.args.add(options);
  msg.what = WXDomHandler.MsgType.WX_DOM_SCROLLTO;
  msg.obj = task;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(msg);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:21,代码来源:WXDomModule.java

示例9: updateFinish

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
/**
 * 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";
    }
  });

  mDirty = true;
  WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
  if (instance != null) {
    instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:28,代码来源:WXDomStatement.java

示例10: createAnimatorListener

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
public static
@Nullable
Animator.AnimatorListener createAnimatorListener(final WXSDKInstance mWXSDKInstance, @Nullable final String callBack) {
  if (!TextUtils.isEmpty(callBack)) {
    return new AnimatorListenerAdapter() {
      @Override
      public void onAnimationEnd(Animator animation) {
        if (mWXSDKInstance == null) {
          WXLogUtils.e("WXRenderStatement-onAnimationEnd mWXSDKInstance == null NPE");
        } else {
          WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(),
                                              callBack,
                                              new HashMap<String, Object>());
        }
      }
    };
  } else {
    return null;
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:21,代码来源:WXAnimationModule.java

示例11: addEvent

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
@Override
public void addEvent(String type) {
  super.addEvent(type);
  if (type != null && type.equals(Constants.Event.CHANGE) && getHostView() != null) {
    getHostView().setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
      @Override
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        Map<String, Object> params = new HashMap<>(2);
        params.put("value", isChecked);

        Map<String, Object> domChanges = new HashMap<>();
        Map<String, Object> attrsChanges = new HashMap<>();
        attrsChanges.put("checked",Boolean.toString(isChecked));
        domChanges.put("attrs",attrsChanges);
        WXSDKManager.getInstance().fireEvent(getInstanceId(), getDomObject().getRef(), Constants.Event.CHANGE, params,domChanges);
      }
    });
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:WXSwitch.java

示例12: getCurrentPosition

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
@Override
public void getCurrentPosition(final String successCallback, final String errorCallback, final String params) {
  if(WXEnvironment.isApkDebugable()) {
    WXLogUtils.d(TAG, "into--[getCurrentPosition] successCallback:" + successCallback + " \nerrorCallback:" + errorCallback + " \nparams:" + params);
  }
  if (!TextUtils.isEmpty(params)) {
    try {
      org.json.JSONObject jsObj = new org.json.JSONObject(params);
      boolean enableHighAccuracy = jsObj.optBoolean("enableHighAccuracy");
      boolean enableAddress = jsObj.optBoolean("address");
      WXLocationListener listener = findLocation(null, successCallback, errorCallback, enableHighAccuracy, enableAddress);
      if (listener != null) {
        mWXLocationListeners.add(listener);
      }
      return;
    } catch (JSONException e) {
      WXLogUtils.e(TAG, e);
    }
  }
  Map<String, Object> options = new HashMap<>();
  options.put(ERROR_CODE, ErrorCode.PARAMS_ERROR);
  options.put(ERROR_MSG, ErrorMsg.PARAMS_ERROR);
  WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), errorCallback, options);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:25,代码来源:DefaultLocation.java

示例13: watchPosition

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
@Override
public void watchPosition(final String successCallback, final String errorCallback, final String params) {
  WXLogUtils.d("into--[watchPosition] successCallback:" + successCallback + " errorCallback:" + errorCallback + "\nparams:" + params);
  if (!TextUtils.isEmpty(params)) {
    try {
      org.json.JSONObject jsObj = new org.json.JSONObject(params);
      boolean enableHighAccuracy = jsObj.optBoolean("enableHighAccuracy");
      boolean enableAddress = jsObj.optBoolean("address");

      String id = UUID.randomUUID().toString();
      WXLocationListener listener = findLocation(id, successCallback, errorCallback, enableHighAccuracy, enableAddress);
      if (listener != null) {
        mRegisterSucCallbacks.put(id, listener);
      }
      return;
    } catch (JSONException e) {
      WXLogUtils.e(TAG, e);
    }
  }
  Map<String, Object> options = new HashMap<>();
  options.put(ERROR_CODE, ErrorCode.PARAMS_ERROR);
  options.put(ERROR_MSG, ErrorMsg.PARAMS_ERROR);
  WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), errorCallback, options);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:25,代码来源:DefaultLocation.java

示例14: handleMessage

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
@Override
public boolean handleMessage(Message msg) {
  if (msg.what == TIME_OUT_WHAT) {
    if(WXEnvironment.isApkDebugable()) {
      WXLogUtils.d(TAG, "into--[handleMessage] Location Time Out!");
    }
    if (mWXSDKInstance == null || mWXSDKInstance.isDestroy() || mLocationManager == null) {
      return false;
    }
    if (ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
      mLocationManager.removeUpdates(this);
    }
    Map<String, Object> options = new HashMap<>();
    options.put(ERROR_CODE, ErrorCode.LOCATION_TIME_OUT);
    options.put(ERROR_MSG, ErrorMsg.LOCATION_TIME_OUT);
    if (!TextUtils.isEmpty(mWatchId)) {
      options.put(WATCH_ID, mWatchId);
    }
    WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), mErrorCallback, options);
    return true;
  }
  return false;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:24,代码来源:DefaultLocation.java

示例15: initDebug

import com.taobao.weex.WXSDKManager; //导入依赖的package包/类
@Override
public void initDebug(final Application application) {
  WXSDKManager.getInstance().postOnUiThread(new Runnable() {
    @Override
    public void run() {
      try {
        Class cls = Class.forName("com.taobao.weex.WXPrettyFish");
        Method m = cls.getMethod("init", new Class[]{Application.class});
        m.invoke(cls, new Object[]{application});
      } catch (Exception e) {
        WXLogUtils.d("weex", "WXPrettyFish not found!");
      }
      putDebugOptions(SHOW_3D_LAYER, "true");
    }
  }, 0);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:PlayDebugAdapter.java


注:本文中的com.taobao.weex.WXSDKManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。