If you think the Android project Rashr 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
package com.fima.cardsui.objects;
//www.java2s.comimport android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
/**
* A card that can be recycled when scrolled off screen.
*/publicabstractclass RecyclableCard extends Card {
public RecyclableCard() {
super();
}
public RecyclableCard(String title, int image) {
super(title, image);
}
public RecyclableCard(String titlePlay, String description, int imageRes,
String titleColor, Boolean hasOverflow, Boolean isClickable) {
super(titlePlay, description, imageRes, titleColor, hasOverflow, isClickable);
}
public RecyclableCard(String title, String desc, int image) {
super(title, desc, image);
}
public RecyclableCard(String titlePlay, String description, String color,
String titleColor, Boolean hasOverflow, Boolean isClickable) {
super(titlePlay, description, color, titleColor, hasOverflow, isClickable);
}
public RecyclableCard(String title, String desc) {
super(title, desc);
}
public RecyclableCard(String title) {
super(title);
}
/**
* Set the values of child views. The view will not be null and
* is guaranteed to have the layout of the root element equal to
* the layout resource ID from getCardLayoutId().
* @param convertView non-null view to modify
*/protectedabstractvoid applyTo(View convertView);
/**
* Get the R.layout ID of the root element of the content of the card.
* This value will be used to inflate the card and check whether an
* old card's View can be recycled.
* @return layout ID of the card content
*/protectedabstractint getCardLayoutId();
@Override
public View getCardContent(Context context) {
View view = LayoutInflater.from(context).inflate(getCardLayoutId(), null);
applyTo(view);
return view;
}
@Override
publicboolean convert(View convertCardView) {
View view = convertCardView.findViewById(getCardLayoutId());
if (view == null) {
return false;
}
applyTo(view);
return true;
}
}