• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WXEnvironment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: callRemoveEvent

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
/**
 * JavaScript uses this methods to call Android code
 * @param instanceId
 * @param ref
 * @param event
 * @param callback
 * @return int
 */
public int callRemoveEvent(String instanceId, String ref, String event, String callback) {
  long start = System.currentTimeMillis();
  WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId);
  if(instance != null) {
    instance.firstScreenCreateInstanceTime(start);
  }
  int errorCode = IWXBridge.INSTANCE_RENDERING;
  try {
    errorCode = WXBridgeManager.getInstance().callRemoveEvent(instanceId, ref, event, callback);
  } catch (Throwable e) {
    //catch everything during call native.
    if(WXEnvironment.isApkDebugable()){
      WXLogUtils.e(TAG,"callRemoveEvent throw exception:" + e.getMessage());
    }
  }
  if(instance != null) {
    instance.callNativeTime(System.currentTimeMillis() - start);
  }
  return errorCode;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:29,代码来源:WXBridge.java


示例17: remove

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
@Override
public void remove(WXComponent child, boolean destroy) {
  int index = mChildren.indexOf(child);
  if (destroy) {
    child.detachViewAndClearPreInfo();
  }
  unBindViewType(child);

  BounceRecyclerView view = getHostView();
  if(view == null){
    return;
  }
  view.getAdapter().notifyItemRemoved(index);
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.d(TAG, "removeChild child at " + index);
  }
  super.remove(child, destroy);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:19,代码来源:WXListComponent.java


示例18: onBindViewHolder

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
/**
     * Bind the component of the position to the holder. Then flush the view.
     *
     * @param holder   viewHolder, which holds reference to the view
     * @param position position of component in WXListComponent
     */
    @Override
    public void onBindViewHolder(ListBaseViewHolder holder, int position) {
        if (holder == null) return;
        holder.setComponentUsing(true);
        WXComponent component = getChild(position);
        if ( component == null
                || (component instanceof WXRefresh)
                || (component instanceof WXLoading)
                || (component.getDomObject()!=null && component.getDomObject().isFixed())
                ) {
            if(WXEnvironment.isApkDebugable()) {
                WXLogUtils.d(TAG, "Bind WXRefresh & WXLoading " + holder);
            }
            return;
        }

        if (component != null&& holder.getComponent() != null
                && holder.getComponent() instanceof WXCell) {

                holder.getComponent().bindData(component);
//              holder.getComponent().refreshData(component);
        }

    }
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:31,代码来源:WXListComponent.java


示例19: commitJSFrameworkAlarmMonitor

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


示例20: recycleImage

import com.taobao.weex.WXEnvironment; //导入依赖的package包/类
private void recycleImage(View view) {
    if (view instanceof ImageView) {
        if (getInstance().getImgLoaderAdapter() != null) {
            getInstance().getImgLoaderAdapter().setImage(null, (ImageView) view,
                    null, null);
        } else {
            if (WXEnvironment.isApkDebugable()) {
                throw new WXRuntimeException("getImgLoaderAdapter() == null");
            }
            WXLogUtils.e("Error getImgLoaderAdapter() == null");
        }

    } else if (view instanceof ViewGroup) {
        for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
            recycleImage(((ViewGroup) view).getChildAt(i));
        }
    }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:19,代码来源:WXListComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PhpClass类代码示例发布时间:2022-05-21
下一篇:
Java InventoryUtils类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap