All Projects → rubensousa → Gravitysnaphelper

rubensousa / Gravitysnaphelper

Licence: apache-2.0
A SnapHelper that snaps a RecyclerView to an edge.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Gravitysnaphelper

Delegationadapter
一种优雅的方式来使用RecyclerView
Stars: ✭ 382 (-92.08%)
Mutual labels:  recyclerview
Androidwithkotlin
🚀 These are android sample projects which are written in Kotlin. It covers video streaming, mp3 player, sqlite, location services, custom camera, o-notifications, simple compass etc.
Stars: ✭ 447 (-90.73%)
Mutual labels:  recyclerview
Yasha
Kotlin-based modern RecyclerView rendering weapon
Stars: ✭ 494 (-89.76%)
Mutual labels:  recyclerview
Brvah kotlin
This is kotlin BRVAH Demo
Stars: ✭ 402 (-91.66%)
Mutual labels:  recyclerview
Alphabetindex Fast Scroll Recyclerview
A Powerful AlphabetIndex FastScroller Library for Android's RecyclerView!
Stars: ✭ 444 (-90.79%)
Mutual labels:  recyclerview
Dragdropswiperecyclerview
Kotlin Android library that extends RecyclerView to support gestures like drag & drop and swipe, among others. It works with vertical, horizontal and grid lists.
Stars: ✭ 469 (-90.27%)
Mutual labels:  recyclerview
Adapter
A quick adapter library for RecyclerView, GridView, ListView, ViewPager, Spinner
Stars: ✭ 376 (-92.2%)
Mutual labels:  recyclerview
Androidribbon
🎀 The simple way to implement a beautiful ribbon with the shimmering on Android.
Stars: ✭ 502 (-89.59%)
Mutual labels:  recyclerview
Recycler Fast Scroll
Provides fast scroll and section idexer for recycler view
Stars: ✭ 445 (-90.77%)
Mutual labels:  recyclerview
Spannedgridlayoutmanager
Android RecyclerView.LayoutManager that resizes and reorders views based on SpanSize
Stars: ✭ 492 (-89.8%)
Mutual labels:  recyclerview
Recyclerviewtemplate
One Template which solves all frequently used RecyclerViews Code Snippets
Stars: ✭ 404 (-91.62%)
Mutual labels:  recyclerview
Recyclerview Gallery
Recyclerview-Gallery:This library shows you a gallery using RecyclerView.
Stars: ✭ 420 (-91.29%)
Mutual labels:  recyclerview
Nestedrecyclerview
🔥Copied the homepage of taobao and jd.com, and realized the TAB ceiling effect through two-layer nesting RecyclerView .
Stars: ✭ 479 (-90.07%)
Mutual labels:  recyclerview
Popupbubble
🅿️ Easily add and customise "New Post" popup button with the feeds (RecyclerView) of your app.
Stars: ✭ 385 (-92.02%)
Mutual labels:  recyclerview
Suspensionbar
A RecyclerView suspension bar implementation like Instagram
Stars: ✭ 494 (-89.76%)
Mutual labels:  recyclerview
Multiitem
一个优雅的实现多类型的RecyclerView类库 支持DataBinding Form表单录入 跨多个RecyclerView拖动
Stars: ✭ 381 (-92.1%)
Mutual labels:  recyclerview
Tvrecyclerview
TvRecyclerView--针对TV端特性进行的适配与开发
Stars: ✭ 453 (-90.61%)
Mutual labels:  recyclerview
Easyrecyclerviewsidebar
🔍 Easy sidebar for Android RecyclerView (。>﹏<。)
Stars: ✭ 509 (-89.44%)
Mutual labels:  recyclerview
Coder
Android Material Design 风格控件的学习及遇到的问题;Tablayout | 横向布局标签,TextInputLayout | 文字输入布局 ,FloatingActionButton | 悬浮按钮, CoordinatorLayout APPBarLayout CollapsingTabLayout实现折叠头布局,BottomSheetDialog | 底部对话框,Touch Feedback| 触摸反馈,Reveal Effect| 揭示效果,Curved motion | 曲线运动,Animated Vector Drawables | 矢量图片动画
Stars: ✭ 502 (-89.59%)
Mutual labels:  recyclerview
Indicatordialog
a dialog with arrow indicator in the location where you want
Stars: ✭ 485 (-89.94%)
Mutual labels:  recyclerview

GravitySnapHelper

A SnapHelper that snaps a RecyclerView to an edge.

Setup

Add this to your build.gradle:

implementation 'com.github.rubensousa:gravitysnaphelper:2.2.2'

How to use

You can either create a GravitySnapHelper, or use GravitySnapRecyclerView.

If you want to use GravitySnapHelper directly, you just need to create it and attach it to your RecyclerView:

val snapHelper = GravitySnapHelper(Gravity.START)
snapHelper.attachToRecyclerView(recyclerView)

If you want to use GravitySnapRecyclerView, you can use the following xml attributes for customisation:

<attr name="snapGravity" format="enum">
<attr name="snapEnabled" format="boolean" />
<attr name="snapLastItem" format="boolean" />
<attr name="snapToPadding" format="boolean" />
<attr name="snapScrollMsPerInch" format="float" />
<attr name="snapMaxFlingSizeFraction" format="float" />

Example:

<com.github.rubensousa.gravitysnaphelper.GravitySnapRecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:snapGravity="start" />

Start snapping

val snapHelper = GravitySnapHelper(Gravity.START)
snapHelper.attachToRecyclerView(recyclerView)

Center snapping

val snapHelper = GravitySnapHelper(Gravity.CENTER)
snapHelper.attachToRecyclerView(recyclerView)

Limiting fling distance

If you use setMaxFlingSizeFraction or setMaxFlingDistance you can change the maximum fling distance allowed.

With decoration

Features

  1. setMaxFlingDistance or setMaxFlingSizeFraction - changes the max fling distance allowed.
  2. setScrollMsPerInch - changes the scroll speed.
  3. setGravity - changes the gravity of the SnapHelper.
  4. setSnapToPadding - enables snapping to padding (default is false)
  5. smoothScrollToPosition and scrollToPosition
  6. RTL support out of the box

Nested RecyclerViews

Take a look at these blog posts if you're using nested RecyclerViews

  1. Improving scrolling behavior of nested RecyclerViews

  2. Saving scroll state of nested RecyclerViews

License

Copyright 2018 The Android Open Source Project
Copyright 2019 Rúben Sousa

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].