Android Open Source - Swipeable-Cards Card Model






From Project

Back to project page Swipeable-Cards.

License

The source code is released under:

Apache License

If you think the Android project Swipeable-Cards listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/**
 * AndTinder v0.1 for Android// w ww .  j a  v a 2  s .  c  o m
 *
 * @Author: Enrique Lpez Maas <eenriquelopez@gmail.com>
 * http://www.lopez-manas.com
 *
 * TAndTinder 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.
 *
 * AndTinder is compatible with API Level 13 and upwards
 *
 * @copyright: Enrique Lpez Maas
 * @license: Apache License 2.0
 */

package com.andtinder.model;

import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;

public class CardModel {

  private String   title;
  private String   description;
  private Drawable cardImageDrawable;
  private Drawable cardLikeImageDrawable;
  private Drawable cardDislikeImageDrawable;

    private OnCardDimissedListener mOnCardDimissedListener = null;

    private OnClickListener mOnClickListener = null;

    public interface OnCardDimissedListener {
        void onLike();
        void onDislike();
    }

    public interface OnClickListener {
        void OnClickListener();
    }

  public CardModel() {
    this(null, null, (Drawable)null);
  }

  public CardModel(String title, String description, Drawable cardImage) {
    this.title = title;
    this.description = description;
    this.cardImageDrawable = cardImage;
  }

  public CardModel(String title, String description, Bitmap cardImage) {
    this.title = title;
    this.description = description;
    this.cardImageDrawable = new BitmapDrawable(null, cardImage);
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public Drawable getCardImageDrawable() {
    return cardImageDrawable;
  }

  public void setCardImageDrawable(Drawable cardImageDrawable) {
    this.cardImageDrawable = cardImageDrawable;
  }

  public Drawable getCardLikeImageDrawable() {
    return cardLikeImageDrawable;
  }

  public void setCardLikeImageDrawable(Drawable cardLikeImageDrawable) {
    this.cardLikeImageDrawable = cardLikeImageDrawable;
  }

  public Drawable getCardDislikeImageDrawable() {
    return cardDislikeImageDrawable;
  }

  public void setCardDislikeImageDrawable(Drawable cardDislikeImageDrawable) {
    this.cardDislikeImageDrawable = cardDislikeImageDrawable;
  }

    public void setOnCardDimissedListener( OnCardDimissedListener listener ) {
        this.mOnCardDimissedListener = listener;
    }

    public OnCardDimissedListener getOnCardDimissedListener() {
       return this.mOnCardDimissedListener;
    }


    public void setOnClickListener( OnClickListener listener ) {
        this.mOnClickListener = listener;
    }

    public OnClickListener getOnClickListener() {
        return this.mOnClickListener;
    }
}




Java Source Code List

com.andtinder.Utils.java
com.andtinder.demo.MainActivity.java
com.andtinder.model.CardModel.java
com.andtinder.model.Likes.java
com.andtinder.model.Orientations.java
com.andtinder.view.BaseCardStackAdapter.java
com.andtinder.view.CardContainer.java
com.andtinder.view.CardStackAdapter.java
com.andtinder.view.SimpleCardStackAdapter.java