{"id":13642509,"url":"https://github.com/yuqirong/CardSwipeLayout","last_synced_at":"2025-04-20T16:32:42.899Z","repository":{"id":48167077,"uuid":"83648823","full_name":"yuqirong/CardSwipeLayout","owner":"yuqirong","description":"Use RecyclerView to achieve card swipe layout , like Tantan . (模仿探探卡片滑动效果的布局)","archived":false,"fork":false,"pushed_at":"2020-01-19T07:38:51.000Z","size":10015,"stargazers_count":1256,"open_issues_count":24,"forks_count":187,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-12T16:58:11.191Z","etag":null,"topics":["android","itemtouchhelper","layoutmanager","recyclerview"],"latest_commit_sha":null,"homepage":"","language":"Java","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/yuqirong.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":"2017-03-02T07:35:56.000Z","updated_at":"2025-04-03T07:09:36.000Z","dependencies_parsed_at":"2022-08-12T19:41:00.836Z","dependency_job_id":null,"html_url":"https://github.com/yuqirong/CardSwipeLayout","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuqirong%2FCardSwipeLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuqirong%2FCardSwipeLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuqirong%2FCardSwipeLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuqirong%2FCardSwipeLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuqirong","download_url":"https://codeload.github.com/yuqirong/CardSwipeLayout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249926556,"owners_count":21346583,"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","itemtouchhelper","layoutmanager","recyclerview"],"created_at":"2024-08-02T01:01:32.378Z","updated_at":"2025-04-20T16:32:42.893Z","avatar_url":"https://github.com/yuqirong.png","language":"Java","funding_links":[],"categories":["Card"],"sub_categories":[],"readme":"# CardSwipeLayout\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php)\n\n## Introduction\nCardSwipeLayout - Use RecyclerView to achieve card swipe layout , like [Tantan](http://tantanapp.com/) .\n\n## Screenshot\n\n![screenshot.gif](https://github.com/yuqirong/CardSwipeLayout/blob/master/screenshots/screenshot.gif)\n\n## Blog\n\n[《玩转仿探探卡片式滑动效果》](http://yuqirong.me/2017/03/05/%E7%8E%A9%E8%BD%AC%E4%BB%BF%E6%8E%A2%E6%8E%A2%E5%8D%A1%E7%89%87%E5%BC%8F%E6%BB%91%E5%8A%A8%E6%95%88%E6%9E%9C/)\n\n## Usage\n\n### step 1\n\nFor build.gradle :\n\n\tcompile 'me.yuqirong:cardswipelayout:1.0.0'\n\nOr Maven :\n\n\t\u003cdependency\u003e\n\t  \u003cgroupId\u003eme.yuqirong\u003c/groupId\u003e\n\t  \u003cartifactId\u003ecardswipelayout\u003c/artifactId\u003e\n\t  \u003cversion\u003e1.0.0\u003c/version\u003e\n\t  \u003ctype\u003epom\u003c/type\u003e\n\t\u003c/dependency\u003e\n\n### step 2\n\ninit RecyclerView firstly :\n\n``` java\nRecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);\nrecyclerView.setAdapter(...);\n```\n\n### step 3\n\nthen set `CardLayoutManager` for RecyclerView and `CardItemTouchHelperCallback` for ItemTouchHelper . In addition , don't forget set `OnSwipeListener` for `CardItemTouchHelperCallback` :\n\n``` java\n// dataList means dataSource for adapter\nCardItemTouchHelperCallback cardCallback = new CardItemTouchHelperCallback(recyclerView.getAdapter(), dataList);\nItemTouchHelper touchHelper = new ItemTouchHelper(cardCallback); CardLayoutManager cardLayoutManager = new CardLayoutManager(recyclerView, touchHelper);\nrecyclerView.setLayoutManager(cardLayoutManager);\ntouchHelper.attachToRecyclerView(recyclerView);\ncardCallback.setOnSwipedListener(new OnSwipeListener\u003cT\u003e() {\n\n    @Override\n    public void onSwiping(RecyclerView.ViewHolder viewHolder, float ratio, int direction) {\n        /**\n         * will callback when the card are swiping by user\n         * viewHolder : thee viewHolder of swiping card\n         * ratio : the ratio of swiping , you can add some animation by the ratio\n         * direction : CardConfig.SWIPING_LEFT means swiping from left；CardConfig.SWIPING_RIGHT means swiping from right\n         *             CardConfig.SWIPING_NONE means not left nor right\n         */\n    }\n\n    @Override\n    public void onSwiped(RecyclerView.ViewHolder viewHolder, T t, int direction) {\n\t    /**\n\t     *  will callback when the card swiped from screen by user\n\t     *  you can also clean animation from the itemview of viewHolder in this method\n\t     *  viewHolder : the viewHolder of swiped cards\n\t     *  t : the data of swiped cards from dataList\n\t     *  direction : CardConfig.SWIPED_LEFT means swiped from left；CardConfig.SWIPED_RIGHT means swiped from right\n\t     */\n    }\n\n    @Override\n    public void onSwipedClear() {\n        /**\n         *  will callback when all cards swiped clear\n         *  you can load more data \n         */\n    }\n\n});\n```\n\nFinally , enjoy it !!!\n\nIf you have any questions , you can leave a message in [Issues](https://github.com/yuqirong/CardSwipeLayout/issues).\n\n## Contact Me\n* Email : \u003cyqr271228943@gmail.com\u003e\n* Weibo : [@活得好像一条狗](http://weibo.com/yyyuqirong)\n\n## License\n\n\tMIT License\n\t\n\tCopyright (c) 2017 yuqirong\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in all\n\tcopies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n\tSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuqirong%2FCardSwipeLayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuqirong%2FCardSwipeLayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuqirong%2FCardSwipeLayout/lists"}