[Java for Android App Development] D-FUSE:
If you of you guys could take a look and if that looks ok. That would be awesome

package com.fima.cardsui.objects;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.fima.cardsui.R;
import com.fima.cardsui.Utils;

public abstract class Card extends AbstractCard {

protected View mCardLayout;
private OnCardSwiped onCardSwipedListener;
private OnClickListener mListener;

public Card() {

}

public Card(String title) {
this.title = title;
}

public Card(String title, String desc) {
this.title = title;
this.desc = desc;
}

public Card(String title, int image) {
this.title = title;
this.image = image;
}

public Card(String title, String desc, int image) {
this.title = title;
this.desc = desc;
this.image = image;
}

public Card(String title, String desc,String getPackageName,String getVersionName,int getVersionCode,AdapterView.OnItemSelectedListener onItemSelectedListener, String packageName, String versionName, int versionCode ) {
this.title = title;
this.desc = desc;
this.onItemSelectedListener = onItemSelectedListener;
this.packageName = packageName;
this.versionName = versionName;
this.versionCode = versionCode;
}

public Card(String titlePlay, String description, String color,
String titleColor, Boolean hasOverflow, Boolean isClickable) {

this.titlePlay = titlePlay;
this.description = description;
this.color = color;
this.titleColor = titleColor;
this.hasOverflow = hasOverflow;
this.isClickable = isClickable;
}

public Card(String titlePlay, String description, int imageRes, String titleColor, Boolean hasOverflow,
Boolean isClickable) {

this.titlePlay = titlePlay;
this.description = description;
this.titleColor = titleColor;
this.hasOverflow = hasOverflow;
this.isClickable = isClickable;
this.imageRes = imageRes;
}

public Card(String title, Context context) {
this.title = title;
this.context = context;
}

@Override
public View getView(Context context, boolean swipable) {
return getView(context, false);
}

@Override
public View getView(Context context) {

View view = LayoutInflater.from(context).inflate(getCardLayout(), null);

mCardLayout = view;

try {
((FrameLayout) view.findViewById(R.id.cardContent))
.addView(getCardContent(context));
} catch (NullPointerException e) {
e.printStackTrace();
}

// ((TextView) view.findViewById(R.id.title)).setText(this.title);

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
int bottom = Utils.convertDpToPixelInt(context, 12);
lp.setMargins(0, 0, 0, bottom);

view.setLayoutParams(lp);

return view;
}

public View getViewLast(Context context) {

View view = LayoutInflater.from(context).inflate(getLastCardLayout(),
null);

mCardLayout = view;

try {
((FrameLayout) view.findViewById(R.id.cardContent))
.addView(getCardContent(context));
} catch (NullPointerException e) {
e.printStackTrace();
}

// ((TextView) view.findViewById(R.id.title)).setText(this.title);

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
int bottom = Utils.convertDpToPixelInt(context, 12);
lp.setMargins(0, 0, 0, bottom);

view.setLayoutParams(lp);

return view;
}

public View getViewFirst(Context context) {

View view = LayoutInflater.from(context).inflate(getFirstCardLayout(),
null);

mCardLayout = view;

try {
((FrameLayout) view.findViewById(R.id.cardContent))
.addView(getCardContent(context));
} catch (NullPointerException e) {
e.printStackTrace();
}

// ((TextView) view.findViewById(R.id.title)).setText(this.title);

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
int bottom = Utils.convertDpToPixelInt(context, 12);
lp.setMargins(0, 0, 0, bottom);

view.setLayoutParams(lp);

return view;
}

public abstract View getCardContent(Context context);

public OnClickListener getClickListener() {
return mListener;
}

public void setOnClickListener(OnClickListener listener) {
mListener = listener;
}

public void OnSwipeCard() {
if (onCardSwipedListener != null)
onCardSwipedListener.onCardSwiped(this, mCardLayout);
// TODO: find better implementation to get card-object's used content
// layout (=> implementing getCardContent());
}

public OnCardSwiped getOnCardSwipedListener() {
return onCardSwipedListener;
}

public void setOnCardSwipedListener(OnCardSwiped onEpisodeSwipedListener) {
this.onCardSwipedListener = onEpisodeSwipedListener;
}

protected int getCardLayout() {
return R.layout.item_card;
}

protected int getId() {
return R.id.cardContent;
}

protected int getLastCardLayout() {
return R.layout.item_card_empty_last;
}

protected int getFirstCardLayout() {
return R.layout.item_play_card_empty_first;
}

public interface OnCardSwiped {
public void onCardSwiped(Card card, View layout);
}

/**
* Attempt to reuse convertCardView. Should not modify convertCardView if it's
* not compatible. The implementer should check the card content part and
* verify that it matches.
* @param convertCardView the view to convert, with root Id equal to Card.getId()
* @return true on success, false if not compatible
*/
public abstract boolean convert(View convertCardView);

}

package com.fima.cardsui.objects;

import android.content.Context;
import android.view.View;
import android.widget.AdapterView;

public abstract class AbstractCard {

protected int image;
protected String description, packageName, versionName, color, titleColor,
desc, title, titlePlay;
protected Boolean hasOverflow, isClickable;
protected int imageRes;
protected Object data;
protected Context context;
protected AdapterView.OnItemSelectedListener onItemSelectedListener;
protected int versionCode;

public abstract View getView(Context context);

public abstract View getView(Context context, boolean swipable);

public String getTitle() {
return title;
}

public String getTitlePlay() {
return titlePlay;
}

public String getDesc() {
return desc;
}

public String getDescription() {
return description;
}

public int getImage() {
return image;
}

public String getColor() {
return color;
}

public String getTitleColor() {
return titleColor;
}

public Boolean getHasOverflow() {
return hasOverflow;
}

public Boolean getIsClickable() {
return isClickable;
}

public int getImageRes() {
return imageRes;
}

/**
* @return the data
*/

public Object getData() {
return data;
}

/**
* @param data
* the data to set
*/
public void setData(Object data) {
this.data = data;
}

public Context getContext() {
return context;
}

public void setContext(Context context) {
this.context = context;
}

public String getPackageName() {
return packageName;
}

public void setPackageName(String packageName) {
this.packageName = packageName;
}

public String getVersionName() {
return versionName;
}

public void setVersionName(String versionName) {
this.versionName = versionName;
}

public int getVersionCode() {
return versionCode;
}

public void setVersionCode(int versionCode) {
this.versionCode = versionCode;
}
public AdapterView.OnItemSelectedListener getOnItemSelectedListener() {
return onItemSelectedListener;

}
}

This what I added to the card.java

public Card(String title, String desc,String getPackageName,String getVersionName,int getVersionCode,AdapterView.OnItemSelectedListener onItemSelectedListener, String packageName, String versionName, int versionCode ) {
this.title = title;
this.desc = desc;
this.onItemSelectedListener = onItemSelectedListener;
this.packageName = packageName;
this.versionName = versionName;
this.versionCode = versionCode;
}

then the AbstractCard class

public String getPackageName() {
return packageName;
}

public void setPackageName(String packageName) {
this.packageName = packageName;
}

public String getVersionName() {
return versionName;
}

public void setVersionName(String versionName) {
this.versionName = versionName;
}

public int getVersionCode() {
return versionCode;
}

public void setVersionCode(int versionCode) {
this.versionCode = versionCode;
}
public AdapterView.OnItemSelectedListener getOnItemSelectedListener() {
return onItemSelectedListener;