{"id":13789477,"url":"https://github.com/iamjosephmj/flinger","last_synced_at":"2025-04-05T17:08:15.850Z","repository":{"id":41206185,"uuid":"369294794","full_name":"iamjosephmj/flinger","owner":"iamjosephmj","description":"Lightweight library to tweak the fling behaviour in Android. This library is only compatible with Jetpack-Compose.","archived":false,"fork":false,"pushed_at":"2025-03-26T19:06:51.000Z","size":24984,"stargazers_count":138,"open_issues_count":10,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T16:09:40.515Z","etag":null,"topics":["android","fling","fling-behaviours","jetpack-compose","ui-components"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamjosephmj.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-20T17:55:57.000Z","updated_at":"2025-03-24T22:40:09.000Z","dependencies_parsed_at":"2024-06-27T03:31:35.058Z","dependency_job_id":"692df273-b436-4221-8982-ea305b3b3756","html_url":"https://github.com/iamjosephmj/flinger","commit_stats":null,"previous_names":["imjoz/flinger","iamjosephmj/flinger"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjosephmj%2Fflinger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjosephmj%2Fflinger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjosephmj%2Fflinger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjosephmj%2Fflinger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamjosephmj","download_url":"https://codeload.github.com/iamjosephmj/flinger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"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","fling","fling-behaviours","jetpack-compose","ui-components"],"created_at":"2024-08-03T22:00:24.298Z","updated_at":"2025-04-05T17:08:15.821Z","avatar_url":"https://github.com/iamjosephmj.png","language":"Kotlin","funding_links":[],"categories":["Index","Kotlin"],"sub_categories":[],"readme":"![Spruce Logo](https://github.com/iamjosephmj/flinger/blob/main/repo-media/flinger.jpeg)\n\n# Flinger (Only compatible with compose)\n\n[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](https://github.com/iamjosephmj/flinger/blob/main/LICENSE)\n[![Public Yes](https://img.shields.io/badge/Public-yes-green.svg?style=flat)]()\n[![](https://jitpack.io/v/iamjosephmj/flinger.svg)](https://jitpack.io/#iamjosephmj/flinger)\n\u003ca href=\"https://jetc.dev/issues/067.html\"\u003e\u003cimg src=\"https://img.shields.io/badge/As_Seen_In-jetc.dev_Newsletter_Issue_%2367-blue?logo=Jetpack+Compose\u0026amp;logoColor=white\" alt=\"As Seen In - jetc.dev Newsletter Issue #67\"\u003e\u003c/a\u003e\n\n\u003ca href = \"https://github.com/iamjosephmj/flinger/stargazers\"\u003e\n     \u003cimg src = \"https://img.shields.io/github/stars/iamjosephmj/flinger\" /\u003e\n\u003c/a\u003e\n\u003ca href = \"https://android-arsenal.com/details/1/8249\"\u003e\n     \u003cimg src = \"https://img.shields.io/badge/Android%20Arsenal-Flinger-green.svg?style=flat\" /\u003e\n\u003c/a\u003e\n\n## What is Flinger?\n\n\u003cp\u003e\n\nFlinger is a plugin that is made on top\nof \u003ca style = \"color: white\" href =\"https://developer.android.com/jetpack/compose\"\u003e`jetpack compose`\u003c/a\u003e\nthat will help the developer to tweak the LazyList's fling behaviour. This Library will help the\ndevelopers to change the fling behaviours much easier without digging deep. Here is a prototype of\nFlinger:\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/iamjosephmj/flinger/blob/main/repo-media/flinger-demo.gif\" \n     width=\"250\" \n     height=\"600\" \n    /\u003e\n\u003c/p\u003e\n\n## Gradle\n\nAdd the following to your project's root build.gradle file\n\n```groovy\nrepositories {\n    maven {\n        url \"https://jitpack.io\"\n    }\n}\n```\n\nAdd the following to your project's build.gradle file\n\n```groovy\ndependencies {\n    implementation 'com.github.iamjosephmj:Flinger:1.3.0'\n}\n```\n\n## Basics\n\n\u003cp\u003e\n\nBy the launch of Jetpack compose at least some of you might have thought if did they port the old\nscroll behaviour to it. The answer to that is YES, they had ported the old\n\u003ca style = \"color: white\" href =\"https://developer.android.com/reference/android/widget/OverScroller\"\u003e`Overscroller`\u003c/a\u003e\nbehaviour to the latest compose. The Overscroller is the component that is responsible for flings in\nScrollView/RecyclerViews in Android. If we dig deeper into the implementation of the Overscroller,\nyou can see that Android uses a fixed set of values so that the flings will look almost similar\nthroughout different devices. The whole idea behind the creation of this library is that the\ndevelopers will have full access to all the internal parameters that governs the fling behaviour.\nThis library can be easily integrated with\nthe \u003ca style = \"color: white\" href =\"https://developer.android.com/jetpack/compose/lists\"\u003e`LazyColumns`\u003c/a\u003e\n,\n\u003ca style = \"color: white\" href =\"https://developer.android.com/jetpack/compose/lists\"\u003e`LazyRows`\u003c/a\u003e\n,\n\u003ca style = \"color: white\" href =\"https://developer.android.com/jetpack/compose/lists\"\u003e`LazyLists`\u003c/a\u003e\nthat is provided by compose.\n\u003c/p\u003e\n\n## Usage\n\nRefer to the Sample project under to get more insights about the implementation.\n\n```kotlin\n\nLazyColumn(\n    flingBehavior = flingBehavior(\n\n        ScrollViewConfiguration.Builder()\n            /*\n             * This variable manages the friction to the scrolls in the LazyColumn\n             */\n            .scrollViewFriction(0.008f)\n\n            /*\n             * This is the absolute value of a velocity threshold, below which the\n             * animation is considered finished.\n             */\n            .absVelocityThreshold(0f)\n\n            /*\n             * Gravitational obstruction to the scroll.\n             */\n            .gravitationalForce(9.80665f)\n\n            /*\n             * Scroll Inches per meter\n             */\n            .inchesPerMeter(39.37f)\n\n            /*\n             * Rate of deceleration of the scrollView.\n             */\n            .decelerationRate((ln(0.78) / ln(0.9)).toFloat())\n\n            /*\n             * Friction at the time of deceleration.\n             */\n            .decelerationFriction(0.09f)\n\n            /*\n             * Inflection is the place where the start and end tension lines cross each other.\n             */\n            .splineInflection(0.1f)\n\n            /*\n             * Spline's start tension.\n             */\n            .splineStartTension(0.1f)\n\n            /*\n             * Spline's end tension.\n             */\n            .splineEndTension(1.0f)\n\n            /*\n             * number of sampling points in the spline\n             */\n            .numberOfSplinePoints(100)\n\n            // builder pattern.\n            .build(),\n    )\n)\n{\n    // Columns/Rows\n}\n\n```\n\n## Stock Behaviours\n\nIf you are not comfortable with tweaking values, we provide you some pre-defined methods that can be\nused to bring the behaviour to your project, you can refer to\n\u003ca style = \"color: white\" href =\"https://github.com/iamjosephmj/flinger/blob/main/flinger/src/main/java/io/iamjosephmj/flinger/bahaviours/StockFlingBehaviours.kt\"\u003e`StockFlingBehaviours.kt`\u003c/a\u003e\n\n## Custom Behaviours\n\nIf you are interested in designing your own behaviours for the Flings, you can tryout different\npossibilities in\nthe \u003ca style = \"color: white\" href =\"https://github.com/iamjosephmj/flinger/tree/develop/apk/\"\u003e`Flinger app`\u003c/a\u003e\n\n## Contribution, Issues or Future Ideas\n\nIf part of Flinger is not working correctly be sure to file a Github issue. In the issue provide as\nmany details as possible. This could include example code or the exact steps that you did so that\neveryone can reproduce the issue. Sample projects are always the best way :). This makes it easy for\nour developers or someone from the open-source community to start working!\n\nIf you have a feature idea submit an issue with a feature request or submit a pull request and we\nwill work with you to merge it in!\n\n## Contribution guidelines\n\nContributions are more than welcome!\n- You should make sure that all the test are working properly.\n- You should raise a PR to `develop` branch\n- Anyone can contribute fling behaviours\nto \u003ca style = \"color: white\" href =\"https://github.com/iamjosephmj/flinger/blob/main/flinger/src/main/java/io/iamjosephmj/flinger/bahaviours/StockFlingBehaviours.kt\"\u003e`StockFlingBehaviours.kt`\u003c/a\u003e\n. \n- Before you raise a PR please make sure your code had no issue from Android studio lint analyzer.  \n\n## Please Share \u0026 Star the repository to keep me motivated.\n  \u003ca href = \"https://github.com/iamjosephmj/flinger/stargazers\"\u003e\n     \u003cimg src = \"https://img.shields.io/github/stars/iamjosephmj/flinger\" /\u003e\n  \u003c/a\u003e\n  \u003ca href = \"https://twitter.com/iamjosephmj\"\u003e\n     \u003cimg src = \"https://img.shields.io/twitter/url?label=follow\u0026style=social\u0026url=https%3A%2F%2Ftwitter.com\" /\u003e\n  \u003c/a\u003e\n\n\u003ca href=\"https://star-history.com/#iamjosephmj/flinger\u0026Timeline\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=iamjosephmj/flinger\u0026type=Timeline\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=iamjosephmj/flinger\u0026type=Timeline\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=iamjosephmj/flinger\u0026type=Timeline\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamjosephmj%2Fflinger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamjosephmj%2Fflinger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamjosephmj%2Fflinger/lists"}