Rebound

Add IOS-style scrolling animation to your scrolling views with SpringAnimation.

Currently includes BouncyRecyclerView and BouncyNestedScrollView.

In your build.gradle application module :

Dependencies { implementation
androidx.recyclingerview:recyclingerview:1.1.0
implementation com.factor:bouncy:1.61
}

(BouncyRecyclerView requires androidx.recyclerview).

NestedScrollView with a bouncing scroll effect, currently only supports vertical scrolling.

Obtained by canceling the standard side effect.

NestedScrollView and RecyclerView with physics-based bouncy overscroll effect

Usage:

Use as a normal NestedScrollView. Put it in the layout:

 

 



 

 

fling_animation_size defines the size of the fling effect for the fling, the default is 0.5 if no value is specified.

overscroll_animation_size sets the value of the overscroll effect for dragging, the default is 0.5 if not specified.

It is strongly recommended to keep these two values below 5.

BouncyRecyclerView adds a scrolling effect to the RecyclerView and supports drag-and-drop gestures.

 

Usage:

Use as a normal RecyclerView. Put it in the layout:

 

install the layout manager and the adapter. Theoretically, any LayoutManager is supported:

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

Setting

The fling_fling_animation_size parameter determines the size of the fling effect for the fling, the default is 0.5 if no value is specified.

The default value is 0.5 if not set.

allow_drag_reorder and allow_item_swipe are set to false by default. If you want to activate these functions, you only need to set them.

Spring adjustment (kickback 1.6 and above)

view_damping_coefficient and view_statistics of the recycling company, note the damping and stiffness data

Enter the code:

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

A known problem is that when setting spring properties, elements at the edges of the screen may be cut off, because the current implementation animates the Y-offset of the entire image of recyclable materials. One solution is to put a BouncyRecyclerView inside a NestedScrollView (not necessarily a BouncyNestedScrollView) :

 

 

Drag and drop

Shooting and posing doesn’t work from the start.

To make the drag and drop or drag-and-drop gestures work, expand your adapter with BouncyRecyclerView.Adapter and add a constructor that matches the parent.
(If your adapter is not distributed by BouncyRecyclerView.Adapter, BouncyRecyclerView simply disables gestures).

The public class MyAdapter extends the BouncyRecyclerView.Adapter
{
private final ArrayList dataSet ;

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

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

@ address
public void opBindViewHolder(RecyclerView.ViewHolder, 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 be overwritten to save changes
///repeated call when dragging an item (reordering)

// Example of processing reorganization
MyData item = dataSet.remove(fromPosition);
dataSet.add(toPosition, item);
notifyItemMoved(fromPosition, toPosition);
}.

@Check public empty
onItemSwipedToStart(RecyclerView.ViewHolder viewHolder, int position)
{
/Moved item to left
}

@Check public empty
onItemSwipedToEnd(RecyclerView.ViewHolder viewHolder, int position)
{
/Moved item to the right
}

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

@General empty
onItemReleased(RecyclerView.ViewHolder viewHolder)
{
//element released (not selected)
}
}

See also the example of Kotlin

GitHub

android overscroll effectandroid recyclerview overscroll bounceandroid overscroll animationoverscroll-behavior androidelastic scrolling androidandroid:overscrollmoderecyclerview overscroll listenerandroid-scrollview bounce effect

You May Also Like

How To Fix Thumbnails Not Showing In Windows 10

The Windows thumbnail function makes it easy to recognize photos and movies…

A Complete Guide On Resolving The Issue of Phone Overheating

The phone can sometimes even get hot, whether it’s during a game…

How To Fix Windows 10 File Explorer Dark Theme Not Working

When it comes to customisation options, Windows 10 offers users a considerable…

Apex Legends Crashing PC Fix 2020

Various problems can occur during gambling. If you’re playing the new royal…