aaronbond / swipe-deck Goto Github PK
View Code? Open in Web Editor NEWA Tinder style Swipeable deck view for Android
License: MIT License
A Tinder style Swipeable deck view for Android
License: MIT License
Hello @aaronbond, i liked a lot your library, comparing to other options.
But i'm facing a issue with the size of children inside SwipeDeck
. it's because you always measure then using MeasureSpec.EXACTLY
with the size of parent minus padding.
I've tried to use wrap_content
with SwipeDeck
but it don't works, it always measure with the max available size to him.
In my case, i want to use wrap_content
in SwipeDeck
children, and this approach doesn't works very well.
I'm doing an PR with an possible fix, so you can analyze and merge if you like.
Thanks in advance.
Hey ,
I am stuck with another issue today :(
FAILURE: Build failed with an exception.
Please find the issue :
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt
File1: /home/navya/Documents/Workspace/Trial-set/Trial/AviarySDK/libs/commons-lang3-3.3.2.jar
File2: /home/navya/Documents/Workspace/Trial-set/Trial/AviarySDK/libs/commons-io-2.4.jar
Do you use any of these jars in Swipe Deck?
When you come back from some other activity, though the data passed to adapter is correct, it is not initializing CardStack properly. it shows different item or empty card stack.
How can i get the current visible item from adapter?
Hello,
During implementing swipe-deck to my application, I had one seniores where I have to move my card to selected position for that I am using below code
swipeDeck.setSelection(position);
It will give me crash like this :
java.lang.UnsupportedOperationException: Not supported
Hi, i need to know how to display different images when you swipe the cards instead of only one image?
Is there any way to remove top card without swiping, programmatically?
BTW, thanks for the repo, really nice.
Hey,
Thanks for Great solution to fast implement tinder move.
Do you have an idea how to move the edges of the cards on top of the stack? (Image: http://oi65.tinypic.com/icsmcp.jpg) Default they are on the bottom.
Regards,
Michal
Last two items are not swiping in demo project.
Great Library first of all. I have customized it for some data points.
I was trying to reuse the view where the TODO has been written..
@aaronbond Have you tried resolving this TODO..
The view get stuck again if used the removedView as convertview..
Hi,
library is working fine, but not checked yet for lower version 11, will it work same without any problem.
email : [email protected]
Hi,
i have noticed the that swipe deck duplicates cards when app loses focus (turn off the screen or leave app and come back again). Then i swipe 3 cards, after that i i see the same 3 cards to swipe again.
Current behaviour:
card was swiped right, position in adapter: -3
card was swiped right, position in adapter: -2
card was swiped right, position in adapter: -1
card was swiped right, position in adapter: 0
card was swiped right, position in adapter: 1
card was swiped right, position in adapter: 2
card was swiped right, position in adapter: 3
card was swiped right, position in adapter: 4
....
Desired behaviour:
card was swiped right, position in adapter: 0
card was swiped right, position in adapter: 1
card was swiped right, position in adapter: 2
card was swiped right, position in adapter: 3
card was swiped right, position in adapter: 4
....
Just like Tinder gives swipe up feature for super like . Is it possible to have another method just like swipe left and swipe right?
I still don't understand the use of
cardActionDown() , cardActionUp() methods.
Also while swipe left or right programmatically the transition is very fast how can I delay the transition and show the Like Dislike Image?
This is only my request can you please add some function to add Undo support .
It will be like when i click on undo it will swap back last card which i have been swapped
Pretty much this dribbble.
This similar library provides a Viewpager'stransformPage()
kinda callback. I think something like this could accomplish the above gif. Just like a viewpager, as the card is being swiped off, by using the 'swipe distance', we can linearly interpolate an alpha value to apply to an 'overlay view' on top of each card.
I can think of two ways to approach this:
onTouch()
in SwipeListener
that gives access to the top most card's x and y position (normalized).*Edit: I think the second way might even provide a broader alternative to the right/left indicator images.
Assuming of course, you like the idea. What do you think?
Hi Aaron,
Thanks for your great library.
I'm wondering how to change the card's elevation?
I tried with:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="2dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</android.support.v7.widget.CardView>
but nothing changed. Could you please help?
Thanks
Hey, great library, I must say. I was wondering though, is it possible to limit the swiping to only go left or right, but not freely around the layout?
In my case here, I have a page where I put this swipedeck at the top and other views (horizontal recyclerview etc) below it. So, swiping around freely isn't going to look nice as it would cut the swiping cards at the edge of another views. Plus, scrolling the page up and down is disturbed by the free swiping mechanism.
This issue looks like it could be related to issue #7
I mainly see this while swiping cards to the left. If you swipe a second card quickly and it's swipe animation completes just before the first RemoveViewOnAnimCompleted AsyncTask completes. The third card fails to be setup causing there to be no registered touch events. The second card is then not removed and can be seen just off screen to the left. You have to swipe very quickly. It does not happen when calling the swipeTopCardLeft method programmatically.
I feel this may be related to issue #7 as I am also seeing the slight pause before the card is removed. I assume this is due to the AsyncTask. This short pause seems to be the window in which the issue will occur.
Method void cardsDepleted();
is never called, because in method
private void removeTopCard() {
View child = this.getChildAt(this.getChildCount() - 1);
if(child != null) {
child.setOnTouchListener((OnTouchListener)null);
this.swipeListener = null;
this.removeViewWaitForAnimation(child);
}
if(this.getChildCount() <= 0 && this.eventCallback != null) {
this.eventCallback.cardsDepleted();
}
}
this line this.removeViewWaitForAnimation(child);
is executed async but this line
if(this.getChildCount() <= 0 && this.eventCallback != null) {
this.eventCallback.cardsDepleted();
}
is executed in main thread, so child is not yet removed and this.getChildCount()
returns 1.
I want to switch to next screen when click on the card. But In below 5.0, card is not focusable sometimes. So onClickListener is not calling. In 0.1.0 version, cardClicked() method was available in SwipeEventCallback interface. But In latest version, it is not available. So could you please add the method again.
i added this in my build.gradle file and after syncing am getting this error.
please add methods
getAdapter - return current adapter
getCurrentTopPosition - return int adapter position
Hi. Thanks for the library, it's a good piece of work. I'd like to use it in an app with larger cards, that have a ScrollView as the main layout, so the content can scroll down if needed.
However, when I touch the card, I cannot scroll down, only swipe the card up or down. Is there a simple way to disable swiping up/down?
Thank you
mSwipeDeck.setAdapter(mCursorAdatper);
...
@OverRide
public void onLoadFinished(Loader loader, Cursor data){
mCursorAdatper.swapCursor(data);
}
For the code above. Swipe deck cannot update UI immediately.
i want video to be played inside each card, i am able to achieve this using TextureView to play the Video. and Fortunately it works well,
But results in slower performance. There might be a reason of the views not getting recycled.
am unable to do swipe card right or left programatically. as you have given some methods like cardStack.swipeTopCardRight() its is having some paramter like duration which is not explained in your example. and i want animation to occur just as when we swipe even though we doi programtically.
Hey,
When swiping the card programmatically to left, the card halts for around 500 ms before exiting the screen. I'm using 0.2.1 version.
Tested on Moto e 2nd gen, genymotion emulator.
Not happening when swiping the cards manually
Hi man,
Thanks for the library. It's great and it fits almost all my requirements. There's one thing I can't do.
I have like 2 relative layouts in the bottom of the card with text and image and I would like to highlight (change color) of each of them depending if I'm swiping left or right. Basically similar to what the library already does with the left/right images overlay.
Is there a way to make this work with layouts or maybe another event that I can listen to, to make this works.
Thanks for the help.
I have implemented your example and I must say the library is good thanks for the library.
Is it possible to use recyclerview adapter instead of base adapter?
I am making an app similar to tinder in terms of functionality so need to know base adapter will be sufficient?
Thanks for this wonderful library.I'm trying to add an item to the top of the stack when a user clicks a button. Tried adding the item at index zero nd call notifyDataSetChanged but didn't work.Any help?
Is there an option to make a stack of say 10 cards (I'm using RelativeLayout as the main element for the card, so it doesn't have a shadow) flat without shadow at all?
This library is really helpful, easing up the work to the great extend!!
I found one Issue, When i am using the NestedScrollView as a Parent Layout and pass the fragment of SwipeDeck. It causing problem in animating.
Can anyone help me in resolving the Issue. @aaronbond
Thanks.
Can not swipe all cards , always there are 2 cards , i can not swipe them ??
How can I add the swiped card to the back of the card stack ??
It seems that even if I mention the mention the layout_width and layout_width as wrap_content then mention the min and max width and height, it doesn't seem to respect the value.
Hi,
i'm using swipe cards in view pager, but card swiping conflicts with tab swiping. Do you know a way how to lock tab swiping if card is being swiped?
Hey man,
I'm having some issues with this on smaller screens and I think it's because of the padding issue. Why can not I use wrap_content in the swipeframelayout and swipedeck?
If I set this the cards automatically takes full screen and then i have to set padding to make them fit in the right place. This obviously does not work the same way in every screen.
Do you know a way to fix this?
I have used this library for my project. I have an issues with it. It is working fine , when running the app in and above 5.0 (lollipop). But it is not, below 5.0
The first card is placed at last. I mean card stack is reversed. When swiping the card, the last items only dragged. FYI, I have added screenshot below. Sorry for my poor English.
Is it just me or you support Adapter class only without the possibility to add recycler adapter with the cardstack?
You have done a great job!
is it possible to swipe the top card programmatically, the way its possible in tinder, i.e. with on click events of buttons.
Hi Aaron.
Thanks for providing this great library. I am currently facing an issue.
When I click on a card, I launch another activity.
But when I press back button and then swipe the card, it crashes.
The crash is because the callback of OnSwipeLeft/Right returns a negative position value and I need to access the data in the array at that position.
Also the array size increases.
Is there a way to make it work.
Thanks for the help.
I'm using the SwipeDeck card view inside recycler view. The issue I'm facing is that the onTouch events are first consumed by recycler view(parent) and then its child view(i.e SwipeDeck), so its not swiping as smoothly as it should.
Plz help me out!!!
Hey man,
First I would like to compliment you on how you strucuted the code really well. But I seem to find the issue to your bug.
I swipe through all the cards fine, but when I get to the second to last card. I cannot swipe it.
In order for me to swipe the second to last card, I have to press the "add cards" button. To add more cards. Then I can swipe cards again UNTIL (again) I reach the second to last card.
So no matter what, I cannot swipe the second to last card. How can I fix this error and where in the code is the problem located?
Cheers~
Is it possible to to expand the SwipeEventCallbacks with two more callback methods to detect
Those callbacks would help to find out if e.g. a viewpager should intercept touch events or not.
Thanks for your great work!
Hi Aaron ,
First I would like to thank you for this great library. I would like to use it in my project. I was wondering if there is a way to enable cyclic looping through the cards on swipe/up/down, instead of removing it?
I need to programatically remove all the cards on the click of a button.
feedList is my dataset array. I am doing the following:
feedList.clear();
adapter.notifyDataSetChanged();/
Behavior: The cards become blank but they still remain on the screen and the app crashes.
Please help. Thanks.
Please let me know how to solve the following issue. The frankiesardo:icepick is not found.
Error:A problem occurred configuring project ':Trial'.
Could not resolve all dependencies for configuration ':Trial:_debugCompile'.
Could not find frankiesardo:icepick:3.1.0.
Searched in the following locations:
https://jcenter.bintray.com/frankiesardo/icepick/3.1.0/icepick-3.1.0.pom
https://jcenter.bintray.com/frankiesardo/icepick/3.1.0/icepick-3.1.0.jar
file:/home/navya/Documents/adt-bundle-linux-x86_64-20140702/sdk/extras/android/m2repository/frankiesardo/icepick/3.1.0/icepick-3.1.0.pom
file:/home/navya/Documents/adt-bundle-linux-x86_64-20140702/sdk/extras/android/m2repository/frankiesardo/icepick/3.1.0/icepick-3.1.0.jar
file:/home/navya/Documents/adt-bundle-linux-x86_64-20140702/sdk/extras/google/m2repository/frankiesardo/icepick/3.1.0/icepick-3.1.0.pom
file:/home/navya/Documents/adt-bundle-linux-x86_64-20140702/sdk/extras/google/m2repository/frankiesardo/icepick/3.1.0/icepick-3.1.0.jar
Required by:
Trial:Trial:unspecified > com.daprlabs.aaron:Swipe-Deck:0.2.9
So I have a list of profiles in an Array List and I want the user to be able to start swiping from anywhere in the list. is there a method for initialising this approach or another event like cardStart or cardEnd?
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.