All Projects → Wan7451 → Wan_RecycleViewAdapter

Wan7451 / Wan_RecycleViewAdapter

Licence: other
目前封装的比较完善的RecycleView适配器 新增可被Gradle引用

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Wan RecycleViewAdapter

AutoBindings
Set of annotations that aims to make your Android development experience easier along with lint checks.
Stars: ✭ 15 (-78.26%)
Mutual labels:  recyclerview-adapter, recycleview
Modular2Recycler
Modular²Recycler is a RecyclerView.Adapter that is modular squared.
Stars: ✭ 72 (+4.35%)
Mutual labels:  recyclerview-adapter
Airbnb Android Google Map View
This is a sample Android Application which has Google Map view similar to what AirBnb Android Application. Moving Markers like Uber/Ola. Custom Google Search for places. Recycler view with Animations added.
Stars: ✭ 175 (+153.62%)
Mutual labels:  recyclerview-adapter
BaseToolsLibrary
Android通用适配器和常用的工具类
Stars: ✭ 24 (-65.22%)
Mutual labels:  recyclerview-adapter
Moretype
new method to build data in RecyclerView with Kotlin!
Stars: ✭ 189 (+173.91%)
Mutual labels:  recyclerview-adapter
uMe
Online Chatting Application (Android) || Messaging App || Firebase
Stars: ✭ 138 (+100%)
Mutual labels:  recyclerview-adapter
Fastadapter
快速使用的RecyclerView Adapter
Stars: ✭ 170 (+146.38%)
Mutual labels:  recyclerview-adapter
AdapterCommands
Drop in solution to animate RecyclerView's dataset changes by using command pattern
Stars: ✭ 74 (+7.25%)
Mutual labels:  recyclerview-adapter
MultiTypeAdapter
RecyclerView通用多类型适配器MultiTypeAdapter,以布局文件为单位更细粒度的条目复用。
Stars: ✭ 18 (-73.91%)
Mutual labels:  recyclerview-adapter
Adapterdelegates
"Favor composition over inheritance" for RecyclerView Adapters
Stars: ✭ 2,735 (+3863.77%)
Mutual labels:  recyclerview-adapter
Admobadapter
It wraps your Adapter to display Admob native ads and banners in a ListView/RecyclerView data set. It based on the Yahoo fetchr project https://github.com/yahoo/fetchr
Stars: ✭ 224 (+224.64%)
Mutual labels:  recyclerview-adapter
Flap
Flap(灵动),一个基于 RecyclerView 的页面组件化框架。
Stars: ✭ 204 (+195.65%)
Mutual labels:  recyclerview-adapter
BaseRecyclerViewAdapter
RecyclerView通用适配器
Stars: ✭ 14 (-79.71%)
Mutual labels:  recyclerview-adapter
Loadmorewrapper
📦 make recyclerView supports load more and customize the footer view, without changes to the original adater of recyclerView. 在不改动 RecyclerView 原有的 adapter 的情况下,使 RecyclerView 滑动到底部的时候能够加载更多和自定义底部视图。
Stars: ✭ 179 (+159.42%)
Mutual labels:  recyclerview-adapter
E-commerceRetailerFYP
Android E-commerce Platform. Allow retailer to post product, manage order, chat and view report
Stars: ✭ 31 (-55.07%)
Mutual labels:  recyclerview-adapter
Customadapter
RV Adapter 优雅封装,抽取列表模版,可以快速的添加一个列表,使用组装的方式构建Adapter,抽象Cell 角色,负责创建ViewHolder,绑定数据和逻辑处理。Cell为一个独立的组件。
Stars: ✭ 172 (+149.28%)
Mutual labels:  recyclerview-adapter
Async Expandable List
Stars: ✭ 221 (+220.29%)
Mutual labels:  recyclerview-adapter
recyclerview-adapters
Multiple item adapters for RecyclerView (inspired by Merge Adapter)
Stars: ✭ 24 (-65.22%)
Mutual labels:  recyclerview-adapter
LiveAdapter
Auto updating RecyclerView Adapter for LiveData
Stars: ✭ 50 (-27.54%)
Mutual labels:  recyclerview-adapter
recyclerview-expandable
RecyclerView implementation of traex's ExpandableLayout
Stars: ✭ 70 (+1.45%)
Mutual labels:  recyclerview-adapter

Wan_RecycleViewAdapter

目前封装的比较完善的RecycleView适配器

  1. 可以添加多个头视图、尾视图
  2. 可以设置默认的分割线
  3. 可以隐藏第一个、第二个头视图的分割线
  4. 简化适配器中的方法
  5. ItemView设置点击事件
  6. 添加基于androidPullToRefreshlibrary的上下拉刷新RecycleView

用法如下:

ArrayList<String> data = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        for (int i = 0; i < 100; i++) {
            data.add("Item" + i);
        }
        final WanRecycleView mainView = (WanRecycleView) findViewById(R.id.mianView);

        WGAdapter adapter = new WGAdapter(this, data, android.R.layout.simple_list_item_1);
        mainView.getRefreshableView().setAdapter(adapter);


        ImageView headerView = new ImageView(this);
        headerView.setImageResource(R.mipmap.ic_launcher);

        adapter.addHeaderView(headerView); //添加头视图


        Button footerView = new Button(this);
        footerView.setText("load");
        adapter.addFooterView(footerView); //添加尾视图


        WanItemDecoration item = new WanItemDecoration(this, WanItemDecoration.VERTICAL_LIST);
        //item.setIsShowSecondItemDecoration(false); //不显示第一行 分割线
        item.setIsShowFirstItemDecoration(false);  //不显示第二行 分割线
        item.setMarginLeftDP(10);   //分割线左边距
        item.setMarginRightDP(10);  //分割线右边距

        mainView.getRefreshableView().addItemDecoration(item);  //添加分割线

        mainView.getRefreshableView().setLayoutManager(new LinearLayoutManager(this));

        adapter.setOnItemClickListener(this); //设置点击事件

        mainView.setScrollingWhileRefreshingEnabled(true);
        mainView.setMode(PullToRefreshBase.Mode.BOTH);
        mainView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<RecyclerView>() {
            @Override
            public void onPullDownToRefresh(PullToRefreshBase<RecyclerView> refreshView) {
                Toast.makeText(MainActivity.this, "下拉刷新", Toast.LENGTH_SHORT).show();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {

                        mainView.onRefreshComplete();
                    }
                }, 4000);
            }

            @Override
            public void onPullUpToRefresh(PullToRefreshBase<RecyclerView> refreshView) {
                Toast.makeText(MainActivity.this, "上拉加载", Toast.LENGTH_SHORT).show();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {

                        mainView.onRefreshComplete();
                    }
                }, 4000);
            }
        });
    }

    @Override
    public void onItemClickListener(int posotion) {
        Toast.makeText(this, data.get(posotion), Toast.LENGTH_LONG).show();
    }

    class WGAdapter extends WanAdapter<String> {


        protected WGAdapter(Context context, List<String> mDatas, int itemLayoutId) {
            super(context, mDatas, itemLayoutId);
        }

        /**
         * @param holder itemHolder
         * @param item   每一Item显示的数据
         */
        @Override
        public void convert(WanViewHolder holder, String item) {
            //holder.setText(android.R.id.text1, item);
            //或者
            TextView text = holder.getView(android.R.id.text1);
            text.setText(item);
        }
    }

注意: 需要主题中添加样式, 设置分割线的显示效果

<style> @drawable/divider </style>

使用

compile 'com.wan7451:wanadapter:1.0.1'

我的博客 http://blog.csdn.net/mr_wanggang/article/details/46649235

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].