Android library for multiple snapping of RecyclerView

Overview

MultiSnapRecyclerView

Gradle

dependencies {
    implementation 'com.github.takusemba:multisnaprecyclerview:x.x.x'
}

Features

Build Status Download License API

This is an Android Library for multiple snapping of RecyclerView. MultiSnapRecyclerView easily provides a snapping feature to your recycler view. What this does are clean, neat, and powerful.

  • gravitated snapping to start end and center.
  • snap count to specify the number of items to scroll over.
  • supports horizontal and vertical scrolling.
  • listener to be called when snapped.
  • sample code.
  • support reverse layout.

Make sure to use LinearManger. Other managers are not supported.



Usage

There are two ways to use MultiSnapRecyclerView.

You can either use MultiSnapRecyclerView in your layout.

<com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:msrv_gravity="start" or center, end
        app:msrv_interval="2" items to scroll over
        app:msrv_ms_per_inch="100" /> // speed of scrolling through.

Or you can simply attach MultiSnapHelper to your normal RecyclerView.

val multiSnapHelper = MultiSnapHelper(gravity, interval, speedMsPerInch)
multiSnapHelper.attachToRecyclerView(recyclerView)

Sample

Clone this repo and check out the app module.

Author

Licence

Copyright 2017 Taku Semba.

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.
Comments
  • Backward scrolling sometimes snaps twice

    Backward scrolling sometimes snaps twice

    I have a horizontal MultiSnapRV, my XML code:

    <com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView
            android:id="@+id/rv_weeks"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            app:msrv_gravity="start"
            app:msrv_snap_count="7" />
    

    When I scroll it forward, it works amazing and smooth. But if I scroll backward, sometimes it scrolls 14 positions, not 7. Is it bug or I missed something?

    opened by ghost 9
  • snap last item with ItemDecoration

    snap last item with ItemDecoration

    It was able to snap last item at v1.3.4, however after upgrading to v2.0.1 it will bounce back to the previous item rather than focus on the last item.

    2019-12-26 09-00-47 的螢幕擷圖

    opened by imunique-ZJ 8
  • mLayout is null

    mLayout is null

    When running the app, it throws "java.lang.IllegalArgumentException: other than LinearLayoutManger is not supported" being that at onAttachedToWindow, mLayout is null therefore is not an instance of LinearLayoutManager.

    So what's happening here?

    opened by encouver 8
  • RecyclerView scrolling is too slow.

    RecyclerView scrolling is too slow.

    Hi TakuSemba,

    After attaching your code the recycler scroll works too slow. Either it's just scroll to msrv_snap_count or if we define higher value then it skips all the items.

    opened by parveenkumardeeva 6
  • A warning appear.

    A warning appear.

    A warning appears when i swipe from the recyclerview. The test machine is the Nexus 5x android 7.0 version api 24. Can I ignore it?

    E/RecyclerView: Smooth Scroll action is being updated too frequently. Make sure you are not changing it unless necessary

    opened by Ahyounglove 2
  • Hi, thank you for the request.

    Hi, thank you for the request.

    Hi, thank you for the request.

    I'm just wondering if recyclerView.smoothScrollToPosition(position) does not work for your case? It would be helpful if you could give me a situation you want to scroll with `SnapHelpe

    opened by buornhnufnofnr 1
  • Not able to show last item with gravity start

    Not able to show last item with gravity start

    I found a bug where the list is preventing the last item to be shown when app:msrv_gravity="start" is set.

    Screen recording of issue with library's sample app: end not snapping with gravity start normal font.mp4.zip

    Phone: OnePlus One Android Version: 6.0.1

    Edit Apparently this happens to first item when app:msrv_gravity="start" is set with app:msrv_interval="2"

    opened by azri92 1
  • Any idea how to handle screen orientation?

    Any idea how to handle screen orientation?

    Gravity: Center Snap Count: 1 Orientation: Vertical Portrait: showing multiple items depends on the item height Landscape: showing one item in fullscreen I did recycler_view.scrollToPosition() in onConfigurationChanged. Portrait -> Landscape is working fine Landscape -> Portrait: the item is in top, instead of center, until you scroll again

    opened by sosasang 1
  • java.lang.IllegalArgumentException: other than LinearLayoutManger is not supported

    java.lang.IllegalArgumentException: other than LinearLayoutManger is not supported

    use MultiSnapRecyclerView in a RecyclerView item

                    MultiSnapRecyclerView snapRecyclerView = null;
                    SkipAppAdapter appAdapter = new SkipAppAdapter(snapRecyclerView, data.getFastInDataBean());
                    snapRecyclerView = holder.getView(R.id.snapRecycleView);
                    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
                    snapRecyclerView.setLayoutManager(layoutManager);
                    snapRecyclerView.setAdapter(appAdapter);
    
                    snapRecyclerView.setOnSnapListener(new OnSnapListener() {
                        @Override
                        public void snapped() {
                            // do something
                        }
                    });
    
    opened by geoffery009 1
  • Snap to the clicked item of RecyclerView

    Snap to the clicked item of RecyclerView

    Hi,

    One more enhancement, if we click on any item of the RecyclerView then snap the selected position.

    I.e. we can snap via two modes, one by touching the item or by scrolling to it.

    opened by parveenkumardeeva 1
  • Import library issue

    Import library issue

    sorry, I forgot to upload jar to jCenter. for now, you have to use this library importing through my maven repository like this

    // set marven url
    repositories {
      maven { url 'https://dl.bintray.com/takusemba/maven' }
    }
    
    // compile library in dependencies
    dependencies {
        compile 'com.github.takusemba:multisnaprecyclerview:x.x.x'
    }
    
    

    Im adding this to jCenter now. After few hours you can import this library just like this below

    dependencies {
        compile 'com.github.takusemba:multisnaprecyclerview:x.x.x'
    }
    
    opened by TakuSemba 1
  • >for me

    >for me

    Shell or other controller

    Originally posted by @Richiejames32 in https://github.com/TakuSemba/MultiSnapRecyclerView/issues/29#issuecomment-1219722373

    opened by Richiejames32 0
  • Alternatives to msrv_speed_ms_per_inch

    Alternatives to msrv_speed_ms_per_inch

    Hello and thank you for your library, it helped me a lot! However, I found an issue in your implementation. In fact there are two issues in one:

    1. ms/inch is not a speed, it's inversion of speed, so the word "speed" in the attribute name is very confusing;
    2. It would be better to have some alternative attribute to define constant snap time.

    I'll explain the second issue as it is more important. If you swipe your recyclerview on a small screen in portrait mode with (for example) msrv_speed_ms_per_inch=50, it will change the page pretty fast. But if you'll try it on a bigger device (on a tablet), it will scroll really slow, because it has a larger surface and it takes more time to reach target point.

    Instead, it would be better to declare a constant time for snap helper, that will be equally fast on both devices.

    opened by mvgreen 3
