本文整理汇总了Java中com.taobao.weex.common.WXRenderStrategy类的典型用法代码示例。如果您正苦于以下问题:Java WXRenderStrategy类的具体用法?Java WXRenderStrategy怎么用?Java WXRenderStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WXRenderStrategy类属于com.taobao.weex.common包,在下文中一共展示了WXRenderStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBody
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
/**
* create RootView ,every weex Instance View has a rootView;
* @see com.taobao.weex.dom.WXDomStatement#createBody(JSONObject)
*/
void createBody(WXComponent component) {
long start = System.currentTimeMillis();
component.createView(mGodComponent, -1);
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
}
start = System.currentTimeMillis();
component.applyLayoutAndEvent(component);
component.bindData(component);
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
}
if (component instanceof WXScroller) {
WXScroller scroller = (WXScroller) component;
if (scroller.getInnerView() instanceof ScrollView) {
mWXSDKInstance.setRootScrollView((ScrollView) scroller.getInnerView());
}
}
mWXSDKInstance.setRootView(mGodComponent.getRealView());
if (mWXSDKInstance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
mWXSDKInstance.onViewCreated(mGodComponent);
}
}
示例2: createBody
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
/**
* create RootView ,every weex Instance View has a rootView;
* @see com.taobao.weex.dom.WXDomStatement#createBody(JSONObject)
*/
void createBody(WXComponent component) {
long start = System.currentTimeMillis();
component.createView();
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
}
start = System.currentTimeMillis();
component.applyLayoutAndEvent(component);
component.bindData(component);
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
}
if (component instanceof WXScroller) {
WXScroller scroller = (WXScroller) component;
if (scroller.getInnerView() instanceof ScrollView) {
mWXSDKInstance.setRootScrollView((ScrollView) scroller.getInnerView());
}
}
mWXSDKInstance.onRootCreated(component);
if (mWXSDKInstance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
mWXSDKInstance.onCreateFinish();
}
}
示例3: createBody
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
/**
* create RootView ,every weex Instance View has a rootView;
* @see com.taobao.weex.dom.WXDomStatement#createBody(JSONObject)
*/
void createBody(WXComponent component) {
long start = System.currentTimeMillis();
component.createView(mGodComponent, -1);
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
}
start = System.currentTimeMillis();
component.applyLayoutAndEvent(component);
component.bindData(component);
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
}
if (component instanceof WXScroller) {
WXScroller scroller = (WXScroller) component;
if (scroller.getView() instanceof ScrollView) {
mWXSDKInstance.setRootScrollView((ScrollView) scroller.getView());
}
}
mWXSDKInstance.setRootView(mGodComponent.getRealView());
if (mWXSDKInstance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
mWXSDKInstance.onViewCreated(mGodComponent);
}
}
示例4: renderPageByURL
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
protected void renderPageByURL(String url, String jsonInitData) {
CommonUtils.throwIfNull(mContainer, new RuntimeException("Can't render page, container is null"));
Map<String, Object> options = new HashMap<>();
options.put(WXSDKInstance.BUNDLE_URL, url);
mInstance.renderByUrl(
getPageName(),
url,
options,
jsonInitData,
CommonUtils.getDisplayWidth(this),
CommonUtils.getDisplayHeight(this),
WXRenderStrategy.APPEND_ASYNC);
}
示例5: renderPage
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
protected void renderPage(String template,String source,String jsonInitData){
AssertUtil.throwIfNull(mContainer,new RuntimeException("Can't render page, container is null"));
Map<String, Object> options = new HashMap<>();
options.put(WXSDKInstance.BUNDLE_URL, source);
mInstance.render(
getPageName(),
template,
options,
jsonInitData,
ScreenUtil.getDisplayWidth(this),
ScreenUtil.getDisplayHeight(this),
WXRenderStrategy.APPEND_ASYNC);
}
示例6: renderPageByURL
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
protected void renderPageByURL(String url,String jsonInitData){
AssertUtil.throwIfNull(mContainer,new RuntimeException("Can't render page, container is null"));
Map<String, Object> options = new HashMap<>();
options.put(WXSDKInstance.BUNDLE_URL, url);
mInstance.renderByUrl(
getPageName(),
url,
options,
jsonInitData,
ScreenUtil.getDisplayWidth(this),
ScreenUtil.getDisplayHeight(this),
WXRenderStrategy.APPEND_ASYNC);
}
示例7: createFinish
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
/**
* weex render finish
* @see com.taobao.weex.dom.WXDomStatement#createFinish()
*/
void createFinish(int width, int height) {
if (mWXSDKInstance.getRenderStrategy() == WXRenderStrategy.APPEND_ONCE) {
mWXSDKInstance.onViewCreated(mGodComponent);
}
mWXSDKInstance.onRenderSuccess(width, height);
}
示例8: createInstance
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
private WXSDKInstance createInstance() {
WXSDKInstance sdkInstance = getInstance().createNestedInstance(this);
getInstance().addOnInstanceVisibleListener(this);
sdkInstance.registerRenderListener(mListener);
String url=src;
if(mListener != null && mListener.mEventListener != null){
url=mListener.mEventListener.transformUrl(src);
if(!mListener.mEventListener.onPreCreate(this,src)){
//cancel render
return null;
}
}
if(TextUtils.isEmpty(url)){
mListener.mEventListener.onException(this,WXRenderErrorCode.WX_USER_INTERCEPT_ERROR,"degradeToH5");
return sdkInstance;
}
ViewGroup.LayoutParams layoutParams = getHostView().getLayoutParams();
sdkInstance.renderByUrl(WXPerformance.DEFAULT,
url,
null, null, layoutParams.width,
layoutParams.height,
WXRenderStrategy.APPEND_ASYNC);
return sdkInstance;
}
示例9: render
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
/**
* Render template asynchronously
*
* @param pageName, used for performance log.
* @param template bundle js
* @param options os iphone/android/ipad
* weexversion Weex version(like 1.0.0)
* appversion App version(like 1.0.0)
* devid Device id(like Aqh9z8dRJNBhmS9drLG5BKCmXhecHUXIZoXOctKwFebH)
* sysversion Device system version(like 5.4.4、7.0.4, should be used with os)
* sysmodel Device model(like iOS:"MGA82J/A", android:"MI NOTE LTE")
* Time UNIX timestamp, UTC+08:00
* TTID(Optional)
* MarkertId
* Appname(Optional) tm,tb,qa
* Bundleurl(Optional) template url
* @param jsonInitData Initial data for rendering
* @param width Width of weex's root container, the default is match_parent
* @param height Height of weex's root container, the default is match_parent
* @param flag RenderStrategy {@link WXRenderStrategy}
*/
public void render(String pageName, String template, Map<String, Object> options, String jsonInitData, int width, int height, WXRenderStrategy flag) {
if (mRendered || TextUtils.isEmpty(template)) {
return;
}
if(options==null){
options=new HashMap<>();
}
if(WXEnvironment.sDynamicMode && !TextUtils.isEmpty(WXEnvironment.sDynamicUrl) && options!=null && options.get("dynamicMode")==null){
options.put("dynamicMode","true");
renderByUrl(pageName, WXEnvironment.sDynamicUrl, options, jsonInitData, width, height, flag);
return;
}
mWXPerformance.pageName = pageName;
mWXPerformance.JSTemplateSize = template.length() / 1024;
mRenderStartTime = System.currentTimeMillis();
mRenderStrategy = flag;
mGodViewWidth = width;
mGodViewHeight = height;
mInstanceId = WXSDKManager.getInstance().generateInstanceId();
WXSDKManager.getInstance().createInstance(this, template, options, jsonInitData);
mRendered = true;
if(TextUtils.isEmpty(mBundleUrl)){
mBundleUrl=pageName;
}
}
示例10: renderByUrl
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
public void renderByUrl(String pageName, final String url, Map<String, Object> options, final String jsonInitData, final int width, final int height, final WXRenderStrategy flag) {
pageName = wrapPageName(pageName, url);
mBundleUrl = url;
if (options == null) {
options = new HashMap<String, Object>();
}
if (!options.containsKey(BUNDLE_URL)) {
options.put(BUNDLE_URL, url);
}
Uri uri=Uri.parse(url);
if(uri!=null && TextUtils.equals(uri.getScheme(),"file")){
render(pageName, WXFileUtils.loadAsset(assembleFilePath(uri), mContext),options,jsonInitData,width,height,flag);
return;
}
IWXHttpAdapter adapter=WXSDKManager.getInstance().getIWXHttpAdapter();
WXRequest wxRequest = new WXRequest();
wxRequest.url = url;
if (wxRequest.paramMap == null) {
wxRequest.paramMap = new HashMap<String, String>();
}
wxRequest.paramMap.put("user-agent", WXHttpUtil.assembleUserAgent(mContext,WXEnvironment.getConfig()));
adapter.sendRequest(wxRequest, new WXHttpListener(pageName, options, jsonInitData, width, height, flag, System.currentTimeMillis()));
mWXHttpAdapter = adapter;
}
示例11: WXHttpListener
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
private WXHttpListener(String pageName, Map<String, Object> options, String jsonInitData, int width, int height, WXRenderStrategy flag, long startRequestTime) {
this.pageName = pageName;
this.options = options;
this.jsonInitData = jsonInitData;
this.width = width;
this.height = height;
this.flag = flag;
this.startRequestTime = startRequestTime;
}
示例12: render
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
private void render(String tempUrl) {
mWXSDKInstance.renderByUrl(
"",
tempUrl,
null,
null,
CommonUtils.getDisplayWidth(getActivity()),
CommonUtils.getDisplayHeight(getActivity()),
WXRenderStrategy.APPEND_ASYNC);
}
示例13: renderPageByURL
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
protected void renderPageByURL(String url, String jsonInitData) {
mUrl = url;
CommonUtils.throwIfNull(mContainer, new RuntimeException("Can't render page, container is null"));
Map<String, Object> options = new HashMap<>();
options.put(WXSDKInstance.BUNDLE_URL, url);
mInstance.renderByUrl(
getPageName(),
url,
options,
jsonInitData,
CommonUtils.getDisplayWidth(this),
CommonUtils.getDisplayHeight(this),
WXRenderStrategy.APPEND_ASYNC);
}
示例14: executeRender
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
@Override
public void executeRender(RenderActionContext context) {
WXSDKInstance instance = context.getInstance();
if (instance.getRenderStrategy() == WXRenderStrategy.APPEND_ONCE) {
instance.onCreateFinish();
}
instance.onRenderSuccess(mLayoutWidth, mLayoutHeight);
}
示例15: renderInternal
import com.taobao.weex.common.WXRenderStrategy; //导入依赖的package包/类
private void renderInternal(String pageName,
String template,
Map<String, Object> options,
String jsonInitData,
WXRenderStrategy flag){
if (mRendered || TextUtils.isEmpty(template)) {
return;
}
ensureRenderArchor();
Map<String, Object> renderOptions = options;
if (renderOptions == null) {
renderOptions = new HashMap<>();
}
if (WXEnvironment.sDynamicMode && !TextUtils.isEmpty(WXEnvironment.sDynamicUrl) && renderOptions.get("dynamicMode") == null) {
renderOptions.put("dynamicMode", "true");
renderByUrl(pageName, WXEnvironment.sDynamicUrl, renderOptions, jsonInitData, flag);
return;
}
mWXPerformance.pageName = pageName;
mWXPerformance.JSTemplateSize = template.length() / 1024;
mRenderStartTime = System.currentTimeMillis();
mRenderStrategy = flag;
WXSDKManager.getInstance().setCrashInfo(WXEnvironment.WEEX_CURRENT_KEY,pageName);
WXSDKManager.getInstance().createInstance(this, template, renderOptions, jsonInitData);
mRendered = true;
if (TextUtils.isEmpty(mBundleUrl)) {
mBundleUrl = pageName;
}
}