All Projects → yuyakaido → Cardstackview

yuyakaido / Cardstackview

Licence: apache-2.0
📱Tinder like swipeable card view for Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cardstackview

Stackcardlayoutmanager
Stars: ✭ 376 (-79.68%)
Mutual labels:  layoutmanager, recyclerview
Swipeablecards
Stars: ✭ 136 (-92.65%)
Mutual labels:  recyclerview, tinder
Spannedgridlayoutmanager
Android RecyclerView.LayoutManager that resizes and reorders views based on SpanSize
Stars: ✭ 492 (-73.41%)
Mutual labels:  layoutmanager, recyclerview
Chipslayoutmanager
ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features
Stars: ✭ 3,138 (+69.62%)
Mutual labels:  layoutmanager, recyclerview
Turn Layout Manager
A carousel layout manager for RecyclerView
Stars: ✭ 946 (-48.86%)
Mutual labels:  layoutmanager, recyclerview
Horizontalpicker
A simple, customizable and easy to use picker where centre view is scaled up
Stars: ✭ 337 (-81.78%)
Mutual labels:  layoutmanager, recyclerview
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+199.08%)
Mutual labels:  layoutmanager, recyclerview
InfiniteScrollRecyclerView
Enables the RecyclerView to Auto scroll for indefinite time.
Stars: ✭ 49 (-97.35%)
Mutual labels:  recyclerview, layoutmanager
Focuslayoutmanager
有焦点item的水平/垂直滚动RecyclerView-LayoutManager。仿Android豆瓣书影音“推荐“频道列表布局
Stars: ✭ 772 (-58.27%)
Mutual labels:  layoutmanager, recyclerview
Timetablelayout
TimetableLayout is a RecyclerView.LayoutManager to display the timetable for Android.
Stars: ✭ 726 (-60.76%)
Mutual labels:  layoutmanager, recyclerview
Carouselrecyclerview
Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.
Stars: ✭ 107 (-94.22%)
Mutual labels:  layoutmanager, recyclerview
Reel Search Android
Reel Search for Android is a UI/UX design for autocomplete action. It is a beautiful minimalistic addition to any use case.
Stars: ✭ 110 (-94.05%)
Mutual labels:  layoutmanager, recyclerview
SpannedGridLayoutManager
Android RecyclerView.LayoutManager that resizes and reorders views based on SpanSize
Stars: ✭ 522 (-71.78%)
Mutual labels:  recyclerview, layoutmanager
Stacklayoutmanager
customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
Stars: ✭ 343 (-81.46%)
Mutual labels:  layoutmanager, recyclerview
SlideView
🔖 Card RecycleViewManager, to make your interface cool.Use recyclerView to add cool effects to the view.
Stars: ✭ 16 (-99.14%)
Mutual labels:  recyclerview, layoutmanager
Awesome Recyclerview Layoutmanager
RecyclerView-LayoutManager Resources
Stars: ✭ 581 (-68.59%)
Mutual labels:  layoutmanager, recyclerview
CardLayoutManager
A custom layoutManager providing a Tinder-like cards effect.
Stars: ✭ 37 (-98%)
Mutual labels:  recyclerview, layoutmanager
epg magic carousel
Awesome RecyclerView with custom LayoutManager
Stars: ✭ 98 (-94.7%)
Mutual labels:  recyclerview, layoutmanager
Gallerylayoutmanager
New way to implements ViewPager/Gallery in Android with RecycleView
Stars: ✭ 684 (-63.03%)
Mutual labels:  layoutmanager, recyclerview
Cardswipelayout
Use RecyclerView to achieve card swipe layout , like Tantan . (模仿探探卡片滑动效果的布局)
Stars: ✭ 1,081 (-41.57%)
Mutual labels:  layoutmanager, recyclerview

Logo

CardStackView

Platform License API Download AndroidArsenal CircleCI

Overview

Overview

Contents

Setup

val cardStackView = findViewById<CardStackView>(R.id.card_stack_view)
cardStackView.layoutManager = CardStackLayoutManager()
cardStackView.adapter = CardStackAdapter()

Features

Manual Swipe

ManualSwipe

Automatic Swipe

AutomaticSwipe

CardStackView.swipe()

You can set custom swipe animation.

val setting = SwipeAnimationSetting.Builder()
        .setDirection(Direction.Right)
        .setDuration(Duration.Normal.duration)
        .setInterpolator(AccelerateInterpolator())
        .build()
CardStackLayoutManager.setSwipeAnimationSetting(setting)
CardStackView.swipe()

Cancel

Manual swipe is canceled when the card is dragged less than threshold.

Cancel

Rewind

Rewind

CardStackView.rewind()

You can set custom rewind animation.

val setting = RewindAnimationSetting.Builder()
        .setDirection(Direction.Bottom)
        .setDuration(Duration.Normal.duration)
        .setInterpolator(DecelerateInterpolator())
        .build()
CardStackLayoutManager.setRewindAnimationSetting(setting)
CardStackView.rewind()

Overlay View

Value Sample
Left Overlay-Left
Right Overlay-Right

Put overlay view in your item layout of RecyclerView.

<FrameLayout
    android:id="@+id/left_overlay"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Set your left overlay -->

</FrameLayout>
Value Layout ID
Left left_overlay
Right right_overlay
Top top_overlay
Bottom bottom_overlay

Overlay Interpolator

You can set own interpolator to define the rate of change of alpha.

CardStackLayoutManager.setOverlayInterpolator(LinearInterpolator())