Owner
TakuSemba
ex: CyberAgent.Inc, AbemaTv.Inc. currently, Invoice2go.Inc.
TakuSemba
Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...

Note: Due to lack of time, Iconify is no longer maintained and icon packs are outdated. I'd be very happy to welcome a new contributor, please reach m

Joan Zapata 3.9k Dec 24, 2022
Janishar Ali 2.1k Jan 1, 2023
Easily create complex recyclerview adapters in android

?? Due to the nature of my job and growing popularity of Jetpack Compose, I lack the motivation to keep this project alive. Recyclerview is one of the

Riyaz Ahamed 823 Jan 6, 2023
Drag and drop to reorder items in a list, grid or board for Android. Based on RecyclerView. Also supports swiping items in a list.

DragListView DragListView can be used when you want to be able to re-order items in a list, grid or a board. It also supports horizontal swiping of it

Magnus Woxblom 658 Nov 30, 2022
This project has been superseded by SuperSLiM, a layout manager for RecyclerView. I strongly recommend using SuperSLiM and not StickyGridHeaders.

StickyGridHeaders Replacement project at SuperSLiM This repository is abandoned and will no longer see any development or support. The replacement Sup

Tonic Artos 1.5k Nov 15, 2022
Just a Wheel——A easy way to setEmptyView to ListView、GridView or RecyclerView etc..

中文说明在这里 TEmptyView Just a Wheel—— A easier way to setEmptyView. Without having to write xml file every time. It supports AdapterView(ListView,GridView

Barry 454 Jan 9, 2023
A simple launcher which displays all the apps on a RecyclerView trying to KISS

A simple launcher which displays all the apps on a RecyclerView trying to KISS

Alex Allafi 1 Jun 17, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
Android library providing bread crumbs to the support library fragments.

Hansel And Gretel Android library providing bread crumbs for compatibility fragments. Usage For a working implementation of this project see the sampl

Jake Wharton 163 Nov 25, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Dec 6, 2022
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Julián Suárez 520 Nov 11, 2022
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
A Material design Android pincode library. Supports Fingerprint.

LolliPin A Lollipop material design styled android pincode library (API 14+) To include in your project, add this to your build.gradle file: //Loll

Omada Health 1.6k Nov 25, 2022
Android Library to implement simple touch/tap/swipe gestures

SimpleFingerGestures An android library to implement simple 1 or 2 finger gestures easily Example Library The library is inside the libSFG folder Samp

Arnav Gupta 315 Dec 21, 2022