{"id":16556313,"url":"https://github.com/asynctaskcoffee/tinderlikecardstack","last_synced_at":"2025-10-28T20:30:30.858Z","repository":{"id":55522046,"uuid":"319157503","full_name":"AsynctaskCoffee/TinderLikeCardStack","owner":"AsynctaskCoffee","description":"Tinder like card swipe library","archived":false,"fork":false,"pushed_at":"2020-12-24T01:34:29.000Z","size":54446,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-05-28T22:23:43.947Z","etag":null,"topics":["cardview","kotlin","kotlin-android","library","opensource","stack","tinder-swiper","tinder-ui"],"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/AsynctaskCoffee.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":"2020-12-06T23:54:48.000Z","updated_at":"2023-03-23T18:01:28.000Z","dependencies_parsed_at":"2022-08-15T02:20:34.598Z","dependency_job_id":null,"html_url":"https://github.com/AsynctaskCoffee/TinderLikeCardStack","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsynctaskCoffee%2FTinderLikeCardStack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsynctaskCoffee%2FTinderLikeCardStack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsynctaskCoffee%2FTinderLikeCardStack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AsynctaskCoffee%2FTinderLikeCardStack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AsynctaskCoffee","download_url":"https://codeload.github.com/AsynctaskCoffee/TinderLikeCardStack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219858902,"owners_count":16556039,"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":["cardview","kotlin","kotlin-android","library","opensource","stack","tinder-swiper","tinder-ui"],"created_at":"2024-10-11T20:04:10.299Z","updated_at":"2025-10-28T20:30:23.626Z","avatar_url":"https://github.com/AsynctaskCoffee.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinderLike Cards ♀️♂️\n\n![Preview](/previews/10.png)\n\n\u003e Stylish animations and designs like Tinder\n\n## Why this project exists\nThis project arose from the idea of turning a small part of freelance project I did a long time ago into a library. With TinderLike Cards library, you can easily have a tinder-style design. Since the project was written in the past, it may have problems. I will continue to improve the library with your help. Please be sure to report any issues you find. I took the structure of listview as an example for myself. You can easily include it in your project with the use of a simple adapter.\n\n## Features\n- [x] Kotlin\n- [x] Stylish Animations\n- [x] Customization\n- [x] CrashSafe\n- [x] Easy Implementation\n- [x] Application Variants\n\n\u003cimg src=\"previews/left_right_button.gif\" width=\"250\"\u003e \u003cimg src=\"previews/draggable_2.gif\" width=\"250\"\u003e  \u003cimg src=\"previews/swipe.gif\" width=\"250\"\u003e\n\n# Let's Start :rocket:\n\n### Define CardContainer in you main.xml\n\nMake sure that container's layout_width and layout_height both are match_parent. I will explain it below. 🍭 \n\n```xml\n\u003ccom.asynctaskcoffee.cardstack.CardContainer\n     android:id=\"@+id/cardContainer\"\n     android:layout_width=\"match_parent\"\n     android:layout_height=\"match_parent\" /\u003e\n```\n\n### Setting CardContainerAdapter with your custom model\n\n```kotlin\nclass MainAdapter(private val list: ArrayList\u003cMainTestModel\u003e, context: Context) :\n    CardContainerAdapter() {\n\n    var layoutInflater: LayoutInflater = LayoutInflater.from(context)\n\n    override fun getItem(position: Int) = list[position]\n\n    @SuppressLint(\"InflateParams\")\n    override fun getView(position: Int): View {\n        val v = layoutInflater.inflate(R.layout.card_view, null)\n        val userImageView = v.findViewById\u003cImageView\u003e(R.id.userImage)\n        val genderImageView = v.findViewById\u003cImageView\u003e(R.id.genderImage)\n        val userName = v.findViewById\u003cTextView\u003e(R.id.userName)\n        val ageAndLastSeen = v.findViewById\u003cTextView\u003e(R.id.ageAndLastSeen)\n\n        val user = getItem(position)\n\n        Picasso.get().load(user.userImage).into(userImageView)\n        genderImageView.setImageResource(user.userGender)\n\n        userName.text = user.userName\n        ageAndLastSeen.text = user.userAgeLastSeen\n\n        return v\n    }\n\n    override fun getCount(): Int = list.size\n}\n```\n\n### Setting Adapter\n\n```kotlin\nlateinit var cardContainer: CardContainer\nlateinit var adapter: MainAdapter\nprivate var modelList = arrayListOf\u003cMainTestModel\u003e()\n\noverride fun onCreate(savedInstanceState: Bundle?) {\n    super.onCreate(savedInstanceState)\n    setContentView(R.layout.activity_main)\n    cardContainer = findViewById(R.id.cardContainer)\n\n    /*Setting Adapter*/\n    modelList.clear()\n    modelList.addAll(MainHelper.getFemaleModels())\n    adapter = MainAdapter(modelList, this)\n    cardContainer.setAdapter(adapter)\n}\n```\n\nAlmost the same as listview, right? Let's continue with customization.\n\n### Before setting the adapter, you can set margin values and the number of visible stacks. The number of cards on the screen will be renewed according to the *maxStackSize*.\n\n```kotlin\n/*Customization*/\ncardContainer.maxStackSize = 3\ncardContainer.marginTop = 13.px\ncardContainer.margin = 20.px\n```\n\n### So why should I define these layouts as extra ❓😿 Because in card dragging operations, parent view cordinates are taken as basis. It is necessary to do this so that the dragged card does not conflict with the parent view.\n\n```kotlin\n/*Adding Extra Layouts*/\ncardContainer.setEmptyView(generateEmptyView())\ncardContainer.addFooterView(generateFooterView())\ncardContainer.addHeaderView(generateHeaderView())\n```\n\n### How to listen cardEvents? Here is CardListener and it's usage :tada:\n\n```kotlin\nfun onLeftSwipe(position: Int, model: Any)\nfun onRightSwipe(position: Int, model: Any)\nfun onItemShow(position: Int, model: Any)\nfun onSwipeCancel(position: Int, model: Any)\nfun onSwipeCompleted()\n```\n\nYou can cast and use models according to the type you define. *Ex (model as MainTestModel)*\n\n```kotlin\nclass MainActivity : AppCompatActivity(), CardListener {\n\n   override fun onCreate(savedInstanceState: Bundle?) {\n        /*Set Card Listeners*/\n        cardContainer.setOnCardActionListener(this)\n   }\n   \n    override fun onLeftSwipe(position: Int, model: Any) {/*card model shifted left*/}\n\n    override fun onRightSwipe(position: Int, model: Any) {/*Card model shifted right*/}\n\n    override fun onItemShow(position: Int, model: Any) {/*Current card model on screen*/}\n\n    override fun onSwipeCancel(position: Int, model: Any) {/*If user canceled dragging*/}\n\n    override fun onSwipeCompleted() {/*No more cards left*/}\n    \n}\n```\n\n\n### What if I have pagination system for models or need to add more cards later ❓😿 Here is the solution :tada:\n\n```kotlin\nmodelList.addAll(MainHelper.getFemaleModels())\nadapter.notifyAppendData()\n```\n⚠️ This function just for appending new datas. Do not use it for change orders or data values. ⚠️\n\n### Can I throw cards left or right programmatically ❓🤔 Hmmm, YES YOU CAN ❗ \n\nYou can call swipeLeft() or swipeRight() methods for it.\n\n```kotlin\nprivate fun setListeners(){\n  cancelView.setOnClickListener {\n      it.pulse() // for sweet animation\n      adapter.swipeLeft()\n  }\n  likeView.setOnClickListener {\n      it.pulse() // for sweet animation\n      adapter.swipeRight()\n  }\n}\n```\n## Implementation Gradle\n\n###### Add it in your root build.gradle at the end of repositories\n\n```groovy\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n```\n\n###### Add the dependency\n\n```groovy\n    dependencies {\n\t     implementation 'com.github.AsynctaskCoffee:tinderlikecardstack:1.0'\n\t}\n```\n\n## Implementation Maven\n\n###### Add the JitPack repository to your build file\n\n```groovy\n    \u003crepositories\u003e\n\t    \u003crepository\u003e\n\t        \u003cid\u003ejitpack.io\u003c/id\u003e\n\t        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n\t    \u003c/repository\u003e\n    \u003c/repositories\u003e\n```\n\n###### Add the dependency\n\n```groovy\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.AsynctaskCoffee\u003c/groupId\u003e\n        \u003cartifactId\u003etinderlikecardstack\u003c/artifactId\u003e\n        \u003cversion\u003e1.0\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\n### Updates\n\n\u003e 24.12.2020 - First release\n\n\n## License\n\n```\n   Copyright 2020 Egemen ÖZOGUL\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasynctaskcoffee%2Ftinderlikecardstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasynctaskcoffee%2Ftinderlikecardstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasynctaskcoffee%2Ftinderlikecardstack/lists"}