SnappingSwipingRecyclerView

Introduction: 实现了类似微信读书首页的长按删除的特效和动画, 并且使 RecyclerView 可以像 ViewPager 那样使用
More: Author   ReportBugs   
Tags:
RecyclerView-微信-微信读书-ViewPager-长按删除-

Intro

SnappingSwipingRecyclerView is an implementation of "viewpager-like" behavior of RecyclerView, but it also adds a "long press to swipe" pattern like used in Wechat Reading, A.K.A, 微信读书, in Chinese.

Usage

You can use classes like SwipeGestureHelper, SnappyRecyclerView, SnappyLinearLayoutManager, MarginDecoration directly, just read their Java doc.

Or, you can simply use this convenient SnappingSwipingViewBuilder class to save you some work.

    RecyclerView recyclerView = new SnappingSwipingViewBuilder(this)
                    .setAdapter(mAdapter)
                    .setHeadTailExtraMarginDp(17F)
                    .setItemMarginDp(8F, 20F, 8F, 20F)
                    .setOnSwipeListener(this)
                    .setSnapMethod(SnappyLinearLayoutManager.SnappyLinearSmoothScroller.SNAP_CENTER)
                    .build();

TODOs

  • Add support for vertical layouts
  • Add relative width support for item views
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools