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


Java WXEnvironment类代码示例

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


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

示例1: instantiateItem

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
  View pageView = null;
  try {
    pageView = shadow.get(position);
    if (WXEnvironment.isApkDebugable()) {
      WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount());
    }
    if (pageView.getParent() == null) {
      container.addView(pageView);
    } else {
      ((ViewGroup) pageView.getParent()).removeView(pageView);
      container.addView(pageView);
    }
  } catch (Exception e) {
    WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e);
  }
  return pageView;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:20,代码来源:WXCirclePageAdapter.java

示例2: assembleDefaultOptions

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
private WXParams assembleDefaultOptions() {
  Map<String, String> config = WXEnvironment.getConfig();
  WXParams wxParams = new WXParams();
  wxParams.setPlatform(config.get(WXConfig.os));
  wxParams.setOsVersion(config.get(WXConfig.sysVersion));
  wxParams.setAppVersion(config.get(WXConfig.appVersion));
  wxParams.setWeexVersion(config.get(WXConfig.weexVersion));
  wxParams.setDeviceModel(config.get(WXConfig.sysModel));
  wxParams.setShouldInfoCollect(config.get("infoCollect"));
  wxParams.setLogLevel(config.get(WXConfig.logLevel));
  String appName = config.get(WXConfig.appName);
  if (!TextUtils.isEmpty(appName)) {
    wxParams.setAppName(appName);
  }
  wxParams.setDeviceWidth(TextUtils.isEmpty(config.get("deviceWidth")) ? String.valueOf(WXViewUtils.getScreenWidth(WXEnvironment.sApplication)) : config.get("deviceWidth"));
  wxParams.setDeviceHeight(TextUtils.isEmpty(config.get("deviceHeight")) ? String.valueOf(WXViewUtils.getScreenHeight(WXEnvironment.sApplication)) : config.get("deviceHeight"));
  wxParams.setOptions(WXEnvironment.getCustomOptions());
  wxParams.setNeedInitV8(WXSDKManager.getInstance().needInitV8());
  return wxParams;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:21,代码来源:WXBridgeManager.java

示例3: onOpen

import com.taobao.weex.WXEnvironment; //导入依赖的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

示例4: reportJSException

import com.taobao.weex.WXEnvironment; //导入依赖的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: clone

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
/**
 * Clone the current object. This is not a deep copy, only shadow copy of some reference.
 * @return The result object of clone.
 */
@Override
public WXDomObject clone() {
  if (sDestroy.get()) {
    return null;
  }
  WXDomObject dom = null;
  try {
    dom = WXDomObjectFactory.newInstance(mType);
    copyFields(dom);
  } catch (Exception e) {
    if (WXEnvironment.isApkDebugable()) {
      WXLogUtils.e("WXDomObject clone error: ", e);
    }
  }

  return dom;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:22,代码来源:WXDomObject.java

示例6: getTriggerType

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
private String getTriggerType(@Nullable ImmutableDomObject domObject) {
  String triggerType = DEFAULT_TRIGGER_TYPE;
  if (domObject == null) {
    return triggerType;
  }
  triggerType = WXUtils.getString(domObject.getAttrs().get(DRAG_TRIGGER_TYPE), DEFAULT_TRIGGER_TYPE);
  if (!DragTriggerType.LONG_PRESS.equals(triggerType) && !DragTriggerType.PAN.equals(triggerType)) {
    triggerType = DEFAULT_TRIGGER_TYPE;
  }

  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.d(TAG, "trigger type is " + triggerType);
  }

  return triggerType;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:17,代码来源:BasicListComponent.java

示例7: getScreenWidth

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
@Deprecated
public static int getScreenWidth( ) {
  if(WXEnvironment.sApplication!=null) {
    int width = WXEnvironment.sApplication.getResources().getDisplayMetrics().widthPixels;

    if(WXEnvironment.SETTING_FORCE_VERTICAL_SCREEN){
      int height = WXEnvironment.sApplication.getResources()
              .getDisplayMetrics()
              .heightPixels;
      width = height > width ?width:height;
    }
    return width;
  }
  if(WXEnvironment.isApkDebugable()){
    throw new WXRuntimeException("Error Context is null When getScreenHeight");
  }
  return 0;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:19,代码来源:WXViewUtils.java

示例8: clone

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
@Override
public WXTextDomObject clone() {
  WXTextDomObject dom = null;
  try {
    dom = new WXTextDomObject();
    copyFields(dom);
    dom.hasBeenMeasured = hasBeenMeasured;
    dom.atomicReference = atomicReference;
  } catch (Exception e) {
    if (WXEnvironment.isApkDebugable()) {
      WXLogUtils.e("WXTextDomObject clone error: ", e);
    }
  }
  if (dom != null) {
    dom.spanned = spanned;
  }
  return dom;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:19,代码来源:WXTextDomObject.java

示例9: setup

import com.taobao.weex.WXEnvironment; //导入依赖的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:weexext,项目名称:ucar-weex-core,代码行数:19,代码来源:DefaultUriAdapterTest.java

示例10: toString

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
@Override
public String toString() {
  if (WXEnvironment.isApkDebugable()) {
    return "bizType:" + bizType + ",pageName:" + pageName + ",templateLoadTime" + templateLoadTime
           + ",localReadTime:" + localReadTime + ",JSLibInitTime:" + JSLibInitTime
           + ",JSLibSize:" + JSLibSize + ",templateUrl" + templateUrl
           + ",JSTemplateSize:" + JSTemplateSize + ",communicateTime:" + communicateTime
           + ",screenRenderTime:" + screenRenderTime
           + ",firstScreenJSFExecuteTime:" + firstScreenJSFExecuteTime
           + ",componentCount:" + componentCount
           + ",syncTaskTime:" + syncTaskTime
           + ",pureNetworkTime:" + pureNetworkTime
           + ",networkTime:" + networkTime
           + ",actualNetworkTime:" + actualNetworkTime
           + ",packageSpendTime:" + packageSpendTime
           + ",connectionType:" + connectionType
           + ",requestType:" + requestType
           + ",initInvokeTime:"+WXEnvironment.sSDKInitInvokeTime+",initExecuteTime:"+WXEnvironment.sSDKInitExecuteTime
           + ",SDKInitTime:"+ WXEnvironment.sSDKInitTime
           + ",totalTime:" + totalTime + ",JSLibVersion:" + JSLibVersion + ",WXSDKVersion:" + WXSDKVersion
           + ",errCode:" + errCode + ",renderFailedDetail:" + renderFailedDetail
           + ",arg:" + args
           + ",errMsg:" + getErrMsg();
  }
  return super.toString();
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:27,代码来源:WXPerformance.java

示例11: callNativeModule

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

示例12: registerDomObject

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
public static boolean registerDomObject(String type, Class<? extends WXDomObject> clazz) throws WXException {
  if (clazz == null || TextUtils.isEmpty(type)) {
    return false;
  }

  if (sDom.containsKey(type)) {
    if (WXEnvironment.isApkDebugable()) {
      throw new WXException("WXDomRegistry had duplicate Dom:" + type);
    } else {
      WXLogUtils.e("WXDomRegistry had duplicate Dom: " + type);
      return false;
    }
  }
  sDom.put(type, clazz);
  return true;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:17,代码来源:WXDomRegistry.java

示例13: assembleDefaultOptions

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
private WXParams assembleDefaultOptions() {
  Map<String, String> config = WXEnvironment.getConfig();
  WXParams wxParams = new WXParams();
  wxParams.setPlatform(config.get("os"));
  wxParams.setOsVersion(config.get("sysVersion"));
  wxParams.setAppVersion(config.get("appVersion"));
  wxParams.setWeexVersion(config.get("weexVersion"));
  wxParams.setDeviceModel(config.get("sysModel"));
  wxParams.setShouldInfoCollect(config.get("infoCollect"));
  wxParams.setLogLevel(config.get(WXConfig.logLevel));
  String appName = config.get("appName");
  if (!TextUtils.isEmpty(appName)) {
    wxParams.setAppName(appName);
  }
  wxParams.setDeviceWidth(TextUtils.isEmpty(config.get("deviceWidth")) ? String.valueOf(WXViewUtils.getScreenWidth(WXEnvironment.sApplication)) : config.get("deviceWidth"));
  wxParams.setDeviceHeight(TextUtils.isEmpty(config.get("deviceHeight")) ? String.valueOf(WXViewUtils.getScreenHeight(WXEnvironment.sApplication)) : config.get("deviceHeight"));
  wxParams.setOptions(WXEnvironment.getCustomOptions());
  return wxParams;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:20,代码来源:WXBridgeManager.java

示例14: getScreenWidth

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
public static int getScreenWidth(Context ctx) {
  if(ctx!=null){
    Resources res = ctx.getResources();
    mScreenWidth = res.getDisplayMetrics().widthPixels;

    if(WXEnvironment.SETTING_FORCE_VERTICAL_SCREEN){
      mScreenHeight = res
              .getDisplayMetrics()
              .heightPixels;
      mScreenWidth = mScreenHeight > mScreenWidth ? mScreenWidth : mScreenHeight;
    }
  } else if(WXEnvironment.isApkDebugable()){
    throw new WXRuntimeException("Error Context is null When getScreenHeight");
  }
  return mScreenWidth;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:17,代码来源:WXViewUtils.java

示例15: setUp

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    super.setUp();

    Map<String, String> map = new HashMap<>();
    map.put(WXConfig.scale, Float.toString(TEST_DENSITY));
    PowerMockito.mockStatic(WXEnvironment.class);
    PowerMockito.when(WXEnvironment.class, "getConfig").thenReturn(map);

    PowerMockito.mockStatic(WXViewUtils.class);
    PowerMockito.when(WXViewUtils.class, "getScreenWidth").thenReturn(TEST_SCREEN_WIDTH);

    PowerMockito.mockStatic(WXSDKInstance.class);
    PowerMockito.when(WXSDKInstance.class, "getViewPortWidth").thenReturn(TEST_VIEW_PORT);

    PowerMockito.mockStatic(TextUtils.class);
    PowerMockito.when(TextUtils.isEmpty(any(CharSequence.class))).thenAnswer(new Answer<Boolean>() {
        @Override
        public Boolean answer(InvocationOnMock invocation) throws Throwable {
            CharSequence a = (CharSequence) invocation.getArguments()[0];
            return !(a != null && a.length() > 0);
        }
    });
    // also look at @PrepareForTest if add mock of new class
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:26,代码来源:WXUtilsTest.java


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