Giter VIP home page Giter VIP logo

multi-recycle-view's Introduction

MultiRecycleView

介绍

{以下是 Gitee 平台说明,您可以替换此简介 Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 https://gitee.com/enterprises}

软件架构

软件架构说明

安装教程

  1. xxxx
  2. xxxx
  3. xxxx

使用说明

示例代码:

multiRecycleView = new MultiRecycleView.Builder()
                .setOnViewHolderCreateListener(new OnViewHolderCreateListener() {
                    @Override
                    public BaseHolder onCreateHolder(ViewGroup parent, int holderType) {
                        switch (holderType) {
                            case ITEM_TYPE_TXT:
                                return new BaseHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_test_txt, parent, false), holderType) {
                                    @Override
                                    public void setData(Object data) {
                                        if (!hadLoadData) {
                                            if (data instanceof String) {
                                                ((TextView) itemView.findViewById(R.id.tv_test)).setText((String) data);
                                            }
                                        }
                                    }
                                };
                            case ITEM_TYPE_IMG:
                                return new BaseHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_test_img, parent, false), holderType) {
                                    @Override
                                    public void setData(Object data) {
                                        if (!hadLoadData) {
                                            if (data instanceof Integer) {
                                                ((ImageView) itemView.findViewById(R.id.iv_test)).setImageResource((int) data);
                                            }
                                        }
                                    }
                                };
                            case ITEM_TYPE_BOTTOM_LIST_TYPE:
                                return new SimpleCategoryViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_item_category, parent, false), holderType);
                            default:
                        }
                        return new BaseHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_test_img, parent, false), holderType) {
                            @Override
                            public void setData(Object data) {
                                if (!hadLoadData) {
                                    if (data instanceof Integer) {
                                        ((ImageView) itemView.findViewById(R.id.iv_test)).setImageResource((int) data);
                                    }
                                }
                            }
                        };
                    }
                })
                .setOnRefreshListener(new OnRefreshListener() {
                    @Override
                    public void onRefresh(@NonNull RefreshLayout refreshLayout) {
                        multiRecycleView.setData(ITEM_TYPE_TXT, "测试数据" + System.currentTimeMillis());
                        refreshLayout.finishRefresh();
                    }

                })
                .setOnLoadMoreDataListener(new OnLoadMoreDataListener() {
                    @Override
                    public void loadData(final CategoryBean dataType) {
                        ArrayList<CategoryItemData> aa = new ArrayList();
                        for (int i = 0; i < 30; i++) {
                            CategoryItemData categoryItemData = new CategoryItemData();
                            aa.add(categoryItemData);
                        }
                        multiRecycleView.setCategoryListData(dataType, aa);
                    }
                })
                .build(getActivity());
        View conview = multiRecycleView.createView();
        ((LinearLayout) view.findViewById(R.id.ll_content)).addView(conview);
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) conview.getLayoutParams();
        params.height = LinearLayout.LayoutParams.MATCH_PARENT;
        conview.setLayoutParams(params);
        multiRecycleView.setData(ITEM_TYPE_TXT, "测试数据");
        multiRecycleView.setData(ITEM_TYPE_IMG, R.mipmap.ic_launcher);
        for (int i = 0; i < 4; i++) {
            multiRecycleView.setData(3+i, R.mipmap.ic_launcher);
        }

        ArrayList<CategoryProBean> menus = new ArrayList<>();
        CategoryProBean categoryProBean = new CategoryProBean("菜单一", "类型1", R.layout.item_test_txt, CATEGORY_TYPE_LIST, 1);
        CategoryProBean categoryProBean2 = new CategoryProBean("菜单二", "类型2", R.layout.item_test_txt, CATEGORY_TYPE_GRID, 2);
        CategoryProBean categoryProBean3 = new CategoryProBean("菜单3", "类型3", R.layout.item_test_txt, CATEGORY_TYPE_FLOW, 3);
        menus.add(categoryProBean);
        menus.add(categoryProBean2);
        menus.add(categoryProBean3);
        multiRecycleView.setData(ITEM_TYPE_BOTTOM_LIST_TYPE, menus);

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

multi-recycle-view's People

Contributors

xingkongyu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.