{"id":13615340,"url":"https://github.com/yuyakaido/CardStackView","last_synced_at":"2025-04-13T21:30:42.645Z","repository":{"id":41117538,"uuid":"54301063","full_name":"yuyakaido/CardStackView","owner":"yuyakaido","description":"📱Tinder like swipeable card view for Android","archived":false,"fork":false,"pushed_at":"2024-08-19T10:30:24.000Z","size":39525,"stargazers_count":2403,"open_issues_count":102,"forks_count":460,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-04-11T04:08:45.181Z","etag":null,"topics":["android","layoutmanager","recyclerview","tinder"],"latest_commit_sha":null,"homepage":"","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/yuyakaido.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":"2016-03-20T04:52:33.000Z","updated_at":"2025-04-07T14:30:08.000Z","dependencies_parsed_at":"2023-02-01T03:15:58.526Z","dependency_job_id":"7ccc8a35-c851-462e-8026-6b2c2a3a27e2","html_url":"https://github.com/yuyakaido/CardStackView","commit_stats":{"total_commits":353,"total_committers":11,"mean_commits":32.09090909090909,"dds":0.1954674220963173,"last_synced_commit":"8368daa84eead97fc5e2dc3613fabf47ca46fcac"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyakaido%2FCardStackView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyakaido%2FCardStackView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyakaido%2FCardStackView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyakaido%2FCardStackView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuyakaido","download_url":"https://codeload.github.com/yuyakaido/CardStackView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248785918,"owners_count":21161372,"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","layoutmanager","recyclerview","tinder"],"created_at":"2024-08-01T20:01:12.113Z","updated_at":"2025-04-13T21:30:42.582Z","avatar_url":"https://github.com/yuyakaido.png","language":"Java","readme":"![Logo](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-logo.png)\n\n# CardStackView\n\n![Platform](http://img.shields.io/badge/platform-android-blue.svg?style=flat)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![API](https://img.shields.io/badge/API-14%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=14)\n[![AndroidArsenal](https://img.shields.io/badge/Android%20Arsenal-CardStackView-blue.svg?style=flat)](https://android-arsenal.com/details/1/6075)\n[![CircleCI](https://circleci.com/gh/yuyakaido/CardStackView.svg?style=svg)](https://circleci.com/gh/yuyakaido/CardStackView)\n\n# Overview\n\n![Overview](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-overview.gif)\n\n# Contents\n\n- [Setup](#setup)\n- [Features](#features)\n    - [Manual Swipe](#manual-swipe)\n    - [Automatic Swipe](#automatic-swipe)\n    - [Cancel](#cancel)\n    - [Rewind](#rewind)\n    - [Overlay View](#overlay-view)\n    - [Overlay Interpolator](#overlay-interpolator)\n    - [Paging](#paging)\n    - [Reloading](#reloading)\n    - [Stack From](#stack-from)\n    - [Visible Count](#visible-count)\n    - [Translation Interval](#translation-interval)\n    - [Scale Interval](#scale-interval)\n    - [Swipe Threshold](#swipe-threshold)\n    - [Max Degree](#max-degree)\n    - [Swipe Direction](#swipe-direction)\n    - [Swipe Restriction](#swipe-restriction)\n    - [Swipeable Method](#swipeable-method)\n- [Public Interfaces](#public-interfaces)\n- [Callbacks](#callbacks)\n- [Migration Guide](#migration-guide)\n- [Installation](#installation)\n- [License](#license)\n\n# Setup\n\n```kotlin\nval cardStackView = findViewById\u003cCardStackView\u003e(R.id.card_stack_view)\ncardStackView.layoutManager = CardStackLayoutManager()\ncardStackView.adapter = CardStackAdapter()\n```\n\n# Features\n\n## Manual Swipe\n\n![ManualSwipe](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-manual-swipe.gif)\n\n## Automatic Swipe\n\n![AutomaticSwipe](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-automatic-swipe.gif)\n\n```kotlin\nCardStackView.swipe()\n```\n\nYou can set custom swipe animation.\n\n```kotlin\nval setting = SwipeAnimationSetting.Builder()\n        .setDirection(Direction.Right)\n        .setDuration(Duration.Normal.duration)\n        .setInterpolator(AccelerateInterpolator())\n        .build()\nCardStackLayoutManager.setSwipeAnimationSetting(setting)\nCardStackView.swipe()\n```\n\n## Cancel\n\nManual swipe is canceled when the card is dragged less than threshold.\n\n![Cancel](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-cancel.gif)\n\n## Rewind\n\n![Rewind](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-rewind.gif)\n\n```kotlin\nCardStackView.rewind()\n```\n\nYou can set custom rewind animation.\n\n```kotlin\nval setting = RewindAnimationSetting.Builder()\n        .setDirection(Direction.Bottom)\n        .setDuration(Duration.Normal.duration)\n        .setInterpolator(DecelerateInterpolator())\n        .build()\nCardStackLayoutManager.setRewindAnimationSetting(setting)\nCardStackView.rewind()\n```\n\n## Overlay View\n\n| Value | Sample |\n| :----: | :----: |\n| Left | ![Overlay-Left](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-overlay-left.png) |\n| Right | ![Overlay-Right](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-overlay-right.png) |\n\nPut overlay view in your item layout of RecyclerView.\n\n```xml\n\u003cFrameLayout\n    android:id=\"@+id/left_overlay\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003c!-- Set your left overlay --\u003e\n\n\u003c/FrameLayout\u003e\n```\n\n| Value | Layout ID |\n| :----: | :----: |\n| Left | left_overlay |\n| Right | right_overlay |\n| Top | top_overlay |\n| Bottom | bottom_overlay |\n\n## Overlay Interpolator\n\nYou can set own interpolator to define the rate of change of alpha.\n\n```kotlin\nCardStackLayoutManager.setOverlayInterpolator(LinearInterpolator())\n```\n\n## Paging\n\nYou can implement paging by using following two ways.\n\n1. Use [DiffUtil](https://developer.android.com/reference/android/support/v7/util/DiffUtil).\n2. Call [RecyclerView.Adapter.notifyItemRangeInserted](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter#notifyItemRangeInserted(int,%20int)) manually.\n\n**Caution**\n\nYou should **NOT** call `RecyclerView.Adapter.notifyDataSetChanged` for paging because this method will reset top position and maybe occur a perfomance issue.\n\n## Reloading\n\nYou can implement reloading by calling `RecyclerView.Adapter.notifyDataSetChanged`.\n\n## Stack From\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| ✅ | None | ![StackFrom-None](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-stack-from-none.png) |\n|  | Top | ![StackFrom-Top](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-stack-from-top.png) |\n| | Bottom | ![StackFrom-Bottom](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-stack-from-bottom.png) |\n| | Left | ![StackFrom-Left](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-stack-from-left.png) |\n| | Right | ![StackFrom-Right](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-stack-from-right.png) |\n\n```kotlin\nCardStackLayoutManager.setStackFrom(StackFrom.None)\n```\n\n## Visible Count\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| | 2 | ![VisibleCount-2](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-visible-count-2.png) |\n| ✅ | 3 | ![VisibleCount-3](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-visible-count-3.png) |\n| | 4 | ![VisibleCount-4](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-visible-count-4.png) |\n\n```kotlin\nCardStackLayoutManager.setVisibleCount(3)\n```\n\n## Translation Interval\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| | 4dp | ![TranslationInterval-4dp](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-translation-interval-4dp.png) |\n| ✅ | 8dp | ![TranslationInterval-8dp](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-translation-interval-8dp.png) |\n| | 12dp | ![TranslationInterval-12dp](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-translation-interval-12dp.png) |\n\n```kotlin\nCardStackLayoutManager.setTranslationInterval(8.0f)\n```\n\n## Scale Interval\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| ✅ | 95% | ![ScaleInterval-95%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-scale-interval-95.png) |\n| | 90% | ![ScaleInterval-90%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-scale-interval-90.png) |\n\n```kotlin\nCardStackLayoutManager.setScaleInterval(0.95f)\n```\n\n## Max Degree\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| ✅ | 20° | ![MaxDegree-20](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-max-degree-20.png) |\n| | 0° | ![MaxDegree-0](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-max-degree-0.png) |\n\n```kotlin\nCardStackLayoutManager.setMaxDegree(20.0f)\n```\n\n## Swipe Direction\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| ✅ | Horizontal | ![SwipeDirection-Horizontal](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-direction-horizontal.gif) |\n| | Vertical | ![SwipeDirection-Vertical](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-direction-vertical.gif) |\n| | Freedom | ![SwipeDirection-Freedom](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-direction-freedom.gif) |\n\n```kotlin\nCardStackLayoutManager.setDirections(Direction.HORIZONTAL)\n```\n\n## Swipe Threshold\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| ✅ | 30% | ![SwipeThreshold-30%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-threshold-30.gif) |\n| | 10% | ![SwipeThreshold-10%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-threshold-10.gif) |\n\n```kotlin\nCardStackLayoutManager.setSwipeThreshold(0.3f)\n```\n\n## Swipe Restriction\n\n| CanScrollHorizontal | CanScrollVertical | Sample |\n| :----: | :----: | :----: |\n| true | true | ![SwipeRestriction-NoRestriction](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-restriction-no-restriction.gif) |\n| true | false | ![SwipeRestriction-CanScrollHorizontalOnly](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-restriction-can-scroll-horizontal-only.gif) |\n| false | true | ![SwipeRestriction-CanScrollVerticalOnly](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-restriction-can-scroll-vertical-only.gif) |\n| false | false | ![SwipeRestriction-CannotSwipe](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-restriction-cannot-swipe.gif) |\n\n```kotlin\nCardStackLayoutManager.setCanScrollHorizontal(true)\nCardStackLayoutManager.setCanScrollVertical(true)\n```\n\n## Swipeable Method\n\n| Default | Value | Sample |\n| :----: | :----: | :----: |\n| ✅ | AutomaticAndManual | ![SwipeableMethod-AutomaticAndManual](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipeable-method-automatic-and-manual.gif) |\n| | Automatic | ![SwipwableMethod-Automatic](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipeable-method-automatic.gif) |\n| | Manual | ![SwipwableMethod-Manual](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipeable-method-manual.gif) |\n| | None | ![SwipwableMethod-None](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipeable-method-none.gif) |\n\n```kotlin\nCardStackLayoutManager.setSwipeableMethod(SwipeableMethod.AutomaticAndManual)\n```\n\n# Public Interfaces\n\n## Basic usages\n\n| Method | Description |\n| :---- | :---- |\n| CardStackView.swipe() | You can swipe once by calling this method. |\n| CardStackView.rewind() | You can rewind once by calling this method. |\n| CardStackLayoutManager.getTopPosition() | You can get position displayed on top. |\n| CardStackLayoutManager.setStackFrom(StackFrom stackFrom) | You can set StackFrom. |\n| CardStackLayoutManager.setTranslationInterval(float translationInterval) | You can set TranslationInterval. |\n| CardStackLayoutManager.setScaleInterval(float scaleInterval) | You can set ScaleInterval. |\n| CardStackLayoutManager.setSwipeThreshold(float swipeThreshold) | You can set SwipeThreshold. |\n| CardStackLayoutManager.setMaxDegree(float maxDegree) | You can set MaxDegree. |\n| CardStackLayoutManager.setDirections(List\u003cDirection\u003e directions) | You can set Direction. |\n| CardStackLayoutManager.setCanScrollHorizontal(boolean canScrollHorizontal) | You can set CanScrollHorizontal. |\n| CardStackLayoutManager.setCanScrollVertical(boolean canScrollVertical) | You can set CanScrollVertical. |\n| CardStackLayoutManager.setSwipeAnimationSetting(SwipeAnimationSetting swipeAnimationSetting) | You can set SwipeAnimationSetting. |\n| CardStackLayoutManager.setRewindAnimationSetting(RewindAnimationSetting rewindAnimationSetting) | You can set RewindAnimationSetting. |\n\n## Advanced usages\n\n| Method | Description |\n| :---- | :---- |\n| CardStackView.smoothScrollToPosition(int position) | You can scroll any position with animation. |\n| CardStackView.scrollToPosition(int position) | You can scroll any position without animation. |\n\n# Callbacks\n\n| Method | Description |\n| :---- | :---- |\n| CardStackListener.onCardDragging(Direction direction, float ratio) | This method is called while the card is dragging. |\n| CardStackListener.onCardSwiped(Direction direction) | This method is called when the card is swiped. |\n| CardStackListener.onCardRewound() | This method is called when the card is rewinded. |\n| CardStackListener.onCardCanceled() | This method is called when the card is dragged less than threshold. |\n| CardStackListener.onCardAppeared(View view, int position) | This method is called when the card appeared. |\n| CardStackListener.onCardDisappeared(View view, int position) | This method is called when the card disappeared. |\n\n# Migration Guide\n\n## Migration of Features\n\n| 1.x | 2.x |\n| :---- | :---- |\n| Move to Origin | [Cancel](#cancel) |\n| Reverse | [Rewind](#rewind) |\n| ElevationEnabled | [Stack From](#stack-from) |\n| TranslationDiff | [Translation Interval](#translation-interval) |\n| ScaleDiff | [Scale Interval](#scale-interval) |\n| SwipeEnabled | [Swipe Restriction](#swipe-restriction) |\n\n## Migration of Callbacks\n\n| 1.x | 2.x |\n| :---- | :---- |\n| CardStackView.CardEventListener | CardStackListener |\n| onCardDragging(float percentX, float percentY) | onCardDragging(Direction direction, float ratio) |\n| onCardSwiped(SwipeDirection direction) | onCardSwiped(Direction direction) |\n| onCardReversed() | onCardRewound() |\n| onCardMovedToOrigin() | onCardCanceled() |\n| onCardClicked(int index) | This method is no longer provided. Please implement in your item of RecyclerView. |\n\n# Installation\n\n```groovy\ndependencies {\n    implementation \"com.yuyakaido.android:card-stack-view:2.3.4\"\n}\n```\n\n# License\n\n```\nCopyright 2018 yuyakaido\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuyakaido%2FCardStackView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuyakaido%2FCardStackView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuyakaido%2FCardStackView/lists"}