Search in sources :

Example 1 with WXLoading

use of com.taobao.weex.ui.component.WXLoading in project weex-example by KalicyZhou.

the class BasicListComponent method onBindViewHolder.

/**
   * 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 (holder.getComponent() != null && holder.getComponent() instanceof WXCell) {
        holder.getComponent().bindData(component);
    //              holder.getComponent().refreshData(component);
    }
}
Also used : WXComponent(com.taobao.weex.ui.component.WXComponent) WXLoading(com.taobao.weex.ui.component.WXLoading) WXRefresh(com.taobao.weex.ui.component.WXRefresh)

Example 2 with WXLoading

use of com.taobao.weex.ui.component.WXLoading in project weex-example by KalicyZhou.

the class WXListComponent method createChildViewAt.

@Override
public void createChildViewAt(int index) {
    int indexToCreate = index;
    if (indexToCreate < 0) {
        indexToCreate = childCount() - 1;
        if (indexToCreate < 0) {
            return;
        }
    }
    final WXComponent child = getChild(indexToCreate);
    if (child instanceof WXBaseRefresh) {
        child.createView();
        if (child instanceof WXRefresh) {
            getHostView().setOnRefreshListener((WXRefresh) child);
            getHostView().postDelayed(new Runnable() {

                @Override
                public void run() {
                    getHostView().setHeaderView(child);
                }
            }, 100);
        } else if (child instanceof WXLoading) {
            getHostView().setOnLoadingListener((WXLoading) child);
            getHostView().postDelayed(new Runnable() {

                @Override
                public void run() {
                    getHostView().setFooterView(child);
                }
            }, 100);
        }
    } else {
        super.createChildViewAt(indexToCreate);
    }
}
Also used : WXComponent(com.taobao.weex.ui.component.WXComponent) WXBaseRefresh(com.taobao.weex.ui.component.WXBaseRefresh) WXLoading(com.taobao.weex.ui.component.WXLoading) WXRefresh(com.taobao.weex.ui.component.WXRefresh)

Aggregations

WXComponent (com.taobao.weex.ui.component.WXComponent)2 WXLoading (com.taobao.weex.ui.component.WXLoading)2 WXRefresh (com.taobao.weex.ui.component.WXRefresh)2 WXBaseRefresh (com.taobao.weex.ui.component.WXBaseRefresh)1