{"id":13428723,"url":"https://github.com/Chrisvin/LiquidSwipe","last_synced_at":"2025-03-16T01:33:32.073Z","repository":{"id":143525519,"uuid":"222264519","full_name":"Chrisvin/LiquidSwipe","owner":"Chrisvin","description":"Android LiquidSwipe Library","archived":false,"fork":false,"pushed_at":"2022-07-19T07:39:31.000Z","size":6440,"stargazers_count":846,"open_issues_count":4,"forks_count":75,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-06T14:22:57.613Z","etag":null,"topics":["android","android-library","library","liquid","liquidswipe","page","pager","swipe","viewpager"],"latest_commit_sha":null,"homepage":null,"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/Chrisvin.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}},"created_at":"2019-11-17T14:55:18.000Z","updated_at":"2025-02-06T03:46:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"74730fd2-640d-4af4-a586-e5b0d07a4e20","html_url":"https://github.com/Chrisvin/LiquidSwipe","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FLiquidSwipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FLiquidSwipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FLiquidSwipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FLiquidSwipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chrisvin","download_url":"https://codeload.github.com/Chrisvin/LiquidSwipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814905,"owners_count":20352037,"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","library","liquid","liquidswipe","page","pager","swipe","viewpager"],"created_at":"2024-07-31T01:01:03.539Z","updated_at":"2025-03-16T01:33:31.364Z","avatar_url":"https://github.com/Chrisvin.png","language":"Kotlin","funding_links":[],"categories":["Kotlin","Libraries"],"sub_categories":[],"readme":"# LiquidSwipe\n Android LiquidSwipe Library\n\n [![License: MIT](https://img.shields.io/badge/License-MIT-silver.svg)](https://opensource.org/licenses/MIT) [![](https://jitpack.io/v/Chrisvin/LiquidSwipe.svg)](https://jitpack.io/#Chrisvin/LiquidSwipe) [![API](https://img.shields.io/badge/API-21%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=21) \n\n| \u003cimg src=\"./demo%20screenshots/LiquidSwipeDemo.gif\"/\u003e | \u003cimg src=\"./demo%20screenshots/LiquidSwipeDemo_Touch_Interactive.gif\"/\u003e |\n| :-: | :-: |\n| [Default](#usage) | [Touch Interactive](#touch-interactive---making-the-liquidswipe-wave-center-y-value-match-the-touch-y-value) |\n\nLiquidSwipe is a viewpager library that can be used to make awesome onboarding designs. ([Default Demo apk](https://github.com/Chrisvin/LiquidSwipe/releases/download/1.1/LiquidSwipeDemo.-.Default.apk)) ([TouchInteractive Demo apk](https://github.com/Chrisvin/LiquidSwipe/releases/download/1.1/LiquidSwipeDemo.-.Touch_Interactive.apk))\n\nIf you like this, you'll like [ConcentricOnboarding](https://github.com/Chrisvin/ConcentricOnboarding) as well.\n\n## Demo app\nTo run the demo project, clone the repository and run it via Android Studio.\n\u003c/br\u003e(OR)\n\u003c/br\u003eDownload the latest demo apk from [releases](https://github.com/Chrisvin/LiquidSwipe/releases).\n\n## Usage\n#### Set up the dependency\n1. Add the JitPack repository to your root build.gradle at the end of repositories:\n```\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n```\n2. Add the LiquidSwipe dependency in the build.gradle:\n```\nimplementation 'com.github.Chrisvin:LiquidSwipe:1.3'\n```\n\n#### Use `LiquidSwipeViewPager` instead of the normal `ViewPager`\n```\n\u003candroidx.constraintlayout.widget.ConstraintLayout \n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003ccom.jem.liquidswipe.LiquidSwipeViewPager\n        android:id=\"@+id/viewpager\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"/\u003e\n\n\u003c/androidx.constraintlayout.widget.ConstraintLayout\u003e\n```\n\n#### Use a `LiquidSwipeLayout` as the base container in the fragment layouts\n```\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003ccom.jem.liquidswipe.layout.LiquidSwipeConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".DummyFragment\"\u003e\n\n    \u003c!--  Fill with your views, just like you would in a normal ConstraintLayout  --\u003e\n\n\u003c/com.jem.liquidswipe.layout.LiquidSwipeConstraintLayout\u003e\n\n\u003c!--  Also supports LiquidSwipeFrameLayout \u0026 LiquidSwipeLinearLayout  --\u003e\n```\nNote : [Dokka generated documentation on LiquidSwipeLayouts](https://chrisvin.github.io/LiquidSwipe/com.jem.liquidswipe.layout/)\n\n### And you're done, easy-peasy. ^_^\n\n## Touch Interactive - Making the LiquidSwipe wave center Y value match the touch Y value\n\nRather than having the wave center Y value always be layout.height/2 , it would be more aesthetically pleasing for it to be the same as the touch Y value. \nThe following code can be used to dynamically change the `waveCenterY` based on the touch position on the `LiquidSwipeViewPager`.\n(The reason this isn't done internally in the library is because the viewpager layouts don't get the touch events when said touch events are consumed directly by the viewpager)\n\n1. In the `Activity`/`Fragment` class containing the `LiquidSwipeViewPager`\n```kotlin\n// Create an array of LiquidSwipeCPP, one for each layout in the PagerAdapter\nval liquidSwipeClipPathProviders = Array(titleArray.count()) {\n    LiquidSwipeClipPathProvider()\n}\n\n// Pass the LiquidSwipeCPP array to the adapter\nviewpager.adapter = CustomPagerAdapter(this, liquidSwipeClipPathProviders)\n// Similar logic can also be applied for your custom FragmentPagerAdapter/FragmentStatePagerAdapter\n\n// Listen to onTouch events on the viewpager and update the waveCenterY value of the LiquidSwipeCPPs\nviewpager.setOnTouchListener { _, event -\u003e\n    val waveCenterY = event.y\n    liquidSwipeClipPathProviders.map {\n        it.waveCenterY = waveCenterY\n    }\n    false\n}\n```\n2. In the `PagerAdapter`\n```kotlin\n// Set the layout's clipPathProvider to the corresponding `LiquidSwipeClipPathProvider`\n(layout as? LiquidSwipeLayout)?.clipPathProvider = liquidSwipeClipPathProviders[position]\n```\n\nThe above code has been showcased in the demo app, feel free to look at it for reference.\n\n**Note**: \nThis is not a perfect solution, in fact some artifacts might occur due to the quick waveCenterY value jumps. \nBut for now, this is the cleanest solution I can think of.\nAnyone else with a better solution is welcome to fork and submit a pull request. :)\n\n\u003cimg src=\"./demo%20screenshots/LiquidSwipeDemo_Touch_Interactive.gif\"/\u003e\n\n## Creating custom swipe animations\n\nThe concept for the `ClipPathProvider` in LiquidSwipe is the same as that in the [EasyReveal library](https://github.com/Chrisvin/EasyReveal) (If you haven't already, then you should really check it out, infact the first version of LiquidSwipe used [EasyReveal](https://github.com/Chrisvin/EasyReveal) as a dependency).\n\nYou can create your own swipe animation by extending the [ClipPathProvider](https://github.com/Chrisvin/LiquidSwipe/blob/master/liquidswipe/src/main/java/com/jem/liquidswipe/base/ClipPathProvider.kt) and implementing the `getPath()` method. `getPath()` provides the [Path](https://developer.android.com/reference/android/graphics/Path) for a given *percent* value on the provided *view*.  The path gotten from `getPath()` is then used to clip the view using `canvas.clipPath(path, op)` (The `op` value is provided by the `ClipPathProvider` as well). You can then set your custom [ClipPathProvider](https://github.com/Chrisvin/LiquidSwipe/blob/master/liquidswipe/src/main/java/com/jem/liquidswipe/base/ClipPathProvider.kt) to your layouts.\n\n## API Documentation\n\nDocumentation generated using Dokka : [chrisvin.github.io/LiquidSwipe](https://chrisvin.github.io/LiquidSwipe/)\n\n## Bugs and Feedback\nFor bugs, questions and discussions please use the [Github Issues](https://github.com/Chrisvin/LiquidSwipe/issues).\n\n## Credits\n1. [Cuberto's liquid-swipe for iOS](https://github.com/Cuberto/liquid-swipe) - Source of inspiration\n2. [Alvaro Fabre](https://lottiefiles.com/tomfabre) - Designer of the lottie animations in the demo app\n\n## License\n```\nMIT License\n\nCopyright (c) 2019 Jem\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChrisvin%2FLiquidSwipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChrisvin%2FLiquidSwipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChrisvin%2FLiquidSwipe/lists"}