Paging

You can implement paging by using following two ways.

  1. Use DiffUtil.
  2. Call RecyclerView.Adapter.notifyItemRangeInserted manually.

Caution

You should NOT call RecyclerView.Adapter.notifyDataSetChanged for paging because this method will reset top position and maybe occur a perfomance issue.

Reloading

You can implement reloading by calling RecyclerView.Adapter.notifyDataSetChanged.

Stack From

Default Value Sample
None StackFrom-None
Top StackFrom-Top
Bottom StackFrom-Bottom
Left StackFrom-Left
Right StackFrom-Right
CardStackLayoutManager.setStackFrom(StackFrom.None)

Visible Count

Default Value Sample
2 VisibleCount-2
3 VisibleCount-3
4 VisibleCount-4
CardStackLayoutManager.setVisibleCount(3)

Translation Interval

Default Value Sample
4dp TranslationInterval-4dp
8dp TranslationInterval-8dp
12dp TranslationInterval-12dp
CardStackLayoutManager.setTranslationInterval(8.0f)

Scale Interval

Default Value Sample
95% ScaleInterval-95%
90% ScaleInterval-90%
CardStackLayoutManager.setScaleInterval(0.95f)

Max Degree

Default Value Sample
20° MaxDegree-20
MaxDegree-0
CardStackLayoutManager.setMaxDegree(20.0f)

Swipe Direction

Default Value Sample
Horizontal SwipeDirection-Horizontal
Vertical SwipeDirection-Vertical
Freedom SwipeDirection-Freedom
CardStackLayoutManager.setDirections(Direction.HORIZONTAL)

Swipe Threshold

Default Value Sample
30% SwipeThreshold-30%
10% SwipeThreshold-10%
CardStackLayoutManager.setSwipeThreshold(0.3f)

Swipe Restriction

CanScrollHorizontal CanScrollVertical Sample
true true SwipeRestriction-NoRestriction
true false SwipeRestriction-CanScrollHorizontalOnly
false true SwipeRestriction-CanScrollVerticalOnly
false false SwipeRestriction-CannotSwipe
CardStackLayoutManager.setCanScrollHorizontal(true)
CardStackLayoutManager.setCanScrollVertical(true)

Swipeable Method

Default Value Sample
AutomaticAndManual SwipeableMethod-AutomaticAndManual
Automatic SwipwableMethod-Automatic
Manual SwipwableMethod-Manual
None SwipwableMethod-None
CardStackLayoutManager.setSwipeableMethod(SwipeableMethod.AutomaticAndManual)

Public Interfaces

Basic usages

Method Description
CardStackView.swipe() You can swipe once by calling this method.
CardStackView.rewind() You can rewind once by calling this method.
CardStackLayoutManager.getTopPosition() You can get position displayed on top.
CardStackLayoutManager.setStackFrom(StackFrom stackFrom) You can set StackFrom.
CardStackLayoutManager.setTranslationInterval(float translationInterval) You can set TranslationInterval.
CardStackLayoutManager.setScaleInterval(float scaleInterval) You can set ScaleInterval.
CardStackLayoutManager.setSwipeThreshold(float swipeThreshold) You can set SwipeThreshold.
CardStackLayoutManager.setMaxDegree(float maxDegree) You can set MaxDegree.
CardStackLayoutManager.setDirections(List directions) You can set Direction.
CardStackLayoutManager.setCanScrollHorizontal(boolean canScrollHorizontal) You can set CanScrollHorizontal.
CardStackLayoutManager.setCanScrollVertical(boolean canScrollVertical) You can set CanScrollVertical.
CardStackLayoutManager.setSwipeAnimationSetting(SwipeAnimationSetting swipeAnimationSetting) You can set SwipeAnimationSetting.
CardStackLayoutManager.setRewindAnimationSetting(RewindAnimationSetting rewindAnimationSetting) You can set RewindAnimationSetting.

Advanced usages

Method Description
CardStackView.smoothScrollToPosition(int position) You can scroll any position with animation.
CardStackView.scrollToPosition(int position) You can scroll any position without animation.

Callbacks

Method Description
CardStackListener.onCardDragging(Direction direction, float ratio) This method is called while the card is dragging.
CardStackListener.onCardSwiped(Direction direction) This method is called when the card is swiped.
CardStackListener.onCardRewound() This method is called when the card is rewinded.
CardStackListener.onCardCanceled() This method is called when the card is dragged less than threshold.
CardStackListener.onCardAppeared(View view, int position) This method is called when the card appeared.
CardStackListener.onCardDisappeared(View view, int position) This method is called when the card disappeared.

Migration Guide

Migration of Features

1.x 2.x
Move to Origin Cancel
Reverse Rewind
ElevationEnabled Stack From
TranslationDiff Translation Interval
ScaleDiff Scale Interval
SwipeEnabled Swipe Restriction

Migration of Callbacks

1.x 2.x
CardStackView.CardEventListener CardStackListener
onCardDragging(float percentX, float percentY) onCardDragging(Direction direction, float ratio)
onCardSwiped(SwipeDirection direction) onCardSwiped(Direction direction)
onCardReversed() onCardRewound()
onCardMovedToOrigin() onCardCanceled()
onCardClicked(int index) This method is no longer provided. Please implement in your item of RecyclerView.

Installation

LatestVersion is LatestVersion

dependencies {
    implementation "com.yuyakaido.android:card-stack-view:${LatestVersion}"
}

License

Copyright 2018 yuyakaido

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].