Code Monkey home page Code Monkey logo

swipeable-cards's Introduction

Swipeable cards: Tinder-like cards library for Android

Swipeable-cards is a native library for Android that provide a Tinder card like effect. A card can be constructed using an image and displayed with animation effects, dismiss-to-like and dismiss-to-unlike, and use different sorting mechanisms.

The library is compatible for Android versions 4.4 (API Level 19) and upwards.

A library and a sample application are provided with the code.

Example Image Example Image

Usage

Download the library with git and import it into your project (right now there is only Gradle support, so you need to import it writing in your build.gradle the following:

compile project(':AndTinder')

and in your settings.gradle

include 'AndTinder'

You can also download it via MavenCentral and Gradle:

dependencies {
   compile 'com.github.kikoso:SwipeableCards:1.1-RELEASE@aar'
}

When you have included the library in your project, you need to proceeed as follows. First, create a container to store the cards.

<com.andtinder.view.CardContainer 
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/layoutview"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent" />

From your Activity, inflate into a CardContainer the container you declared in your XML

mCardContainer = (CardContainer) findViewById(R.id.layoutview);

The card container can sort the cards either ordered or disordered:

mCardContainer.setOrientation(Orientation.Ordered);
mCardContainer.setOrientation(Orientation.Disordered);

Now you need to create your cards. The procedure is quite simple: you just need to create an object CardView and provide the image resource you want to add:

CardModel card = new CardModel("Title1", "Description goes here", r.getDrawable(R.drawable.picture1);

Additionally, you can set up a Delegate to be notified when the image is being liked or disliked:

card.setOnCardDimissedListener(new CardModel.OnCardDismissedListener() {
     @Override
     public void onLike() {
          Log.d("Swipeable Card", "I liked it");
     }

     @Override
     public void onDislike() {
          Log.d("Swipeable Card", "I did not liked it");
     }
});

Or when it is clicked:

card.setOnClickListener(new CardModel.OnClickListener() {
     @Override
     public void OnClickListener() {
          Log.i("Swipeable Cards","I am pressing the card");
     }
});

Finally, use an adapter to link the cards and the container:

SimpleCardStackAdapter adapter = new SimpleCardStackAdapter(this);
adapter.add(new CardModel("Title1", "Description goes here", r.getDrawable(R.drawable.picture1)));
mCardContainer.setAdapter(adapter);

Version history

  • 28.01.2020: Version 0.4: Migration to AndroidX, libraries updated.
  • 14.02.2015: Version 0.3: Fixed bugs with the cards locations and updated to the latest build tools.
  • 4.06.2014: Published the version 0.2 with several improvements thanks to Dr-Emann.
  • 13.05.2014: Published the first version 0.1.

Next steps

There are many things that can be done with this library.

  • Allow custom templates
  • Extend image personalization options
  • Recreate the container when it has been emptied

If you want to colaborate with the project or have any idea to be implemented feel free to submit a pull request or to write an issue!

Also, if you have used AndTinder on your app and you let me know, I can link it from here :)

Contact

Enrique López Mañas - [email protected]

License

Copyright 2020 Enrique López Mañas

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.
Follow me on Twitter Follow me on Google+ Follow me on LinkedIn

swipeable-cards's People

Contributors

afeozzz avatar charuvijay avatar dr-emann avatar fadelakin avatar jahertor avatar kikoso avatar mathur avatar tarr1124 avatar tomxor avatar zhuiji7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swipeable-cards's Issues

Programmatically swipe left/right

Hi there!
First of all I need to thank you for this cool library.

I need to add like/dislike buttons just like the Tinder app and I'm wondering if there is an easy way to trigger the swipe animation programmatically by tapping the two buttons.

problem with clicks over card elements

I'm talking about the card elements like the camera icon and the photos icon that are just below each of the cards ,I implemented the setOnclickListener with the Id of these imageViews but I can only get the setOnclicklisterners fired only on the very last card and not the cards before the very last card.

how to solve this issue?

Talking about these:
image

I want to have OnclickListeners(0 working on the UI elements like Adopt, location and camera icons!

README file needs to be updated.

dependencies {
compile 'com.github.kikoso:SwipeableCards:1.0-RELEASE'
}

Above doesn't work.
Instead,

dependencies {
compile 'com.github.kikoso:SwipeableCards:1.0-RELEASE@aar'
}

works.
@aar needs to be appended.

Slow

swipe is also very slow

Like and Unlike drawable images

Hello all, nice lib. I would like to add like/unlike heart-image (as in tinder app) to my project and I found
private Drawable cardLikeImageDrawable;
private Drawable cardDislikeImageDrawable;

but how it use? Is there any way to implement this features at this project version or its for the future release?

Question: How can I access properties of CardModel?

In the readme.md is written:
Additionally, you can set up a Delegate to be notified when the image is being liked or disliked:
...

   card.setOnClickListener(new CardModel.OnClickListener() {
       @Override
       public void OnClickListener() {
           Log.i("Swipeable Cards","I am pressing the card");
       }
    });

But how can I get e.g. the title of the current card? Like that pseudo-code:

   card.setOnClickListener(new CardModel.OnClickListener() {
       @Override
       public void OnClickListener() {
           Log.i("Swipeable Cards","I am pressing the card with the title: " + this.getTitle());
       }
    });

getTitle() exists as a method of class CardModel
Any help is appreciated, thank you.

1st CardModel item is always the same.

I always get the same CardModel hence the same card always get the Click event. (https://github.com/kikoso/Swipeable-Cards/blob/master/AndTinder/src/main/java/com/andtinder/view/CardContainer.java#L449).

The card is being removed from the container (https://github.com/kikoso/Swipeable-Cards/blob/master/AndTinder/src/main/java/com/andtinder/view/CardContainer.java#L472)
but it seems that it is not being removed from the CardStackAdapter because the "pop" method is not being called anywhere.

Am I missing something?

Freezing after initial drag event on Samsung devices

Hi there,

I am in the process of developing this functionality into an Android App. However, I noticed that there is a view layout update problem for cards when you stop dragging on Samsung devices. The Card resets and freezes in position, thus no longer being responsive to touch events.

Tested on Samsung Galaxy S3 and Samsung S3 mini (version 4.1.2).

I have modified the library to use the Picasso image library as such:

public class VenueCardAdapter extends CardStackAdapter implements VenueCardModel.OnCardDimissedListener {

private ArrayList<Venue> vList;
private Context vCon;
private int count = 0;

    public VenueCardAdapter(Context mContext, ArrayList<Venue> theVenues)
    {
        super(mContext);
        vCon = mContext;
        vList = theVenues;
        count = 0;
    }

public static class ViewHolder {

    public TextView tvVenueName;
    public TextView tvVenueAbout = null;
    public ImageView ivVenueImage = null;
    public RatingBar venueRating;

}


@Override
    public View getCardView(int position, CardModel model, View convertView, ViewGroup parent) {
        final ViewHolder holder;
        if(convertView == null) {

            holder = new ViewHolder();

            LayoutInflater inflater = LayoutInflater.from(getContext());
            convertView = inflater.inflate(com.andtinder.R.layout.std_card_inner, parent, false);
            if(convertView!=null) {
                holder.tvVenueName = (TextView) convertView.findViewById(com.andtinder.R.id.title);
                holder.tvVenueAbout = (TextView) convertView.findViewById(com.andtinder.R.id.about);
                holder.ivVenueImage = (ImageView) convertView.findViewById(com.andtinder.R.id.image);
                holder.venueRating = (RatingBar) convertView.findViewById(com.andtinder.R.id.rating);
                holder.venueRating.setEnabled(false);
            }
            assert convertView != null;
            convertView.setTag(holder);
        }
        else
            holder=(ViewHolder)convertView.getTag();

        if(holder != null) {

            // ensures only latest top 3 cards are loaded

                final Venue theVenue = vList.get(position);

                if (theVenue != null) {

                    String about = "";
                    String address = theVenue.address1;
                    if (address == null) {
                        address = "";
                    } else {
                        // trim to only 25 chars or less
                        if (address.length() >= 25) {
                            address = address.substring(0, 25) + "..";
                        }

                    }

                    String distance = "";
                    if (theVenue.distance != null) {
                        distance = theVenue.distance.substring(0, 4) + " mi";
                    }
                    about = address + " | " + distance;



                    if (theVenue.images != null) {
                        String imageNo = theVenue.images[0];
                        String url = "http://api.paywithvelocity.com/1/image?fileID=" + imageNo;
                        if (Config.DOWNLOAD_IMAGES) {

                            // ensures only latest top 3 card images are downloaded
                            if (position >= count && position < (count + 3)) {
                            Picasso.with(vCon).load(url).resize((int) (parent.getMeasuredWidth()), parent.getMeasuredHeight()).centerInside()
                                    .placeholder(R.drawable.placeholder_image).into(holder.ivVenueImage);
                            } // Top 3 cards
                        } else {

                            Picasso.with(vCon).load(R.drawable.placeholder_image).into(holder.ivVenueImage);

                        }
                    } else {

                        Picasso.with(vCon).load(R.drawable.placeholder_image).into(holder.ivVenueImage);

                    }

                    if(holder.tvVenueName !=null) {
                        if(theVenue.venueName != null) {
                            String name = theVenue.venueName;

                            if(name.length() >= 15)
                            {
                                name = name.substring(0,15) + ".. ";
                            }

                                holder.tvVenueName.setText(name);
                        }
                    }
                    if(holder.tvVenueAbout != null) {
                        holder.tvVenueAbout.setText(about);
                    }


                } // Venue not null



        } // holder not null
        return convertView;
    }

/// Actually Dislike!
@Override
public void onLike() {
    if(count < vList.size()) {
        super.pop();
        Venue onTop = vList.get(count);

        Toast.makeText(vCon, "You disliked " + onTop.venueName + "!", Toast.LENGTH_SHORT).show();
        count++;

    }
}



// Actually Like!
@Override
public void onDislike() {
    if(count < vList.size()) {
        super.pop();
        Venue onTop = vList.get(count);

        Toast.makeText(vCon, "You liked " + onTop.venueName + "!", Toast.LENGTH_SHORT).show();
        count++;

        Intent openBooking = new Intent(vCon, BookingActivity.class);

        openBooking.putExtra("venueName", ""+onTop.venueName);

        vCon.startActivity(openBooking);


    }
}

}

Graphical glitches when dragging cards

When moving cards, the cards break apart as they move. It's easiest to explain with a video, so see below for an example.

My Setup

Hardware

HTC One, running android 4.4 cyanogenmod

Software

Compiled with gradlew assembleDebug

Janky Video
(No, that's not a GIF artifact. that's how it looks on my phone)

Cannot evaluate module AndTinder : Configuration with name 'default' not found

As per subject, I got this error message when I try to add submodule inside the project.

Error:A problem occurred configuring project ':app'.
> Cannot evaluate module AndTinder : Configuration with name 'default' not found.

build.gradle

compile project(':AndTinder')

setting.gradle

include 'AndTinder'

Please advice. Thank you.

(Enhancement) Dynamically add cards to the back of the stack

Hi, nice library! I think it would be cool if the library had support for adding new cards to the back of the card stack to create a "infinite" cards effect as new cards can be dynamically added. I made some modifications to the library that'll let me do that but it's a bit hacky.

Nothing happened click on card ImageView

Nothing happened if I click the card ImageView.

cardModel.setOnClickListener(new CardModel.OnClickListener() {
            @Override
            public void OnClickListener() {
                Log.i("Swipeable Cards","I am pressing the card");
            }
        });

Please advice. Thank you.

Touch position problem

Thanks for your good library.
I have installed the demo app on LG Vega phone.
When I touch the right bottom of card, it is not moving.

The event.getX() is 320 , and event.getY() is 456.
But the childRect that is get by getHitRect() function is (-172,-22)-(199, 349) even I click inside the card.

Help me!

And can you add the callback when the card is started moving to left or right?

Adding AndTinder Library to my Project

I followed the steps of adding the AndTinder folder to the project path, adding the compile project() to the gradle dependencies, and the settings.gradle.

However, when I add the container to my xml file I get the error "Rendering Problems. Class does not exist". Additionally I am able to import the files to the various src files without any issues.

Any suggestions?

image

image

get next card model in card dismiss

How can I get next cardmodel in card dismiss?
I follow the instruction, but I have no idea to get the next card model. What I do is I called adapter.pop() in the dismiss. But this always return nullpointerexception. Do you guys have any idea?

cardModel = adapter.getCardModel(0);
cardModel.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
@OverRide
public void onLike() {
cardModel = adapter.pop();
}
@OverRide
public void onDisLike() {
cardModel = adapter.pop();
}
}

Individual ClickListener of Cards set in Adapter

I am using these awesome Library. I have used the CardModels and set it in Apadter.
But I am unable to get the Unique ClickListener of Particular Card.

I have this code in the Container Class as:
mTopCard = getChildAt(getChildCount() - 2);
CardModel cardModel = (CardModel) getAdapter().getItem(mNextAdapterPosition - 1);

I have used everywhere 'mNextAdapterPosition - 1' where i have these code.
Here is my clicklistener and Adapter Code:

UserModel userModel = rawItems.get(it);
CardModel cardModel = new CardModel(userModel);

                    cardModel.setOnClickListener(
                            new CardModel.OnClickListener() {
                                @Override
                                public void OnClickListener() {

                                    Intent intent = new Intent(
                                            getActivity(),
                                            Browse_ProfilePicture.class);

                                    startActivity(intent);
                                }
                            });
                    cardModel.setOnCardDimissedListener(
                            new CardModel.OnCardDimissedListener() {

                                @Override
                                public void onLike() {

                                    Log.e("userid", user.getUserId() + "");

                                    Toast.makeText(getActivity(), "Liked",
                                            Toast.LENGTH_LONG).show();
                                }

                                @Override
                                public void onDislike() {
                                    Toast.makeText(getActivity(),
                                            "Disliked", Toast.LENGTH_LONG)
                                            .show();
                                }
                            });
                    adapter.add(cardModel);

As shown i am setting CardModel in Unique Adapter, Then also in Like log, I am getting only 1 user ID, Last User ID. I want unique User ID.

Does Anyone have idea how can i solve this issue?

Swipe and Tap

Hi,

For setOnClickListener event I would like to preview the card (e.g navigate to a different fragment activity with just the image and zoom in-out functionalities enabled). The problem is that setOnClickListener is called also when trying to swipe left/right.

How can be the setOnClickListener and swipeListeners mutually exclusive?

Dorin

Crash on Some Devices while Swiping the Cards

I am getting these issue with the Library while testing on Samsung Galaxy Core on Intercept Touch Event:

04-13 17:28:05.252: E/AndroidRuntime(2549): java.lang.IllegalArgumentException: pointerIndex out of range
04-13 17:28:05.252: E/AndroidRuntime(2549): at android.view.MotionEvent.nativeGetAxisValue(Native Method)
04-13 17:28:05.252: E/AndroidRuntime(2549): at android.view.MotionEvent.getX(MotionEvent.java:2145)

Getting issue in Intercept Touch Event in following code in container:
case MotionEvent.ACTION_MOVE:
pointerIndex = event.findPointerIndex(mActivePointerId);
x = event.getX(pointerIndex);
y = event.getY(pointerIndex);

Can anyone please help me with these issue.

Binary XML file line #8: Error inflating class com.andtinder.view.CardContainer.

Hi, I try to run your project i get this error.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andtinder.demo/com.andtinder.demo.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class com.andtinder.view.CardContainer.

And also I am confusing to used for this one compile project(':AndTinder'), include 'AndTinder', please help.

How to show up hidden library in project structure?

I can't see your library after import via gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.0'
    compile 'com.github.kikoso:SwipeableCards:1.1-RELEASE@aar'
}

screen shot 2015-05-18 at 3 48 27 pm

Please advice. Thank you.

Attribute "orientation" has already been defined

Hi,

When add your aar with gradle:
compile 'com.github.kikoso:SwipeableCards:1.1-RELEASE@aar'

I have the problem with compilation in resources.

PS: fixed by rename attr orientation to orientationCard (for example) in lib

Cannot use android:icon when using this library

In my AndroidManifest.xml, i have

<application
        android:allowBackup="true"
        android:logo="@drawable/logofooter"
        android:icon="@drawable/logoappsico"

After importing the library, i get the following error:

Error:(20, 9) Attribute application@icon value=(@drawable/logoappsico) from AndroidManifest.xml:20:9
Error:(20, 9) Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@icon value=(@drawable/logoappsico) from AndroidManifest.xml:20:9
is also present at timdair:AndTinder:unspecified:12:9 value=(@drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:17:5 to override

Error when compiling with MavenCentral dependency

Gradle throws this error when trying to compile the project.

Error:(7, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9
    is also present at TeleBuzz.libs.Swipeable-Cards:AndTinder:unspecified:12:9 value=(@drawable/ic_launcher)
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5 to override

How to make custom buttons?

Is it possible to create custom buttons like tinder functionalities such as Undo, Dislike, Like and Info?

2015-04-28 02 05 06

Example for Fragment integration would be nice

Hi there,
i am struggeling to integrate Swipeable-Cards in my application as part of a Fragment. Is that even possible? If yes, it would be nice to see an example of how thats supposed to be set up.
cheers!

OnDiscardListener working in reverse order

 setOnCardDimissedListener(new OnCardDimissedListener() {
                @Override
                public void onLike() {
                    MainActivity.wv.loadUrl(profileurl);
                    Log.v("andtinder",profileurl);
                }

                @Override
                public void onDislike() {

                }
            });

If i like the first card, the profile url in the last card gets called
If i like the second card, the second last card action gets called

Anyone experiencing this issue?

Unable to add rounded corners to card

Unfortunately I am unable to add rounded corners to the Cards like in the Tinder app. I have tried altering the std_card_inner.xml using a rounded shape drawable from xml but with no luck.

I believe this needs to be implemented in the onInterceptTouch method as the view of the card show remain curved when touched.

Any guidance here would be useful, Thanks.

Performance issues (lag) in cell phones with better resolution

Hi, i tested this library on different devices and i got worst performance in the ones that have better resolution.

The devices i tested are Samsung S4 Mini, Samsung S4, Motorola Moto X 1st Generation, Motorola Moto X 2nd Generation, and Samsung S5. Most laggy one was Motorola Moto X 2nd Generation, but it works laggy in everyone except in Samsung S4 Mini and Motorola Moto X 1st Gen.

If you have some way to deal with this, i will appreciate.

Regards.

Can't find OnCardDimissedDelegate().. Is it replaced with OnCardDimissedListener()?

card.setOnCardDimissedDelegate(new CardView.OnCardDimissedDelegate() {
        @Override
        public void onLike(CardView cardView) {
            Log.d("Swipeable Card", "I liked it");
        }

        @Override
        public void onDislike(CardView cardView) {
            Log.d("Swipeable Card", "I did not liked it");
        }
    });

In the usage, the above snippet is given as example, But in the latest code, I could only implement this:

card.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
                    @Override
                    public void onLike() {
                        Log.i("Swipeable Cards", "I like the card");

                    }

                    @Override
                    public void onDislike() {
                        Log.i("Swipeable Cards", "I dislike the card");

                    }
                });

So, onLike() and onDislike() don't have CardView as argument. So how can I access dismissed card when liked or disliked? Actually I want to set some "id" for each card and add many cards in a loop(with a webservice). So, how can I get "id" of dismissed card?

Getting name or details of card which is swiped

I am not able to get the details of the card which is swiped. I always get first item in below code

cardModel.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
@OverRide
public void onLike(CardModel cardModel) {
Log.d(TAG,"Inner "+cardModel.getTitle() + " : ");
}
@OverRide
public void onDislike(CardModel cardModel) {
Log.d(TAG,"Inner dislike "+cardModel.getTitle());
//adapter.pop();
}
});

