{"id":13902394,"url":"https://github.com/valkriaine/Bouncy","last_synced_at":"2025-07-18T00:31:36.656Z","repository":{"id":38270174,"uuid":"329124022","full_name":"valkriaine/Bouncy","owner":"valkriaine","description":"RecyclerView and NestedScrollView with physics-based bouncy overscroll effect","archived":false,"fork":false,"pushed_at":"2022-08-08T20:19:54.000Z","size":49114,"stargazers_count":194,"open_issues_count":6,"forks_count":18,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-27T09:34:50.440Z","etag":null,"topics":["android","android-library","dynamic-animation","edge-effects","factor-launcher","nestedscrollview","overscroll","recyclerview","spring-animation"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valkriaine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-12T22:03:01.000Z","updated_at":"2024-07-05T08:13:34.000Z","dependencies_parsed_at":"2022-08-09T02:16:23.605Z","dependency_job_id":null,"html_url":"https://github.com/valkriaine/Bouncy","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valkriaine%2FBouncy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valkriaine%2FBouncy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valkriaine%2FBouncy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valkriaine%2FBouncy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valkriaine","download_url":"https://codeload.github.com/valkriaine/Bouncy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":214260239,"owners_count":15707066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","dynamic-animation","edge-effects","factor-launcher","nestedscrollview","overscroll","recyclerview","spring-animation"],"created_at":"2024-08-06T22:01:07.991Z","updated_at":"2024-08-06T22:03:19.574Z","avatar_url":"https://github.com/valkriaine.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Bouncy \n\n[![](https://jitpack.io/v/valkriaine/Bouncy.svg)](https://jitpack.io/#valkriaine/Bouncy)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Bouncy-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/8218)\n\nAdd IOS-like overscroll animation to your scrolling views using [SpringAnimation](https://developer.android.com/guide/topics/graphics/spring-animation). \n\nCurrently includes BouncyRecyclerView and BouncyNestedScrollView.\n\n# Add Bouncy to your project\n\n ### Gradle\n \n Add it in your root build.gradle at the end of repositories:\n \n  ```\n allprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n ```\n  \n In your app module build.gradle, add dependency for `recyclerview` and `bouncy`:\n```\n   dependencies {\n        implementation 'androidx.recyclerview:recyclerview:1.2.1'\n        implementation 'com.github.valkriaine:Bouncy:2.3'\n   }\n ```\n \n# BouncyNestedScrollView\n\nNestedScrollView with bouncy overscroll effect, currently only supports vertical scrolling. \n\nAchieved by overriding the default EdgeEffect\n\n\u003cimg src=\"./images/BouncyNestedScrollViewDemo.gif\"/\u003e \u003cimg src=\"./images/FactorLauncherSettingsScreen.gif\"/\u003e\n\n## Usage:\n\nUse as normal NestedScrollView. Place it in your layout:\n\n```xml\n\u003ccom.factor.bouncy.BouncyNestedScrollView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:fling_animation_size=\".7\"\n        app:overscroll_animation_size=\".7\"\u003e\n\n    \u003cLinearLayout\n            android:orientation=\"vertical\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\u003e\n            \n            ...\n            ...\n            ...\n\n    \u003c/LinearLayout\u003e\n\n\u003c/com.factor.bouncy.BouncyNestedScrollView\u003e\n```\n\n```fling_animation_size``` specifies the magnitude of overscroll effect for fling, default is 0.5 if no value is given. \n\n```overscroll_animation_size``` specifies the magnitude of overscroll effect for drag, default is 0.5 if no value is given. \n\nStrongly suggest to keep both values lower than 5.\n\n### It is now possible to bind bouncy animation to parent instead of BouncyNestedScrollView\n\n```java\nbouncy_scroll_view.setBindSpringToParent(true);\n\n// this will bind the spring animations to parent instead of self\n\n```\n\n# BouncyRecyclerView\n\nBouncyRecyclerView adds overscroll effect to RecyclerView and supports drag \u0026 drop and swiping gestures\n\n\u003cimg src=\"./images/BouncyRecyclerViewDemo.gif\"/\u003e \u003cimg src=\"./images/reorder_and_swipe.gif\"/\u003e\n\n## Usage:\n\nUse as normal RecyclerView. Place it in your layout:\n\n```xml\n\u003ccom.factor.bouncy.BouncyRecyclerView\n        android:id=\"@+id/recycler_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:recyclerview_fling_animation_size=\".7\"\n        app:recyclerview_overscroll_animation_size=\".7\"\n        app:recyclerview_damping_ratio=\"DAMPING_RATIO_LOW_BOUNCY\"\n        app:recyclerview_stiffness=\"STIFFNESS_MEDIUM\"\n        app:allow_drag_reorder=\"true\"\n        app:allow_item_swipe=\"false\"/\u003e\n```\n\nset up layout manager and adapter. Theoratically supports any LayoutManager: \n```java\n   recycler_view.setAdapter(myAdapter);\n   recycler_view.setLayoutManager(new LinearLayoutManager(context));\n   //recycler_view.setLayoutManager(new GridLayoutManager(context, 3));\n```\n\n## Orientation \n\n\u003cimg src=\"./images/BouncyRecyclerView_Horizontal.gif\"/\u003e \n\nWhen you set the LayoutManager, ```BouncyRecyclerView``` will automatically detect the orientation of the layout. \n\n```java\n   recycler_view.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));\n```\n\nIf the bounce animation is incorrect, you can also manually set the animation orientation:\n\n```java\n   recycler_view.setOrientation(LinearLayoutManager.VERTICAL);\n```\n\n## Customization\n\n```recyclerview_fling_animation_size``` specifies the magnitude of overscroll effect for fling, default is 0.5 if no value is given\n\n```recyclerview_overscroll_animation_size``` specifies the magnitude of overscroll effect for drag, default is 0.5 if no value is given\n\n```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.\n\n### Spring customization\n\n```recyclerview_damping_ratio``` and ```recyclerview_stiffness``` please refer to [damping ratio](https://developer.android.com/guide/topics/graphics/spring-animation#damping-ratio) and [stiffness](https://developer.android.com/guide/topics/graphics/spring-animation#stiffness)\n\nSet in code:\n\n```java\n   recycler_view.setFlingAnimationSize(0.3f);\n   recycler_view.setOverscrollAnimationSize(0.3f);\n   recycler_view.setDampingRatio(Bouncy.DAMPING_RATIO_HIGH_BOUNCY);\n   recycler_view.setStiffness(Bouncy.STIFFNESS_HIGH);\n```\n\n\n## Drag \u0026 drop \n\nDrag \u0026 drop does not work out of the box. \n\nFor drag \u0026 drop or swipe gestures to work, make your adapter extend ```BouncyRecyclerView.Adapter```.\n(If your adapter does not extend BouncyRecyclerView.Adapter, BouncyRecyclerView will simply disable the gestures)\n\n```java\npublic class MyAdapter extends BouncyRecyclerView.Adapter\n{\n    private final ArrayList\u003cMyData\u003e dataSet;\n\n    public MyAdapter(ArrayList\u003cMyData\u003e dataSet)\n    {\n        this.dataSet = dataSet;\n    }\n\n    @Override\n    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)\n    {\n        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);\n        return new MyViewHolder(view);\n    }\n\n    @Override\n    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)\n    {\n        MyViewHolder h = (MyViewHolder) holder;\n        h.getTextView().setText(dataSet.get(position).getData());\n    }\n\n    @Override\n    public int getItemCount()\n    {\n        return dataSet.size();\n    }\n\n    @Override\n    public void onItemMoved(int fromPosition, int toPosition)\n    {\n        //*****must override to save changes \n        //called repeatedly when item is dragged (reordered)\n        \n        //example of handling reorder\n        MyData item = dataSet.remove(fromPosition);\n        dataSet.add(toPosition, item);\n        notifyItemMoved(fromPosition, toPosition);\n    }\n\n    @Override\n    public void onItemSwipedToStart(RecyclerView.ViewHolder viewHolder, int position)\n    {\n        //item swiped left\n    }\n\n    @Override\n    public void onItemSwipedToEnd(RecyclerView.ViewHolder viewHolder, int position)\n    {\n        //item swiped right\n    }\n\n    @Override\n    public void onItemSelected(RecyclerView.ViewHolder viewHolder)\n    {\n        //item long pressed (selected)\n    }\n\n    @Override\n    public void onItemReleased(RecyclerView.ViewHolder viewHolder)\n    {\n        //item released (unselected)\n    }\n}\n```\nAlso refer to the [Kotlin example](https://github.com/Valkriaine/Bouncy/blob/master/example/src/main/java/com/factor/example/MyAdapter.kt)\n\n# My other projects\n\n[Factor Launcher](https://github.com/Valkriaine/Factor_Launcher_Reboot) - A Windows Phone inspired launcher with some modern touch\n\n[Mutify](https://github.com/Valkriaine/Mutify) - Automatically turn on do-not-disturb based on where you are\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalkriaine%2FBouncy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalkriaine%2FBouncy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalkriaine%2FBouncy/lists"}