BaseRecyclerViewAdapterHelper

1 和databing 的联合使用

/**
 * 作者:水东流 编于 2019/3/20
 * 协助adapter中使用databing
 */
public class MyBaseViewHolder extends BaseViewHolder {
    public MyBaseViewHolder(View view) {
        super(view);
    }
}

 

/**
 * 作者:水东流 编于 2019/3/20
 * 关注适配器
 */
public class FollowAdapter extends BaseQuickAdapter {

    public FollowAdapter(@Nullable List data) {
        super(data);
    }

    @Override
    protected MyBaseViewHolder onCreateDefViewHolder(ViewGroup parent, int viewType) {
        ItemXinHuaFollowBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext),     R.layout.item_xin_hua_follow, parent, false);
        return new MyBaseViewHolder(binding.getRoot());
    }

    @Override
    protected void convert(MyBaseViewHolder helper, XinHuaBean item) {
        ItemXinHuaFollowBinding binding = DataBindingUtil.getBinding(helper.itemView);

        ImageLoaderUtil.getInstance().loadImage(mContext, item.getXinhuaCover(), helper.getView(R.id.cover));
        binding.setXinhuabean(item);
 } 
}

item_xin_hua_follow 布局




    

        
    

    

        

        

            

            
        

    

2 支持动画

 

followAdapter.isFirstOnly(false);
//慢慢淡进
//adapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);
//慢慢放大进入
//adapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
//从下滑入
// followAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_BOTTOM);
//从左滑入
followAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_LEFT);
//从有滑入
//adapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);

 

 

你可能感兴趣的:(BaseRecyclerViewAdapterHelper)