Endless adapter

Does anyone know a way to always show cards? how can I add a card to the bottom of the stack when I dismiss one?

Thank you

On some cases, it's possible to drag items behind the top one

Not sure how this occurred, other than playing around with the sample:
I can't drag the card on the top of the stack. Instead, it drags an item inside it.
After removing it, I could remove a few more, and then I can't drag any of them (even though I can see more).

Here's a screenshot of what I was able to do:

device-2014-06-04-225734

cardModel setOnCardDimissedListener works once

Hi, So I followed the demo and trying to save the cardModel's title in the database. But the Demo only shows the first cardModel and how can we get every cardModel's title? Thanks in advance.

Can't run an eclipse for this one i got error

Hi, I try to run your project i get this error.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andtinder.demo/com.andtinder.demo.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class com.andtinder.view.CardContainer.

And also I am confusing to used for this one compile project(':AndTinder'), include 'AndTinder', please help.

Dynamically populating the cards

I am fetching pictures from a server and need to put them in cards, but i don't know how many of them i have, its done dynamically, how can i proceed, I have no clue. thanks

Cards over fave/pass buttons

I need to make the card containers above the buttons.

2015-02-27 14 06 59

This is the fragment main view:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:background="@color/secondary"
    tools:context="assembly.giraff.MainViewFragment$PlaceholderFragment">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/ll_buttons"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="10dp"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/pass_button"
            android:layout_width="@dimen/button_size"
            android:layout_height="@dimen/button_size"
            android:src="@drawable/pass"
            android:scaleType="fitCenter"
            android:clickable="true" />

        <ImageView
            android:id="@+id/share_button"
            android:layout_width="@dimen/button_size"
            android:layout_height="@dimen/button_size"
            android:src="@drawable/share"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:padding="@dimen/button_padding"
            android:clickable="true"
            android:background="@drawable/share_button_background"
            android:scaleType="centerInside" />

        <ImageView
            android:id="@+id/fave_button"
            android:layout_width="@dimen/button_size"
            android:layout_height="@dimen/button_size"
            android:src="@drawable/fave"
            android:scaleType="fitCenter"
            android:clickable="true" />

    </LinearLayout>

    <assembly.giraff.andtinder.view.CardContainer
        android:id="@+id/card_container"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="10dp"
        android:clipToPadding="false"
        android:layout_above="@+id/ll_buttons" />


</RelativeLayout>

Anyone ?

Only the cardDimissedListener for the latest card runs for all subsequent cards!

I have made cardDimissedListeners for 2 different cards, with different outcomes on like and dislike. But when I am running the app, only the listener for the latest card on the stack is running for both the cards.

I put a dummy card without a listener as the latest card and no listener ran for any of the other cards.

For example, in the first card(named Card1) in the onLike(), I am printing(toast), "I liked card 1" and in the second I am printing "I liked card 2" but when I like(swipe in the like direction) both I get "I liked card1".

Is the behaviour meant to be like this, ie. the onLike and onDislike listeners for the first card will run all the time? Ideally I would want to have different listeners for different cards?
Please enlighten me in this regards.
Thanks!

CardContainer

How do i check when the card container is empty??
When i swipe the last card i wanna destroy the fragment with cardContainer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.