Search in sources :

Example 1 with WXRecyclerTemplateList

use of com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList in project incubator-weex by apache.

the class UpdateComponentDataAction method executeRender.

@Override
public void executeRender(RenderActionContext context) {
    String ref = CellDataManager.getListRef(virtualComponentId);
    if (TextUtils.isEmpty(ref)) {
        WXLogUtils.e("wrong virtualComponentId split error " + virtualComponentId);
        return;
    }
    WXComponent component = context.getComponent(ref);
    if (component instanceof WXRecyclerTemplateList) {
        WXRecyclerTemplateList templateList = (WXRecyclerTemplateList) component;
        templateList.getCellDataManager().updateVirtualComponentData(virtualComponentId, data);
        templateList.notifyUpdateList();
        SimpleJSCallback jsCallback = new SimpleJSCallback(component.getInstanceId(), callback);
        jsCallback.invoke(true);
    } else {
        WXLogUtils.e("recycler-list wrong virtualComponentId " + virtualComponentId);
    }
}
Also used : WXRecyclerTemplateList(com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList) WXComponent(com.taobao.weex.ui.component.WXComponent) SimpleJSCallback(com.taobao.weex.bridge.SimpleJSCallback)

Example 2 with WXRecyclerTemplateList

use of com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList in project incubator-weex by apache.

the class WXParallax method onScrolled.

@Override
public void onScrolled(View view, int dx, int dy) {
    if (ViewCompat.isInLayout(view)) {
        if (mBindingComponent == null && mBindingRef != null) {
            mBindingComponent = findComponent(mBindingRef);
        }
        if (mBindingComponent instanceof BasicListComponent && view instanceof RecyclerView) {
            BasicListComponent listComponent = (BasicListComponent) mBindingComponent;
            mOffsetY = Math.abs(listComponent.calcContentOffset((RecyclerView) view));
        } else if (mBindingComponent instanceof WXRecyclerTemplateList && view instanceof RecyclerView) {
            WXRecyclerTemplateList listComponent = (WXRecyclerTemplateList) mBindingComponent;
            mOffsetY = Math.abs(listComponent.calcContentOffset((RecyclerView) view));
        }
    } else {
        mOffsetY = mOffsetY + dy;
    }
    AnimationSet animationSet = new AnimationSet(true);
    boolean hasAnimation = false;
    for (int i = 0; i < mTransformPropArrayList.size(); i++) {
        TransformCreator creator = mTransformPropArrayList.get(i);
        Animation animation = creator.getAnimation(dx, dy);
        if (animation != null) {
            animationSet.addAnimation(animation);
            hasAnimation = true;
        }
    }
    if (hasAnimation) {
        animationSet.setFillAfter(true);
        if (getHostView() != null) {
            getHostView().startAnimation(animationSet);
        }
    }
    if (mBackgroundColor != null) {
        int color = mBackgroundColor.getColor(dx, dy);
        if (mBackGroundColor != color) {
            getHostView().setBackgroundColor(color);
            mBackGroundColor = color;
        }
    }
}
Also used : WXRecyclerTemplateList(com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList) ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) BasicListComponent(com.taobao.weex.ui.component.list.BasicListComponent) WXRecyclerView(com.taobao.weex.ui.view.listview.WXRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) AnimationSet(android.view.animation.AnimationSet)

Aggregations

WXRecyclerTemplateList (com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList)2 RecyclerView (android.support.v7.widget.RecyclerView)1 Animation (android.view.animation.Animation)1 AnimationSet (android.view.animation.AnimationSet)1 RotateAnimation (android.view.animation.RotateAnimation)1 ScaleAnimation (android.view.animation.ScaleAnimation)1 TranslateAnimation (android.view.animation.TranslateAnimation)1 SimpleJSCallback (com.taobao.weex.bridge.SimpleJSCallback)1 WXComponent (com.taobao.weex.ui.component.WXComponent)1 BasicListComponent (com.taobao.weex.ui.component.list.BasicListComponent)1 WXRecyclerView (com.taobao.weex.ui.view.listview.WXRecyclerView)1