本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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());
}
示例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);
}
示例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());
}