All Projects → valkriaine → Bouncy

valkriaine / Bouncy

Licence: Apache-2.0 license
RecyclerView and NestedScrollView with physics-based bouncy overscroll effect

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Bouncy

Overscroll Decor
Android: iOS-like over-scrolling effect applicable over almost all scrollable Android views.
Stars: ✭ 2,671 (+1509.04%)
Mutual labels:  recyclerview, overscroll
CeilingLayout
CeilingLayout用来控制子View的吸顶联滑,理论上支持实现了NestedScrollingChild的联滑控件,如NestedScrollView、RecyclerView、SmartRefreshLayout等;只需要在xml里配置需要吸顶子View的位置索引就能自动实现吸顶联滑效果。
Stars: ✭ 26 (-84.34%)
Mutual labels:  recyclerview, nestedscrollview
SpacingItemDecoration
ItemDecoration for RecyclerView that allows you to set spacing between and around list items in flexible way.
Stars: ✭ 83 (-50%)
Mutual labels:  recyclerview
endless-recycler-view
RecyclerView with paging
Stars: ✭ 30 (-81.93%)
Mutual labels:  recyclerview
Adsorbent
Adsorbent of RecyclerView , RecyclerView吸顶
Stars: ✭ 25 (-84.94%)
Mutual labels:  recyclerview
Android-Code-Demos
📦 Android learning code demos.
Stars: ✭ 41 (-75.3%)
Mutual labels:  recyclerview
RxPagination
Implement pagination in just few lines with RxPagination
Stars: ✭ 20 (-87.95%)
Mutual labels:  recyclerview
slush
This library will no longer be updated 😭
Stars: ✭ 26 (-84.34%)
Mutual labels:  recyclerview
Android-RecyclerView-Loadmore
RecyclerView Loadmore and Swipe refresh for LinearLayout GridLayout and StaggeredLayout
Stars: ✭ 27 (-83.73%)
Mutual labels:  recyclerview
Android
Step by step guide for various components in android
Stars: ✭ 32 (-80.72%)
Mutual labels:  recyclerview
epg magic carousel
Awesome RecyclerView with custom LayoutManager
Stars: ✭ 98 (-40.96%)
Mutual labels:  recyclerview
Simple-Notes-Kotlin-App
✍️ Simple Note Making App use mvvm architecture , dagger , coroutines and navigation component. Features includes 🗒️ create , edit and ❌ delete notes
Stars: ✭ 40 (-75.9%)
Mutual labels:  recyclerview
TheGreatAdapter
Multiple items adapter made too easy, including headers and footers.
Stars: ✭ 46 (-72.29%)
Mutual labels:  recyclerview
GoogleAutoCompleteWithRecyclerView
An exaple of google Auto Complete Places API with android SDK implemented with RecyclerView
Stars: ✭ 29 (-82.53%)
Mutual labels:  recyclerview
MixAdapter
Compose multiple Adapter for RecyclerView in Android
Stars: ✭ 19 (-88.55%)
Mutual labels:  recyclerview
recyclerfragment
An Android Fragment that displays a set of items in a RecyclerView.
Stars: ✭ 16 (-90.36%)
Mutual labels:  recyclerview
ARVI
Android library designed to simplify the implementation of the video autoplay in the RecyclerView
Stars: ✭ 69 (-58.43%)
Mutual labels:  recyclerview
JADA
JADA - Just Another Dictionary App
Stars: ✭ 20 (-87.95%)
Mutual labels:  recyclerview
MultiChoiceMode-RecyclerView
This repository provides an API for creating a multi choice mode in RecyclerView.
Stars: ✭ 20 (-87.95%)
Mutual labels:  recyclerview
BirthdayReminder
Open source Android application which keeps track of and reminds users of their loved ones birthdays. View on the PlayStore here: https://play.google.com/store/apps/details?id=website.julianrosser.birthdays
Stars: ✭ 29 (-82.53%)
Mutual labels:  recyclerview

Bouncy

Android Arsenal

Add IOS-like overscroll animation to your scrolling views using SpringAnimation.

Currently includes BouncyRecyclerView and BouncyNestedScrollView.

Add Bouncy to your project

Gradle

Add it in your root build.gradle at the end of repositories:

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

In your app module build.gradle, add dependency for recyclerview and bouncy:

   dependencies {
        implementation 'androidx.recyclerview:recyclerview:1.2.1'
        implementation 'com.github.valkriaine:Bouncy:2.3'
   }

BouncyNestedScrollView

NestedScrollView with bouncy overscroll effect, currently only supports vertical scrolling.

