All Projects → nukc → Loadmorewrapper

nukc / Loadmorewrapper

Licence: apache-2.0
📦 make recyclerView supports load more and customize the footer view, without changes to the original adater of recyclerView. 在不改动 RecyclerView 原有的 adapter 的情况下,使 RecyclerView 滑动到底部的时候能够加载更多和自定义底部视图。

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Loadmorewrapper

Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+1535.75%)
Mutual labels:  custom-view, recyclerview-adapter
Stateview
✨ StateView is an invisible, zero-sized View that can be used to lazily inflate loadingView/emptyView/retryView at runtime.
Stars: ✭ 573 (+220.11%)
Mutual labels:  retry, custom-view
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+317.88%)
Mutual labels:  custom-view, recyclerview-adapter
Easyrecyclerview
🎞 Easy recyclerview for Android
Stars: ✭ 131 (-26.82%)
Mutual labels:  recyclerview-adapter
Flareview
Create Animatic flares around your uiview's. Visit http://stanlyhardy.github.io/FlareView for more info
Stars: ✭ 136 (-24.02%)
Mutual labels:  custom-view
Safely
Safely is a Clojure's circuit-breaker library for handling retries in an elegant declarative way.
Stars: ✭ 152 (-15.08%)
Mutual labels:  retry
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 (-2.23%)
Mutual labels:  recyclerview-adapter
Flutter mvp
使用Flutter MVP结构开发的短视频类小项目,加入各种平滑的过渡动画。欢迎Star或Fork!
Stars: ✭ 124 (-30.73%)
Mutual labels:  custom-view
Rehttp
Package rehttp implements a Go HTTP transport that handles retries.
Stars: ✭ 170 (-5.03%)
Mutual labels:  retry
Androidcustomview
一个简单的投票排名对比图
Stars: ✭ 150 (-16.2%)
Mutual labels:  custom-view
Swipelayout
A library what allows you to execute a swipe for the android platform
Stars: ✭ 150 (-16.2%)
Mutual labels:  custom-view
Toolkit
Collection of useful patterns
Stars: ✭ 137 (-23.46%)
Mutual labels:  retry
Kotlin Retry
A higher-order function for retrying operations that may fail.
Stars: ✭ 159 (-11.17%)
Mutual labels:  retry
Multiplestatusview
一个支持多种状态的自定义View,可以方便的切换到:加载中视图、错误视图、空数据视图、网络异常视图、内容视图。
Stars: ✭ 1,676 (+836.31%)
Mutual labels:  custom-view
Customadapter
RV Adapter 优雅封装,抽取列表模版,可以快速的添加一个列表,使用组装的方式构建Adapter,抽象Cell 角色,负责创建ViewHolder,绑定数据和逻辑处理。Cell为一个独立的组件。
Stars: ✭ 172 (-3.91%)
Mutual labels:  recyclerview-adapter
Custom Work For Brackets
<involuntarily lost source code> ____ Adds toolbar it include buttons show/hide with tabs of active documents on the top of the editor.
Stars: ✭ 126 (-29.61%)
Mutual labels:  custom-view
Fastadapter
快速使用的RecyclerView Adapter
Stars: ✭ 170 (-5.03%)
Mutual labels:  recyclerview-adapter
Imageframe
高效省内存播放序列帧动画控件
Stars: ✭ 147 (-17.88%)
Mutual labels:  custom-view
Android Rv Swipe Delete
RecyclerView swipe to delete example.
Stars: ✭ 143 (-20.11%)
Mutual labels:  recyclerview-adapter
Android Animations
DIfferent animation samples on Android
Stars: ✭ 152 (-15.08%)
Mutual labels:  custom-view

LoadMoreWrapper

Build Status Download

make recyclerView supports load more and customize the footer view, without changes to the original adater of recyclerView.

在不改动 RecyclerView 原有 adapter 的情况下,使其拥有加载更多功能和自定义底部视图。

  • 支持当 item 未铺满屏幕的时候仍能够加载更多
  • 支持自定义加载视图
  • 当 layoutManager 为 Grid 和 StaggeredGrid 的时候, 加载更多视图 footerView 仍占据一行
  • 支持设置是否显示没有更多视图,可自定义
  • 支持设置加载失败视图,点击会自动触发加载更多事件

Installation

JCenter:

add the dependency to your build.gradle:

    implementation 'com.github.nukc:loadmorewrapper:1.9.1'

JitPack:

Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

Step 2. Add the dependency

    dependencies {
        implementation 'com.github.nukc:LoadMoreWrapper:v1.9.1'
    }

Usage

    //the adapter is the original (这个 adapter 是原有的, 不改动它)
    LoadMoreWrapper.with(adapter)
        .setFooterView(...) // view or layout resource
        .setShowNoMoreEnabled(true) // enable show NoMoreView,default false
        .setListener(new LoadMoreAdapter.OnLoadMoreListener() {
             @Override
             public void onLoadMore(LoadMoreAdapter.Enabled enabled) {
                 // do something
                 // you can enabled.setLoadMoreEnabled(false) when do not need load more
                 // you can enabled.setLoadFailed(true) when load failed
             })
        .into(recyclerView);

or

in the original adapter: demo

    private static class AnotherAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

        private LoadMoreWrapper mWrapper;

        // code..

        @Override
        public void onAttachedToRecyclerView(RecyclerView recyclerView) {
            super.onAttachedToRecyclerView(recyclerView);

            mWrapper = LoadMoreWrapper.with(this);
            mWrapper.setListener(
                    new LoadMoreAdapter.OnLoadMoreListener() {
                        @Override
                        public void onLoadMore(LoadMoreAdapter.Enabled enabled) {
                            // do something
                        }
                    })
                    .setShowNoMoreEnabled(true)
                    .into(recyclerView);
        }

    }

方法名 备注
setLoadMoreEnabled(boolean enabled) 设置是否启用加载更多,默认 true
setShowNoMoreEnabled(boolean enabled) 设置全部加载完后是否显示没有更多视图,默认 false
setLoadFailed(boolean isLoadFailed) 设置是否加载失败,默认 false
setNotShowFooterWhenNotCoveredScreen(boolean notShow) 设置在 item 未铺满屏幕的时候是否不显示底部视图,默认 false
getOriginalAdapter() 获取原来的 adapter
getFooterView 获取加载更多视图
getNoMoreView 获取没有更多视图
getLoadFailedView 获取加载失败视图

注意:当加载完全部后且已 setLoadMoreEnabled(false),但如果由于生命周期或其他问题而导致 View 重建,mLoadMoreEnabled 依然为 true。 这时候应该需要保存 mLoadMoreEnabled 的状态,如果是 ViewPager + Fragment,可以使用 setOffscreenPageLimit 进行解决。

License

Copyright 2016 nukc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].