一个多功能的RecyclerView,包括了下拉刷新、加载更多,滑动删除,拖拽排序、多种动画、视差拖动、Toolbar渐变、Toolbar和FAB随着滚动出现消失等等效果,都可以放在同一个RecyclerVIew中并自由配置。

项目地址:https://github.com/cymcsg/UltimateRecyclerView

Description

UltimateRecyclerView is a RecyclerView(advanced and flexible version of ListView) with pulling to refresh, loading more, swiping to dismiss, draging and drop, animations ,show or hide toolbar and FAB when scrolling and many other features.You can use it just like RecyclerView.

Notice that UltimateRecyclerView is a project under development.

Features:

  • Swipe to refresh(using android.support.v4.widget.SwipeRefreshLayout)
  • Many kinds of animations
  • Swipe to dismiss
  • Parallax head view
  • Drag and drop
  • Loading more when reach the last item(infinite scrolling)
  • Custom views in loading more
  • Showing or hiding toolbar and floating button when scrolling

Upcoming features:

  • More animations
  • Colorful style of Swipe to refresh

If you have some good idea, please mention us.My email is cymcsg # gmail.com

Welcome to fork.

If you want to use a rapid development framework for developing apps,you can try UltimateAndroid Framework.

Screenshot




Sample

You can clone the project and compile it yourself (it includes a sample), or you can check it out already compiled at Google Play

Notice that it might not be the latest version

Quick Setup(Basic Usage)

1.Integration
repositories {        jcenter()    }dependencies {    ...    compile 'com.marshalchen.ultimaterecyclerview:library:0.2.1'}
2.Usage:
<com.marshalchen.ultimaterecyclerview.UltimateRecyclerView        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:id="@+id/ultimate_recycler_view"        app:recyclerviewClipToPadding="true"        app:recyclerviewPadding="2dp">        com.marshalchen.ultimaterecyclerview.UltimateRecyclerView>
3.Features:

Loading more:

  ultimateRecyclerView.enableLoadmore();

Set ParallaxHeader:

 ultimateRecyclerView.setParallaxHeader(getLayoutInflater().inflate(R.layout.parallax_recyclerview_header, ultimateRecyclerView.mRecyclerView, false));        ultimateRecyclerView.setOnParallaxScroll(new UltimateRecyclerView.OnParallaxScroll() {            @Override            public void onParallaxScroll(float percentage, float offset, View parallax) {                Drawable c = toolbar.getBackground();                c.setAlpha(Math.round(127 + percentage * 128));                toolbar.setBackgroundDrawable(c);            }        });

Set swipe to refresh:

 ultimateRecyclerView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {            @Override            public void onRefresh() {                new Handler().postDelayed(new Runnable() {                    @Override                    public void run() {                        simpleRecyclerViewAdapter.insert("Refresh things", 0);                        ultimateRecyclerView.setRefreshing(false);                        //   ultimateRecyclerView.scrollBy(0, -50);                        linearLayoutManager.scrollToPosition(0);                    }                }, 1000);            }        });

Set swipe to dismiss:

  ultimateRecyclerView.setSwipeToDismissCallback(new SwipeToDismissTouchListener.DismissCallbacks() {            @Override            public SwipeToDismissTouchListener.SwipeDirection dismissDirection(int position) {                return SwipeToDismissTouchListener.SwipeDirection.BOTH;            }            @Override            public void onDismiss(RecyclerView view, List dismissData) {                for (SwipeToDismissTouchListener.PendingDismissData data : dismissData) {                    simpleRecyclerViewAdapter.remove(data.position);                }            }            @Override            public void onResetMotion() {                isDrag = true;            }            @Override            public void onTouchDown() {                isDrag = false;            }        }); ``` Drag and drop: ```java    dragDropTouchListener = new DragDropTouchListener(ultimateRecyclerView.mRecyclerView, this) {            @Override            protected void onItemSwitch(RecyclerView recyclerView, int from, int to) {                simpleRecyclerViewAdapter.swapPositions(from, to);                simpleRecyclerViewAdapter.clearSelection(from);                simpleRecyclerViewAdapter.notifyItemChanged(to);                if (actionMode != null) actionMode.finish();                Logs.d("switch----");            }            @Override            protected void onItemDrop(RecyclerView recyclerView, int position) {                Logs.d("drop----");                ultimateRecyclerView.enableSwipeRefresh(true);            }        };        dragDropTouchListener.setCustomDragHighlight(getResources().getDrawable(R.drawable.custom_drag_frame));        ultimateRecyclerView.mRecyclerView.addOnItemTouchListener(dragDropTouchListener);

Animations:

java
ultimateRecyclerView.setItemAnimator(Type.values()[position].getAnimator());
ultimateRecyclerView.getItemAnimator().setAddDuration(300);
ultimateRecyclerView.getItemAnimator().setRemoveDuration(300);

Showing and hiding toolbar and floating button:

java
ultimateRecyclerView.setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
}
@Override
public void onDownMotionEvent() {
}
@Override
public void onUpOrCancelMotionEvent(ObservableScrollState observableScrollState) {
if (observableScrollState == ObservableScrollState.DOWN) {
ultimateRecyclerView.showToolbar(toolbar, ultimateRecyclerView,getScreenHeight());
} else if (observableScrollState == ObservableScrollState.UP) {
ultimateRecyclerView.hideToolbar(toolbar,ultimateRecyclerView,getScreenHeight());
} else if (observableScrollState == ObservableScrollState.STOP) {
}
}
});

If you want to see more details,you can check the demo.

更多相关文章

  1. Android(安卓)仿微信对话列表滑动删除效果
  2. android shape标签的使用
  3. Android(安卓)新控件学习
  4. Android(安卓)UI设计中的三种特效
  5. android ListView的item侧滑删除
  6. android ViewFilpper(二)
  7. Android(安卓)SeekBar控件
  8. Android开发小技巧之对android颜色渐变(Gradient )的改进
  9. ScaleImageView图片缩放查看器

随机推荐

  1. PHP 高性能 Excel 扩展 1.2.7 发布
  2. php截取字符串不乱码
  3. php跳转不改变浏览器地址
  4. php计算一个月多少天
  5. php火狐如何获取cookie
  6. php无法获取真实ip
  7. PHP 获取Memcached的cas_token
  8. PHP三种方式实现链式操作
  9. Linux服务器查看PHP是否支持mail()函数方
  10. php实现共享内存进程通信函数之shm