{"id":20556862,"url":"https://github.com/luckybilly/smartswipe","last_synced_at":"2025-04-08T10:33:08.201Z","repository":{"id":62633775,"uuid":"196566030","full_name":"luckybilly/SmartSwipe","owner":"luckybilly","description":"An android library to make swipe more easier and more powerful. Android各种侧滑，有这一个就够了","archived":false,"fork":false,"pushed_at":"2020-01-04T05:40:54.000Z","size":18486,"stargazers_count":2064,"open_issues_count":33,"forks_count":261,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-04-01T09:26:54.300Z","etag":null,"topics":["cover","customer-view","door","drawer","refreshlayout","shutters","slidingmenu","swipe","swipeback","swipebacklayout"],"latest_commit_sha":null,"homepage":"https://juejin.im/post/5d3fdc3af265da03c02bdbde","language":"Java","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/luckybilly.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":"2019-07-12T11:15:16.000Z","updated_at":"2025-03-31T10:05:47.000Z","dependencies_parsed_at":"2022-11-04T10:00:43.889Z","dependency_job_id":null,"html_url":"https://github.com/luckybilly/SmartSwipe","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckybilly%2FSmartSwipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckybilly%2FSmartSwipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckybilly%2FSmartSwipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckybilly%2FSmartSwipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luckybilly","download_url":"https://codeload.github.com/luckybilly/SmartSwipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247823988,"owners_count":21002183,"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":["cover","customer-view","door","drawer","refreshlayout","shutters","slidingmenu","swipe","swipeback","swipebacklayout"],"created_at":"2024-11-16T03:33:01.483Z","updated_at":"2025-04-08T10:33:08.169Z","avatar_url":"https://github.com/luckybilly.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SmartSwipe\n\n![](https://img.shields.io/badge/license-Apache--2.0-blue.svg)\n![](https://img.shields.io/badge/minSDK-14+-orange.svg)\n![](https://img.shields.io/badge/aarSize-100KB-blue.svg)\n\n\nlibrary|smart-swipe|smart-swipe-support|smart-swipe-x\n:---:|:---:|:---:|:---:\nlatest version| [![Download](https://api.bintray.com/packages/hellobilly/android/smart-swipe/images/download.svg)](https://bintray.com/hellobilly/android/smart-swipe/_latestVersion)| [![Download](https://api.bintray.com/packages/hellobilly/android/smart-swipe-x/images/download.svg)](https://bintray.com/hellobilly/android/smart-swipe-x/_latestVersion)| [![Download](https://api.bintray.com/packages/hellobilly/android/smart-swipe-support/images/download.svg)](https://bintray.com/hellobilly/android/smart-swipe-support/_latestVersion)\n\n\n\n[中文文档，更详尽](https://luckybilly.github.io/SmartSwipe-tutorial/)\n\nA smart swipe android library helps you make View (and Activity) swipes easier.\n\nIn addition, to facilitate the use, `SmartSwipe` encapsulates the following tool classes:\n\n- [SmartSwipeBack][SmartSwipeBack]: \u003cbr/\u003eAll Activities slide back in an easy way via a single line code. \u003cbr/\u003ewithout any super activity class; without translucent theme; without any code into BaseActivity; without any code into xml layout files;\n- [SmartSwipeRefresh][SmartSwipeRefresh]: \u003cbr/\u003eWith a single line code to achieve swipe refresh and load more. Compatible with vertical and horizontal\n- [SwipeConsumerExclusiveGroup][SwipeConsumerExclusiveGroup]: \u003cbr/\u003eManages a set of exclusive `SwipeConsumer`s, can only open one at a time.\n\n\n## Demo\n\n[download demo.apk](https://github.com/luckybilly/SmartSwipe/raw/master/app-release.apk)\n\nStretch\u003cbr/\u003e[StretchConsumer][StretchConsumer]|Space\u003cbr/\u003e[SpaceConsumer][SpaceConsumer]|Translucent Sliding\u003cbr/\u003e[TranslucentSlidingConsumer][TranslucentSlidingConsumer]\n:---:|:---:|:---:\n\u003cimg width=\"200\" src=\"images/stretchConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/spaceConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/translucentSlidingConsumer.gif\"\u003e\nDrawer above\u003cbr/\u003e[DrawerConsumer][DrawerConsumer]|Drawer behind\u003cbr/\u003e(factor is settable)\u003cbr/\u003e[SlidingConsumer][SlidingConsumer]|\n\u003cimg width=\"200\" src=\"images/drawerConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/slidingConsumer.gif\"\u003e|\nDoors Open\u003cbr/\u003e[DoorConsumer][DoorConsumer]|Shutters Open\u003cbr/\u003e[ShuttersConsumer][ShuttersConsumer]|\n\u003cimg width=\"200\" src=\"images/doorConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/shuttersConsumer.gif\"\u003e|\n\n#### Create a cover\n\nDoors open|Shutters Open|Drawer Open\n:---:|:---:|:---:\n\u003cimg width=\"200\" src=\"images/cover_door.gif\"\u003e|\u003cimg width=\"200\" src=\"images/cover_shutters.gif\"\u003e|\u003cimg width=\"200\" src=\"images/cover_drawer.gif\"\u003e\n\n\n#### Activity sliding back\n\nAll Activities slide back in an easy way via a single line code. \n\n- without any super activity class;\n- without translucent theme; \n- without any code into BaseActivity; \n- without any code into xml layout files;\n\nBack via release velocity\u003cbr/\u003e[StayConsumer][StayConsumer]|Translucent Sliding Back\u003cbr/\u003e[ActivitySlidingBackConsumer][ActivitySlidingBackConsumer]|Back with bezier\u003cbr/\u003e[BezierBackConsumer][BezierBackConsumer]\n:---:|:---:|:---:\n\u003cimg width=\"200\" src=\"images/stayConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/activitySlidingBackConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/bezierBackConsumer.gif\"\u003e\nLike doors open\u003cbr/\u003e[ActivityDoorBackConsumer][ActivityDoorBackConsumer]|Like shutters open\u003cbr/\u003e[ActivityShuttersBackConsumer][ActivityShuttersBackConsumer]|\u003cfont color=\"blue\"\u003eGlobal Usage\u003c/font\u003e\u003cbr/\u003e[SmartSwipeBack][SmartSwipeBack]\n\u003cimg width=\"200\" src=\"images/activityDoorBackConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/activityShuttersBackConsumer.gif\"\u003e|\u003cimg width=\"200\" src=\"images/swipeBack.gif\"\u003e\n\n\n## Usage\n\nFirst add `SmartSwipe` to your project\n\n```groovy\nimplementation 'com.billy.android:smart-swipe:latestVersion'\n```\n\nNested scrolling only compatible after android api above 21(android 5.0) with core library(smart-swipe)\n\nAdd extension library to compat for android support library or androidX like below:\n\n```groovy\nimplementation 'com.billy.android:smart-swipe:latestVersion'\n//compat for android support library\nimplementation 'com.billy.android:smart-swipe-support:latestVersion'\n```\n\nor\n\n```groovy\nimplementation 'com.billy.android:smart-swipe:latestVersion'\n//compat for android x\nimplementation 'com.billy.android:smart-swipe-x:latestVersion'\n```\n\n`SmartSwipe` can be used by chain programming within a single line code. The usage of API looks like follow:\n\n```java\nSmartSwipe.wrap(...) \t\t//view or Activity\n\t.addConsumer(...) \t\t//add a SwipeConsumer\n\t.enableDirection(...) \t//Specifies which side of the slide the SwipeConsumer will consumes\n\t.setXxx(...) \t\t\t//[optional] some other Settings\n\t.addListener(...); \t\t//[optional] add listener(s) to the SwipeConsumer\n```\n#### Sample code：\n\n```java\n//\tWhen view cannot scroll vertically (or scrolling to the top/bottom), \n//\tif continue to drag, the UI will show elastic stretching effect, \n//\tand smooth recovery after release\nSmartSwipe.wrap(view)\n\t.addConsumer(new StretchConsumer())\n\t.enableVertical();\n```\n\n#### Add more than one 'SwipeConsumer' to the same View. Such as:\n\n```java\nSmartSwipe.wrap(view)\n\t.addConsumer(new StretchConsumer())\n\t.enableVertical() \t\t\t\t\t//Stretch effect at directions: top and bottom\n\t.addConsumer(new SpaceConsumer())\n\t.enableHorizontal() \t\t\t\t//Space effect at directions: left and right\n\t;\n```\n\n[Click here][SwipeConsumer] for more details about `SwipeConsumers`\n\n#### Activity slides back with a single line of code globally\n\n```java\nSmartSwipeBack.activityBezierBack(application, null);\t//bezier shows while swiping\nSmartSwipeBack.activityStayBack(application, null);\t\t//Back via release velocity\nSmartSwipeBack.activitySlidingBack(application, null);\t//sliding with pre-activity relative moves\nSmartSwipeBack.activityDoorBack(application, null);\t\t//finish activity like doors open\nSmartSwipeBack.activityShuttersBack(application, null);\t//finish activity like shutters open\n```\n[Click here][SmartSwipeBack] For more Details\n\n### Add swipe refresh to a View via a single line code\n\n```java\n//the second parameter within xxxMode:\n// false: works vertically(swipe down to refresh and swipe up to load more)\n// true: works horizontally(swipe right to refresh and swipe right to load more) \nSmartSwipeRefresh.drawerMode(view, false).setDataLoader(loader);\nSmartSwipeRefresh.behindMode(view, false).setDataLoader(loader);\nSmartSwipeRefresh.scaleMode(view, false).setDataLoader(loader);\nSmartSwipeRefresh.translateMode(view, false).setDataLoader(loader);\n```\n\nYou can use default headers and footers, and you can also customize your own. \n\nThe refresh extension library(`smart-swipe-refresh-ext`: [![Download](https://api.bintray.com/packages/hellobilly/android/smart-swipe-refresh-ext/images/download.svg)](https://bintray.com/hellobilly/android/smart-swipe-refresh-ext/_latestVersion)) will include some fancy third-party headers and footers.\n\nhere is the first one(Based on [Ifxcyr/ArrowDrawable](https://github.com/Ifxcyr/ArrowDrawable)):\n\n![refresh arrow](images/refresh_arrow.gif)\n\n[Click here][SmartSwipeRefresh] For more Details\n\n## `SmartSwipe` features：\n\n- support for 4 directions swipe( left/top/right/bottom)\n- supports adding multiple `SwipeConsumer`s to the same View(/Activity)\n- supports nested usage\n- support to use for list items in ListView and RecyclerView and the list itself\n- compat for NestedScroll (android support library and androidX)\n- A dozen of built-in `SwipeConsumer`s effects\n\n\n\n## Thanks\n\n- [Simon-Leeeeeeeee/SLWidget](https://github.com/Simon-Leeeeeeeee/SLWidget/blob/master/swipeback/src/main/java/cn/simonlee/widget/swipeback/SwipeBackHelper.java)\n- [ikew0ng/SwipeBackLayout](https://github.com/ikew0ng/SwipeBackLayout)\n- [Blankj/SwipePanel](https://github.com/Blankj/SwipePanel)\n- [qinci/AndroidSlideBack](https://github.com/qinci/AndroidSlideBack)\n- [scwang90/SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout)\n- https://www.thiswaifudoesnotexist.net/\n- https://www.iconfont.cn/\n- https://m.sc.enterdesk.com/sucai/477026.html\n- [AnliaLee/FallingView](https://github.com/AnliaLee/FallingView)\n- [jd-alexander/LikeButton](https://github.com/jd-alexander/LikeButton)\n- [Ifxcyr/ArrowDrawable](https://github.com/Ifxcyr/ArrowDrawable)\n\n\n\n\n\n\n\n\n\n\n[ViewDragHelper]: https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/customview/src/main/java/androidx/customview/widget/ViewDragHelper.java\n[SwipeConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/SwipeConsumer.html\n[SmartSwipeBack]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/SmartSwipeBack.html\n[SmartSwipeRefresh]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/SmartSwipeRefresh.html\n[SwipeConsumerExclusiveGroup]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/SwipeConsumerExclusiveGroup.html\n\n[ActivityDoorBackConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/ActivityDoorBackConsumer.html\n[ActivityShuttersBackConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/ActivityShuttersBackConsumer.html\n[ActivitySlidingBackConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/ActivitySlidingBackConsumer.html\n[BezierBackConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/BezierBackConsumer.html\n[DoorConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/DoorConsumer.html\n[DrawerConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/DrawerConsumer.html\n[ShuttersConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/ShuttersConsumer.html\n[SlidingConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/SlidingConsumer.html\n[SpaceConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/SpaceConsumer.html\n[StayConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/StayConsumer.html\n[StretchConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/StretchConsumer.html\n[TranslucentSlidingConsumer]: https://luckybilly.github.io/SmartSwipe-tutorial/pages/consumers/TranslucentSlidingConsumer.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckybilly%2Fsmartswipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluckybilly%2Fsmartswipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckybilly%2Fsmartswipe/lists"}