Achieved by overriding the default EdgeEffect

Usage:

Use as normal NestedScrollView. Place it in your layout:

<com.factor.bouncy.BouncyNestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:fling_animation_size=".7"
        app:overscroll_animation_size=".7">

    <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            
            ...
            ...
            ...

    </LinearLayout>

</com.factor.bouncy.BouncyNestedScrollView>

fling_animation_size specifies the magnitude of overscroll effect for fling, default is 0.5 if no value is given.

overscroll_animation_size specifies the magnitude of overscroll effect for drag, default is 0.5 if no value is given.

Strongly suggest to keep both values lower than 5.

It is now possible to bind bouncy animation to parent instead of BouncyNestedScrollView

bouncy_scroll_view.setBindSpringToParent(true);

// this will bind the spring animations to parent instead of self

BouncyRecyclerView

BouncyRecyclerView adds overscroll effect to RecyclerView and supports drag & drop and swiping gestures

Usage:

Use as normal RecyclerView. Place it in your layout:

<com.factor.bouncy.BouncyRecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:recyclerview_fling_animation_size=".7"
        app:recyclerview_overscroll_animation_size=".7"
        app:recyclerview_damping_ratio="DAMPING_RATIO_LOW_BOUNCY"
        app:recyclerview_stiffness="STIFFNESS_MEDIUM"
        app:allow_drag_reorder="true"
        app:allow_item_swipe="false"/>

set up layout manager and adapter. Theoratically supports any LayoutManager:

   recycler_view.setAdapter(myAdapter);
   recycler_view.setLayoutManager(new LinearLayoutManager(context));
   //recycler_view.setLayoutManager(new GridLayoutManager(context, 3));

Orientation

When you set the LayoutManager, BouncyRecyclerView will automatically detect the orientation of the layout.

   recycler_view.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));

If the bounce animation is incorrect, you can also manually set the animation orientation:

   recycler_view.setOrientation(LinearLayoutManager.VERTICAL);

Customization

recyclerview_fling_animation_size specifies the magnitude of overscroll effect for fling, default is 0.5 if no value is given

recyclerview_overscroll_animation_size specifies the magnitude of overscroll effect for drag, default is 0.5 if no value is given

allow_drag_reorder and allow_item_swipe are set to false by default. If you would like to enable these features, simply set them to true.

Spring customization

recyclerview_damping_ratio and recyclerview_stiffness please refer to damping ratio and stiffness

Set in code:

   recycler_view.setFlingAnimationSize(0.3f);
   recycler_view.setOverscrollAnimationSize(0.3f);
   recycler_view.setDampingRatio(Bouncy.DAMPING_RATIO_HIGH_BOUNCY);
   recycler_view.setStiffness(Bouncy.STIFFNESS_HIGH);

Drag & drop

Drag & drop does not work out of the box.

For drag & drop or swipe gestures to work, make your adapter extend BouncyRecyclerView.Adapter. (If your adapter does not extend BouncyRecyclerView.Adapter, BouncyRecyclerView will simply disable the gestures)

public class MyAdapter extends BouncyRecyclerView.Adapter
{
    private final ArrayList<MyData> dataSet;

    public MyAdapter(ArrayList<MyData> dataSet)
    {
        this.dataSet = dataSet;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
    {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
    {
        MyViewHolder h = (MyViewHolder) holder;
        h.getTextView().setText(dataSet.get(position).getData());
    }

    @Override
    public int getItemCount()
    {
        return dataSet.size();
    }

    @Override
    public void onItemMoved(int fromPosition, int toPosition)
    {
        //*****must override to save changes 
        //called repeatedly when item is dragged (reordered)
        
        //example of handling reorder
        MyData item = dataSet.remove(fromPosition);
        dataSet.add(toPosition, item);
        notifyItemMoved(fromPosition, toPosition);
    }

    @Override
    public void onItemSwipedToStart(RecyclerView.ViewHolder viewHolder, int position)
    {
        //item swiped left
    }

    @Override
    public void onItemSwipedToEnd(RecyclerView.ViewHolder viewHolder, int position)
    {
        //item swiped right
    }

    @Override
    public void onItemSelected(RecyclerView.ViewHolder viewHolder)
    {
        //item long pressed (selected)
    }

    @Override
    public void onItemReleased(RecyclerView.ViewHolder viewHolder)
    {
        //item released (unselected)
    }
}

Also refer to the Kotlin example

My other projects

Factor Launcher - A Windows Phone inspired launcher with some modern touch

Mutify - Automatically turn on do-not-disturb based on where you are

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