Java Code Examples for com.taobao.weex.WXSDKInstance#registerRenderListener()

The following examples show how to use com.taobao.weex.WXSDKInstance#registerRenderListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractWeexActivity.java    From incubator-weex-playground with Apache License 2.0 5 votes vote down vote up
protected void createWeexInstance(){
  destoryWeexInstance();

  Rect outRect = new Rect();
  getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect);

  mInstance = new WXSDKInstance(this);
  mInstance.registerRenderListener(this);
}
 
Example 2
Source File: SliceTestActivity.java    From incubator-weex-playground with Apache License 2.0 5 votes vote down vote up
public WXViewHolder(View itemView) {
  super(itemView);
  mInstance = new WXSDKInstance(SliceTestActivity.this);
  mInstance.registerRenderListener(this);
  mInstances.add(mInstance);
  mTextView = new TextView(SliceTestActivity.this);
  FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  params.gravity = Gravity.RIGHT;
  ((ViewGroup) itemView).addView(mTextView, params);
}
 
Example 3
Source File: WeexActivity.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mWXSDKInstance = new WXSDKInstance(this);
    mWXSDKInstance.registerRenderListener(this);
    final Intent intent = getIntent();
    mWXSDKInstance.render(intent.getStringExtra(ActivityConstant.PAGE), WXFileUtils.loadAsset(intent.getStringExtra(ActivityConstant.PATH), this), null, null, WXRenderStrategy.APPEND_ASYNC);
}
 
Example 4
Source File: TabPagerFragment.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    String type = getArguments().getString("type");
    mGankIoContent = (FrameLayout) inflater.inflate(R.layout.layout_weex_gank_io, container, false);
    final Context context = getActivity();
    mWXSDKInstance = new WXSDKInstance(context);
    mWXSDKInstance.registerRenderListener(this);
    Map<String, Object> options = new HashMap<>();
    options.put("type", type);
    mWXSDKInstance.render("GankioList", WXFileUtils.loadAsset("weex/gankio/gankiolist.js", context), options, null, WXRenderStrategy.APPEND_ASYNC);
    return mGankIoContent;
}
 
Example 5
Source File: UWXBaseFragment.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mWXSDKInstance = new WXSDKInstance(getContext());
    mWXSDKInstance.registerRenderListener(this);
    String jsBundle = myBundle.getString("_jsBundle");
    JSONObject jsonObject = ArgumentsUtil.fromBundle(myBundle);

    if (jsonObject != null) {
        String param = JSON.toJSONString(jsonObject);
        param = Uri.encode(param);
        if (jsBundle.contains("?")) {
            tempUrl = jsBundle + "&params=" + param;
        } else {
            tempUrl = jsBundle + "?params=" + param;
        }
    } else {
        tempUrl = jsBundle;
    }

    render(tempUrl);
    if (mIsDevSupportEnabled) {
        mShakeDetector = new ShakeDetector(new ShakeDetector.ShakeListener() {
            @Override
            public void onShake() {
                showDevOptionsDialog();
            }
        });
    }
}
 
Example 6
Source File: WXEmbed.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: WXEmbed.java    From weex-uikit with MIT License 5 votes vote down vote up
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;
}
 
Example 8
Source File: AbstractWeexActivity.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
protected void createWeexInstance(){
  destoryWeexInstance();

  Rect outRect = new Rect();
  getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect);

  mInstance = new WXSDKInstance(this);
  mInstance.registerRenderListener(this);
}
 
Example 9
Source File: AbstractWeexActivity.java    From weex with Apache License 2.0 5 votes vote down vote up
protected void createWeexInstance(){
  destoryWeexInstance();

  Rect outRect = new Rect();
  getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect);

  mInstance = new WXSDKInstance(this);
  mInstance.registerRenderListener(this);
}
 
Example 10
Source File: AbsWeexActivity.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
protected void createWeexInstance() {
  destoryWeexInstance();
  mInstance = new WXSDKInstance(this);
  mInstance.registerRenderListener(this);
}
 
Example 11
Source File: UWXBaseFragment.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
protected void createWeexInstance() {
    destoryWeexInstance();
    mWXSDKInstance = new WXSDKInstance(getContext());
    mWXSDKInstance.registerRenderListener(this);
}
 
Example 12
Source File: UWXBaseActivity.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
protected void createWeexInstance() {
    destoryWeexInstance();
    mInstance = new WXSDKInstance(this);
    mInstance.registerRenderListener(this);
}
 
Example 13
Source File: AbsWeexActivity.java    From yanxuan-weex-demo with MIT License 4 votes vote down vote up
protected void createWeexInstance() {
  destoryWeexInstance();
  mInstance = new WXSDKInstance(this);
  mInstance.registerRenderListener(this);
}
 
Example 14
Source File: AbsWeexActivity.java    From WeexOne with MIT License 4 votes vote down vote up
protected void createWeexInstance() {
  destoryWeexInstance();
  mInstance = new WXSDKInstance(this);
  mInstance.registerRenderListener(this);
}
 
Example 15
Source File: MainActivity.java    From weex-uikit with MIT License 3 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);


    mWXSDKInstance = new WXSDKInstance(this);
    mWXSDKInstance.registerRenderListener(this);

    mWXSDKInstance.render(WXFileUtils.loadAsset("index.js", this));
}