yuyakaido / cardstackview Goto Github PK
View Code? Open in Web Editor NEW📱Tinder like swipeable card view for Android
License: Apache License 2.0
📱Tinder like swipeable card view for Android
License: Apache License 2.0
Hi yuyakaido.I need to implement flip on cardstackview.can you help me for implementing flip
How can I remove the card's elevation to set cardview in fullscreen?
Thx
I would like to remove a card in remaining cards. Could you help me ?
For example if user set swipe direction to horizontal cardStackView should let parent handle vertical touch events and vice versa.
Otherwise it's really hard to use this library within scrollView or coordinatorLayout etc.
Hello again,
I have a question regarding swipe direction.
I know there is
<com.yuyakaido.android.cardstackview.CardStackView
app:swipeEnabled="true"
or
app:swipeEnabled="false"/>
OR
CardStackView#setSwipeEnabled(true);
or
CardStackView#setSwipeEnabled(false);
for enable or disable swipe.
But is there any way I can allow swiping only in one direction?
i.e, if I can disable swipping to right and only allow to swipe left or viceversa.
Thanks.
Any one help me, i want to get last swipable card when we swipe left direction.
Actually i want achieve, when i swipe left direction then show me last swipable card
Using the CoordinatorLayout in the card item xml makes the app to crash.
Just try to add a CoordinatorLayout in the item_tourist_spot_card.xml in the sample project, and see the issue.
Hi, wonderful library. I have a question, how do i get object for current card? Also, how do i disable top swipe?
Thanks.
Hey yuyakaido,
how to implement card swipe with image swipe like as badoo app in your CardStackView
Hi team,
It was awesome library. But i need to know, will this adapter support for recycler view.
Thanks for the wonderful library.
I faced an issues in case we swipe the card partially to the bottom and without releasing our card if we minimise our app using the home button of device and come back again to the app, the card remains stuck and does not returns to the original position.
I'm trying to prevent users from swiping fast, as the onCardSwiped() is called with a delay on fast swiping.
If a user swipes fast, by the time the user is on his 3rd swipe, the onCardSwiped() method get called on behalf of the 1st swipe.
I tried to disable swipes until the onCardSwiped() get called, like in the following code snippet, but it's not working as the current swipe get disabled too.
`mCardsViewListener = new CardStackView.CardEventListener() {
@Override
public void onCardDragging( float percentX, float percentY ) {
if ( percentX >= 0.75 || percentX <= -0.75 ) {
mCardsView.setSwipeEnabled( false );
}
}
@Override
public void onCardSwiped( SwipeDirection direction ) {
mCardsView.setSwipeEnabled( true );
// Some code to handle swiped card goes here...
}
@Override
public void onCardReversed() {
Log.d( TAG, "onCardReversed" );
}
@Override
public void onCardMovedToOrigin() {
Log.d( TAG, "onCardMovedToOrigin" );
}
@Override
public void onCardClicked( int index ) {
Log.d( TAG, "onCardClicked: " + index );
}
};`
Is there a simple solution for this issue?
Thanks a lot
*Update Build Tools and Gradle to v27.0.2.
Hello!
I fail to get this support version.
I have also set my support lib to 25.+ version.
Set the card of that position at top of all stack.
Is there a way to perform a reverse (bring previous card back) by dragging from the edge of the screen?
Hello! I'm using this awesome library and encountered problem - I can reverse only 1 last card swiped. Is there any possibility to reverse all last swiped cards one by one?
Hi
The drag event is not working on the card if we put a clickListener on the view inside
If I add an onClick listener to the contentview of the card the card it seems to consume the ontouch event, and the card can no longer be swiped, is there any solution to this?
Hey
Please tell me how to go to the next page, on card click because it not handling the button click.
Thank You
If you fast swipe left and right! You will see a flying card in the background =)
Hello,
Is there a way for me to receive the point (x,y) where the user clicked on the card? My approach is to do the following:
CardContainerView.java
to pass motionOriginX
and motionOriginY
to the containerEventListener
containerEventListener
will then pass them to cardEventListener
in CardStackView.java
and from there I can use the point as I need them?Thanks for your time
hi, i'm using app:stackFrom="top"
and i need to get the root view of the card that is located under current card. how can i do it?
I can get current card using getTopView
btw thanks for good library
Card we swiped, can we get the card again.
Hey yuyakaido,
how to implement card swipe with image swipe like as badoo app in your CardStackView
@OverRide
public void onCardSwiped(Quadrant quadrant) {
Log.d("CardStackView", "onCardSwiped: " + quadrant.toString());
Log.d("CardStackView", "topIndex: " + cardStackView.getTopIndex());
if (cardStackView.getTopIndex() == imageList.size() - 1) {
Log.d("CardStackView", "Paginate: " + cardStackView.getTopIndex());
paginate();
}
}
here how to set top index to 0, what i want to do is when top index is reach to last index of image. i want to set top index to 0 again.. how do i do that.
Thank you for the code, is very nice!
I noticed that using the automatic swipe CardStackView.swipe, the quadrant result on the callback onCardSwiped is always BottomLeft, indipendently of the SwipeDirection used.
You need swipe left (or right) and fast touch the left side of the screen!
I want to swipe down to get the previous card. Can you help me?
When you upgrade your build:gradle to 3 the dragging processes of the card stack is slow down (dramatically).
My File:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Workaround:
For now I just rollback to 2.3.3 And everything went to normal.
Add the code:
if (distance < distanceBorder || topIndex == adapter.getCount() - 1) {
cardAnimator.moveToOrigin();
} else {
discard(direction);
}
in line 148 in the class CardStackView
Got this crash using beta8. Not sure how to reproduce it but I will post re-produce steps when I can.
11-06 12:13:14.512 11196-11196/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException: Attempt to invoke interface method 'android.view.ViewParent android.view.ViewParent.getParent()' on a null object reference
at com.yuyakaido.android.cardstackview.internal.CardContainerView.onTouchEvent(CardContainerView.java:91)
at android.view.View.dispatchTouchEvent(View.java:10025)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2663)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2344)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2691)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at com.sothree.slidinguppanel.SlidingUpPanelLayout.dispatchTouchEvent(SlidingUpPanelLayout.java:963)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2358)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:413)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1808)
at android.app.Activity.dispatchTouchEvent(Activity.java:3061)
at com.promgirl.speedshop.activities.SpeedShopActivity.dispatchTouchEvent(SpeedShopActivity.java:609)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:375)
at android.view.View.dispatchPointerEvent(View.java:10245)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4433)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4301)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3848)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3901)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3867)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3994)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3875)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4051)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3848)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3901)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3867)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3875)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3848)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6209)
11-06 12:13:14.512 11196-11196/? E/AndroidRuntime: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6183)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6144)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6312)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6088)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Is there a method to set the cardstack to start an index? I notice that on orientation change, the card stack resets and loads from the beginning. I would like to save the current position and restore that position so the user does not have to start from the beginning.
Thanks for making such a great library!
I am integrating this library for card stack and there I want to use reverse card method but i couldn't find it. Please help me out with this
Whenever I add an item, remove it, and adding another one, doesn't work.
After debugging for a bit, I've discovered it's related to topIndex
, because once you remove an item from the adapter, this index is not updated. I'll try to fork the lib and dig into it, but if you could have a look would be amazing :-)
Thanks in advance.
I want to start with thank you for making this library.
Now the issue, If i were to click or drag the card, a flickering/blinking effect will occur, I noticed that this only happened when my card is rich with layouts (layouts within layouts).
No flickering happened if its just a simple tree layout though just like in the demo. I tried to make mine simple but some widget like Ratingbar is still flickering inside the card, any solutions?
How do i add a specific action when the user swipes to a certain direction?
I want the swipe to perform a task. how can i do that?
Hello ,
Please tell me how to make swipe on button click like in tinder when we click o like and dislike button
Thank you
Hey,
First, very nice work with this library!
I'm trying to achieve overlay effect only at the CardView, e.g: changing its color while swiping left/right.
Currently the color change effects all the CardStackView and it looks bad if you have a CardView which is half size the total CardStackView.
Also, is it possible to add overlay effect to top/bottom drag aswell?
Is there any way and add shadow to the cards?
Hi,
First of all thanks to this awesome library, I just want to develop animation like Bumble App, to acheive this i have to disable card swiping vertically ( Up and down ). Please suggest some method to this
Thanks
Rajat Arora
Swipe is not smooth in some android devices like OPPO CPH1701. How to make the swipe smoother in all devices?
I set app:visibleCount="1"
Expected result: after the card was swiped all the way out of the screen, the next one will show.
Current result: as soon as the card is about to exit the screen, the app crushes.
NullPointer logcat on fast swiping
java.lang.NullPointerException: Attempt to invoke interface method 'android.view.ViewParent android.view.ViewParent.getParent()' on a null object reference
at com.yuyakaido.android.cardstackview.internal.CardContainerView.onTouchEvent(CardContainerView.java:91)
at android.view.View.dispatchTouchEvent(View.java:10110)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2776)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2810)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2782)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2422)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:435)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1836)
at android.app.Activity.dispatchTouchEvent(Activity.java:3072)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:68)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:397)
at android.view.View.dispatchPointerEvent(View.java:10341)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4928)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4787)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4293)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4346)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4312)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4459)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4320)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4516)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4293)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4346)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4312)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4320)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4293)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6817)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6791)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6734)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6989)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:328)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:6361)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.
Here is my overlay
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
app:cardBackgroundColor="#22000000"
app:cardCornerRadius="6dp"
app:cardElevation="0dp"
app:cardUseCompatPadding="true">
<com.beardedhen.androidbootstrap.AwesomeTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:textSize="64sp"
app:bootstrapBrand="danger"
app:fontAwesomeIcon="fa_trash_o" />
</android.support.v7.widget.CardView>
My content card contains hard layout, but i think it not important. In my case, the card ignores touching anywhere, BUT on the edges of the card, the touch works! if I remove the app:cardUseCompatPadding="true"
then the touches do not work anywhere, even at the edges. Library bug? I use beta-8
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.