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


Java WXEnvironment.sApplication方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getScreenHeight

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
@Deprecated
public static int getScreenHeight() {
  if(WXEnvironment.sApplication!=null){
    return WXEnvironment.sApplication.getResources()
            .getDisplayMetrics()
            .heightPixels;
  }
  if(WXEnvironment.isApkDebugable()){
    throw new WXRuntimeException("Error Context is null When getScreenHeight");
  }
  return 0;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:13,代码来源:WXViewUtils.java

示例4: setUp

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    WXEnvironment.sApplication = RuntimeEnvironment.application;
    WXSDKInstance instance = Mockito.mock(WXSDKInstance.class);
    Mockito.when(instance.getContext()).thenReturn(RuntimeEnvironment.application);

    mParentDomObj = Mockito.spy(new WXDomObject());
    Mockito.when(mParentDomObj.getPadding()).thenReturn(new Spacing());
    Mockito.when(mParentDomObj.getBorder()).thenReturn(new Spacing());
    Mockito.when(mParentDomObj.clone()).thenReturn(mParentDomObj);
    mParentDomObj.ref = "_root";

    mDomObject = Mockito.spy(new WXTextDomObject());
    mDomObject.ref = "1";
    mDomObject.addEvent(Constants.Event.CLICK);
    Mockito.when(mDomObject.clone()).thenReturn(mDomObject);
    Mockito.when(mDomObject.getPadding()).thenReturn(new Spacing());
    Mockito.when(mDomObject.getBorder()).thenReturn(new Spacing());
    Mockito.when(mDomObject.getMargin()).thenReturn(new Spacing());
    Mockito.when(mDomObject.getLayoutWidth()).thenReturn(100f);
    Mockito.when(mDomObject.getLayoutHeight()).thenReturn(100f);

    mParent = new WXDiv(instance, mParentDomObj, null, false);
    mParent.createView(null, -1);
    mWXText = new WXText(instance, mDomObject, mParent, false);
    mWXText.bindHolder(new SimpleComponentHolder(WXText.class));
    assertNotNull(instance.getContext());
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:29,代码来源:WXTextTest.java

示例5: setUp

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

  WXEnvironment.sApplication = RuntimeEnvironment.application;
  WXDiv div = WXDivTest.create();
  ComponentTest.create(div);
  component = new WXEmbed(div.getInstance(),new TestDomObject(),div);
  ComponentTest.create(component);
  component.getDomObject().getStyles().put(Constants.Name.VISIBILITY, Constants.Value.VISIBLE);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:11,代码来源:WXEmbedTest.java

示例6: setUp

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    WXEnvironment.sApplication = RuntimeEnvironment.application;
    WXSDKInstance instance = Mockito.mock(WXSDKInstance.class);
    Mockito.when(instance.getContext()).thenReturn(RuntimeEnvironment.application);

    mParentDomObj = Mockito.spy(new WXDomObject());
    Mockito.when(mParentDomObj.getPadding()).thenReturn(new Spacing());
    Mockito.when(mParentDomObj.getBorder()).thenReturn(new Spacing());
    Mockito.when(mParentDomObj.clone()).thenReturn(mParentDomObj);
    TestDomObject.setRef(mParentDomObj,WXDomObject.ROOT);

    mDomObject = Mockito.spy(new WXTextDomObject());
    TestDomObject.setRef(mDomObject,"1");
    mDomObject.addEvent(Constants.Event.CLICK);
    Mockito.when(mDomObject.clone()).thenReturn(mDomObject);
    Mockito.when(mDomObject.getPadding()).thenReturn(new Spacing());
    Mockito.when(mDomObject.getBorder()).thenReturn(new Spacing());
    Mockito.when(mDomObject.getMargin()).thenReturn(new Spacing());
    Mockito.when(mDomObject.getLayoutWidth()).thenReturn(100f);
    Mockito.when(mDomObject.getLayoutHeight()).thenReturn(100f);

    mParent = new WXDiv(instance, mParentDomObj, null);
    mParent.createView();
    mWXText = new WXText(instance, mDomObject, mParent);
    mWXText.bindHolder(new SimpleComponentHolder(WXText.class));
    assertNotNull(instance.getContext());
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:29,代码来源:WXTextTest.java


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