Back to project page Pimp_my_Z1.
The source code is released under:
GNU General Public License
If you think the Android project Pimp_my_Z1 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.fima.cardsui; //from w w w . ja v a 2s . c om import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import com.fima.cardsui.objects.AbstractCard; import com.fima.cardsui.objects.CardStack; import java.util.ArrayList; public class StackAdapter extends BaseAdapter { private Context mContext; private ArrayList<AbstractCard> mStacks; private boolean mSwipeable; public StackAdapter(Context context, ArrayList<AbstractCard> stacks, boolean swipable) { mContext = context; mStacks = stacks; mSwipeable = swipable; } @Override public int getCount() { return mStacks.size(); } @Override public CardStack getItem(int position) { return (CardStack) mStacks.get(position); } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { final CardStack stack = getItem(position); stack.setAdapter(this); stack.setPosition(position); // the CardStack can decide whether to use convertView or not convertView = stack.getView(mContext, convertView, mSwipeable); return convertView; } public void setItems(ArrayList<AbstractCard> stacks) { mStacks = stacks; notifyDataSetChanged(); } public void setSwipeable(boolean b) { mSwipeable = b; } public void setItems(CardStack cardStack, int position) { mStacks.set(position, cardStack); } }